Java graphical tools: Java Graphical package java.awt:Abstract Window ToolKit, you need to call the local system method to implement the function javax. Swing: On the basis of AWT, more components are available, which enhances portability. Componnet:button: Button Label: Component Object checkbox: CheckBox (Tick box) TextComponent: Text area container: As a container, you can add components to it window: Windows Frame: Frame Dialog : dialog box FileDialog: File Dialog panel: Panel layout manager: FlowLayout (streaming layout manager) left-to-right order panel default layout manager borderlayout (Boundary layout manager) In the middle of the frame default layout manager GridLayout (Grid layout manager) Rule Matrix CardLayout (Card layout manager) tab gridbaglayout (Grid layout manager) irregular matrix window build frame f= new Frame ("My AWT"); F.setsize (500,400);//Set Window size f.setlocation (300, 200);//Set Window position f.setlayout (new FlowLayout ());//Set Layout management button B = New button ("I am a button");//new Buttons F.add (b);//Add button textfield tf = new TextField (20);//Create a new text input window // Listen action, implement 7 actions in Windowadapter class, F.addwindowlistener in Java.awt.* package (new Windowadapter () {//close window to call public void Windowclosing (WindowEvent e) {System.out.println ("window closing-----" +e.tostring ()); System.exit (0);} Call public void Windowactivater (WindowEvent e) {System.out.println ("active") as soon as the window is activated;} Open the window and call public void windowopened (WindowEvent e) {System.out.priNtln ("Dakai,hahah");}); /Add function to button B.addactionlistener (new ActionListener () {public void actionperformed (ActionEvent e) {system.exit (0);}}); /mouse function B.addmouselistener (new Mouseadapter () {private int count = 1;private int clickcount = 1;public void mouseentered (Mous Eevent e) {System.out.println ("mouse enters into this event");} public void mouseclicked (MouseEvent e) {if (E.getclickcount () ==2) System.out.println ("Double-click action" +clickcount++);}); /Text Window function Tf.addkeylistener (new Keyadapter () {public void keypressed (KeyEvent e) {int code = E.getkeycode (); if (code>= Keyevent.vk_0&&code<=keyevent.vk_9) {System.out.println (code+ "... E.consume ();//Let E event not occur neither type text box} }}); f.setvisible (true);//Display window
GUI graphical interface Java implementation