Import Java.awt.EventQueue;
Import Javax.swing.JFrame;
Import Javax.swing.JPanel;
Import Javax.swing.border.EmptyBorder;
Import Javax.swing.JButton;
Import Javax.swing.JTextField;
Import Javax.swing.JLabel;
Import Java.awt.Color;
Import Java.awt.SystemColor;
Import Java.awt.event.ActionListener;
Import java.awt.event.ActionEvent;
Import Java.awt.event.MouseAdapter;
Import java.awt.event.MouseEvent;
public class Guess01 extends JFrame {/** * */private static final long serialversionuid = 1L;
Private JPanel ContentPane;
Private JTextField Tfdir;
Private JTextField Tfclass;
/** * Launch the application. */public static void main (string[] args) {Eventqueue.invokelater (new Runnable () {public void Ru
N () {try {Guess01 frame = new Guess01 ();
Frame.setvisible (TRUE);
catch (Exception e) {e.printstacktrace (); }
}
});
}/** * Create the frame.
* * Public Guess01 () {settitle ("\u731c\u731c\u770b\u6e38\u620fv0.1");
Setdefaultcloseoperation (Jframe.exit_on_close);
SetBounds (100, 100, 645, 409);
ContentPane = new JPanel ();
Contentpane.setborder (New Emptyborder (5, 5, 5, 5));
Setcontentpane (ContentPane);
Contentpane.setlayout (NULL);
Select the handler for the directory button JButton btndir = new JButton ("\u9009\u62e9\u76ee\u5f55");
Btndir.addactionlistener (new ActionListener () {public void actionperformed (ActionEvent arg0) {
}
});
Btndir.setbounds (26, 26, 93, 23);
Contentpane.add (Btndir);
text box, showing directory tfdir = new JTextField ();
Tfdir.seteditable (FALSE);
Tfdir.setbounds (125, 27, 363, 21);
Contentpane.add (Tfdir);
Tfdir.setcolumns (10); Select the handler for the class button JBUTton Btnclass = new JButton ("\u9009\u62e9\u73ed\u7ea7");
Btnclass.addactionlistener (new ActionListener () {public void actionperformed (ActionEvent e) {
}
});
Btnclass.setbounds (26, 59, 93, 23);
Contentpane.add (Btnclass);
text box, showing class file Tfclass = new JTextField ();
Tfclass.seteditable (FALSE);
Tfclass.setbounds (125, 60, 363, 21);
Contentpane.add (Tfclass);
Tfclass.setcolumns (10);
Label, show with guess student name JLabel lbguessname = new JLabel ("\u59d3\u540d");
Lbguessname.setbounds (259, 91, 102, 23);
Contentpane.add (Lbguessname);
Label, showing the first student photo JLabel lblImg1 = new JLabel ("\u56fe\u72471"); Lblimg1.addmouselistener (New Mouseadapter () {@Override public void mouseclicked (MouseEvent arg0)
{
}
});
Lblimg1.setbounds (26, 151, 183, 178); Contentpane.add (LBLIMG1);
Label, showing the second student photo JLabel LblImg2 = new JLabel ("\u56fe\u72472");
Lblimg2.addmouselistener (New Mouseadapter () {@Override public void mouseclicked (MouseEvent e) {
}
});
Lblimg2.setforeground (Color.Black);
Lblimg2.setbackground (systemcolor.inactivecaption);
Lblimg2.setbounds (241, 155, 183, 172);
Contentpane.add (LBLIMG2);
Label, showing a third student photo JLabel lblImg3 = new JLabel ("\u56fe\u72473");
Lblimg3.addmouselistener (New Mouseadapter () {@Override public void mouseclicked (MouseEvent e) {
}
});
Lblimg3.setbounds (434, 155, 185, 172);
Contentpane.add (LBLIMG3);
Once again, click the button, then update the corresponding three pictures with a guess student name JButton btnguessagain = new JButton ("\u518d\u731c\u4e00\u6b21");
Btnguessagain.addactionlistener (new ActionListener () { public void actionperformed (ActionEvent e) {}});
Btnguessagain.setbounds (223, 337, 93, 23);
Contentpane.add (Btnguessagain); }
}
What we have done today is to know the approximate code of guessing the game, and to consult the knowledge point of the goal. Prepare for each of the following