Java Minesweeper Game source case Project

Source: Internet
Author: User

The code is as follows

import java.awt.*;import javax.swing.*;//Graphics counter jcounter three-bit class jcounter extends jpanel  {        private static final long  Serialversionuid = 1l;        private imageicon []  numset = { new imageicon ("Image/c0.gif"),  new imageicon ("Image/c1.gif"),                                                new imageicon ("Image/c2.gif"), new  ImageIcon ("Image/c3.gif"),                                       &nbSp;       new imageicon ("Image/c4.gif"),  new ImageIcon (" Image/c5.gif "),                                               new imageicon ("Image/c6.gif"),  new imageicon ("Image/c7.gif"),                                               new  ImageIcon ("Image/c8.gif"),  new imageicon ("Image/c9.gif"),                                 &Nbsp;        };        private  jbutton [] counter = { new jbutton (Numset[0]),  new JButton ( Numset[0]),  new jbutton (numset[0])};        private int  counterNum;        private Insets space;         public jcounter ()  {                 this (0);         }        public jcounter (Int num)  {                 super ();                 setsize (23, 39);                                  space = new insets (0,0,0,0);                 this.counterNum = num;                 for  (int  i=0; i< 3; i++) {                         counter[i].setsize (13,23);                          counter[i].setmargin (space);                         add (Counter[i] );                 }                                  this.setvisible (True);                  resetimage ();                  }                 public int getcounternum ()  {                          return (Counternum);        }                 private void  Setcounternum (Int num) {                 this.counternum = num;        }                 private void resetimage ()  {                int  ones, tens, hundreds;                 ones = counterNum % 10 ;                 tens = counterNum % 100/10;                 hundreds  =  (Counternum)  % 1000/100;                 this.counter[0].seticon (Numset[hundreds]);                 this.counter[1].seticon (Numset[tens]);                 this.counter[2].seticon (Numset[ones]);         }                 public void resetcounter (Int num)  {                 setcounternum (num);                 resetimage ();                 this.repaint ();         }        public static void main (String[]  args)  {  &NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;&NBSP;JFRAME&NBSP;JF  = new jframe ("Test");                 jf.setsize (23,39);                 jcounter jc = new jcounter ();                 jf.setcontentpane (JC);                 jf.show ();                                  jc.resetcounter (394);         }                 }


<ignore_js_op>650) this.width=650; "id=" aimg_1178 "class=" Zoom "src=" http://img.662p.com/java/forum/201410/ 18/125015fxn85mx8p0nen52a.jpg "width=" 405 "style=" border:0px; "/>

Detailed Description: http://java.662p.com/thread-3209-1-1.html


Java Minesweeper Game source case Project

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.