Java The Complete Reference, Seventh Edition
728 Part II: The Java Library setBackground(Color.cyan); setLayout(new BorderLayout()); add(new Button("This is across the top." ...
The first form creates a single-column grid layout. The second form creates a grid layout with the specified number of rows and ...
730 Part II: The Java Library CardLayout TheCardLayoutclass is unique among the other layout managers in that it stores several ...
Chapter 24: Using AWT Controls, Layout Managers, and Menus 731 import java.applet.; / */ public class CardLayoutDemo extends A ...
732 Part II: The Java Library public void mousePressed(MouseEvent me) { cardLO.next(osCards); } // Provide empty implementations ...
manager. AlthoughGridBagLayoutis a bit more complicated than the other layout managers, it is still quite easy to use once you u ...
734 Part II: The Java Library GridBagConstraintsalso defines several static fields that contain standard constraint values, such ...
Chapter 24: Using AWT Controls, Layout Managers, and Menus 735 Thegridwidthvariable lets you specify the width of a cell in term ...
736 Part II: The Java Library gbc.gridwidth = GridBagConstraints.RELATIVE; gbag.setConstraints(solaris, gbc); gbc.gridwidth = Gr ...
Chapter 24: Using AWT Controls, Layout Managers, and Menus 737 Menu Bars and Menus A top-level window can have a menu bar associ ...
738 Part II: The Java Library You can create a checkable menu item by using a subclass ofMenuItemcalled CheckboxMenuItem. It has ...
Chapter 24: Using AWT Controls, Layout Managers, and Menus 739 */ // Create a subclass of Frame. class MenuFrame extends Frame ...
740 Part II: The Java Library item5.addActionListener(handler); item6.addActionListener(handler); item7.addActionListener(handle ...
Chapter 24: Using AWT Controls, Layout Managers, and Menus 741 else if(arg.equals("Close")) msg += "Close."; else if(arg.equals( ...
742 Part II: The Java Library Sample output from theMenuDemoapplet is shown in Figure 24-8. There is one other menu-related clas ...
Chapter 24: Using AWT Controls, Layout Managers, and Menus 743 import java.applet.; / */ // Create a subclass of Dialog. class ...
744 Part II: The Java Library edit.add(item7 = new MenuItem("Paste")); edit.add(new MenuItem("-")); Menu sub = new Menu("Special ...
Chapter 24: Using AWT Controls, Layout Managers, and Menus 745 class MyWindowAdapter extends WindowAdapter { MenuFrame menuFrame ...
746 Part II: The Java Library public void itemStateChanged(ItemEvent ie) { menuFrame.repaint(); } } // Create frame window. publ ...
Chapter 24: Using AWT Controls, Layout Managers, and Menus 747 FileDialog Java provides a built-in dialog box that lets the user ...
«
34
35
36
37
38
39
40
41
42
43
»
Free download pdf