1164 Java Utilities Package and Bit (Web server type) Manipulation Chapter
1164 Java Utilities Package and Bit Manipulation Chapter 20 80 81 getButton.addActionListener( 82 83 new ActionListener() { 84 85 // get value for specific key 86 public void actionPerformed( ActionEvent event ) 87 { 88 Object value = table.get( lastNameField.getText() ); 89 90 // value found for key 91 if ( value != null ) 92 statusLabel.setText( 93 “Get: ” + value.toString() ); 94 95 // value not found for key 96 else 97 statusLabel.setText( 98 “Get: ” + lastNameField.getText() + 99 ” not in table” ); 100 } 101 } 102 ); 103 104 southPanel.add( getButton ); 105 106 // button to remove key/value pair from table 107 JButton removeButton = new JButton( “Remove” ); 108 109 removeButton.addActionListener( 110 111 new ActionListener() { 112 113 // remove key/value pair 114 public void actionPerformed( ActionEvent event ) 115 { 116 Object value = 117 table.remove( lastNameField.getText() ); 118 119 // key found 120 if ( value != null ) 121 statusLabel.setText( “Remove: ” + 122 value.toString() ); 123 124 // key not found 125 else 126 statusLabel.setText( “Remove: ” + 127 lastNameField.getText() + ” not in table” ); 128 } 129 } 130 ); 131 132 southPanel.add( removeButton ); Fig. 20.3 Demonstrating class Hashtable(part 3 of 6).
Note: If you are looking for cheap and reliable webhost to host and run your mysql application check Vision professional web hosting services