Java The Complete Reference, Seventh Edition
888 Part III: Software Development Using Java When the user selects or deselects a check box, anItemEventis generated. You can o ...
cb.addItemListener(this); add(cb); cb = new JCheckBox("Java"); cb.addItemListener(this); add(cb); cb = new JCheckBox("Perl"); cb ...
890 Part III: Software Development Using Java that you will normally implement theActionListenerinterface. Recall that the only ...
Chapter 30: Exploring Swing 891 JRadioButton b2 = new JRadioButton("B"); b2.addActionListener(this); add(b2); JRadioButton b3 = ...
892 Part III: Software Development Using Java The general procedure to use a tabbed pane is outlined here: Create an instance o ...
Chapter 30: Exploring Swing 893 add(b3); JButton b4 = new JButton("Tokyo"); add(b4); } } class ColorsPanel extends JPanel { publ ...
894 Part III: Software Development Using Java a table, or a group of components contained within another lightweight container, ...
Chapter 30: Exploring Swing 895 } private void makeGUI() { // Add 400 buttons to a panel. JPanel jp = new JPanel(); jp.setLayout ...
896 Part III: Software Development Using Java JListprovides several constructors. The one used here is JList(Object[ ]items) Thi ...
Instead of obtaining the index of a selection, you can obtain the value associated with the selection by callinggetSelectedValue ...
898 Part III: Software Development Using Java // Create a JList. jlst = new JList(Cities); // Set the list selection mode to sin ...
Chapter 30: Exploring Swing 899 that lets the user enter a selection into the text field. TheJComboBoxconstructor used by the ex ...
900 Part III: Software Development Using Java makeGUI(); } } ); } catch (Exception exc) { System.out.println("Can't create becau ...
Chapter 30: Exploring Swing 901 In the first form, the tree is constructed from the elements in the arrayobj. The second form co ...
902 Part III: Software Development Using Java The following example illustrates how to create a tree and handle selections. The ...
// Create subtree of "B". DefaultMutableTreeNode b = new DefaultMutableTreeNode("B"); top.add(b); DefaultMutableTreeNode b1 = ne ...
JTable JTableis a component that displays rows and columns of data. You can drag the cursor on column boundaries to resize colum ...
Chapter 30: Exploring Swing 905 The following example illustrates how to create and use a simple table. A one-dimensional array ...
// Create the table. JTable table = new JTable(data, colHeads); // Add the table to a scroll pane. JScrollPane jsp = new JScroll ...
31 Servlets T his chapter presents an overview ofservlets.Servlets are small programs that execute on the server side of a web c ...
«
42
43
44
45
46
47
48
49
50
51
»
Free download pdf