1166 Java Utilities Package and Bit Manipulation Chapter (Frontpage web hosting)
Saturday, April 28th, 20071166 Java Utilities Package and Bit Manipulation Chapter 20 186 187 // button to display hash table elements 188 JButton listElementsButton = new JButton( “List objects” ); 189 190 listElementsButton.addActionListener( 191 192 new ActionListener() { 193 194 // display hash table elements 195 public void actionPerformed( ActionEvent event ) 196 { 197 StringBuffer buffer = new StringBuffer(); 198 199 for ( Enumeration enumeration = table.elements(); 200 enumeration.hasMoreElements(); ) 201 buffer.append( 202 enumeration.nextElement() ).append( ‘n’ ); 203 204 displayArea.setText( buffer.toString() ); 205 } 206 } 207 ); 208 209 southPanel.add( listElementsButton ); 210 211 // button to display hash table keys 212 JButton listKeysButton = new JButton( “List keys” ); 213 214 listKeysButton.addActionListener( 215 216 new ActionListener() { 217 218 // display hash table KEYS 219 public void actionPerformed( ActionEvent event ) 220 { 221 StringBuffer buffer = new StringBuffer(); 222 223 for ( Enumeration enumeration = table.keys(); 224 enumeration.hasMoreElements(); ) 225 buffer.append( 226 enumeration.nextElement() ).append( ‘n’ ); 227 228 JOptionPane.showMessageDialog( null, 229 buffer.toString(), “Display”, 230 JOptionPane.PLAIN_MESSAGE ); 231 } 232 } 233 ); 234 235 southPanel.add( listKeysButton ); 236 237 Container container = getContentPane(); 238 container.add( northPanel, BorderLayout.NORTH ); Fig. 20.3 Demonstrating class Hashtable(part 5 of 6).
Note: If you are looking for cheap and reliable webhost to host and run your mysql application check Vision mysql hosting services