Chapter 20 Java Utilities Package and Bit Manipulation (Database web hosting)
Chapter 20 Java Utilities Package and Bit Manipulation 1159 127 int result = stack.search( searchKey ); 128 129 if ( result == -1 ) 130 statusLabel.setText( searchKey + ” not found” ); 131 else 132 statusLabel.setText( searchKey + 133 ” found at element ” + result ); 134 } 135 } 136 ); 137 138 container.add( searchButton ); 139 140 // button to display stack contents 141 JButton displayButton = new JButton( “Display” ); 142 143 displayButton.addActionListener( 144 145 new ActionListener() { 146 147 public void actionPerformed( ActionEvent event ) 148 { 149 // output Stack contents 150 Enumeration enumeration = stack.elements(); 151 StringBuffer buffer = new StringBuffer(); 152 153 while ( enumeration.hasMoreElements() ) 154 buffer.append( 155 enumeration.nextElement() ).append( ” ” ); 156 157 JOptionPane.showMessageDialog( null, 158 buffer.toString(), “Display”, 159 JOptionPane.PLAIN_MESSAGE ); 160 } 161 } 162 ); 163 164 container.add( displayButton ); 165 container.add( statusLabel ); 166 167 setSize( 675, 100 ); 168 setVisible( true ); 169 } 170 171 // execute application 172 public static void main( String args[] ) 173 { 174 StackTest application = new StackTest(); 175 176 application.setDefaultCloseOperation( 177 JFrame.EXIT_ON_CLOSE ); 178 } 179 Fig. 20.2 Demonstrating class Stackof package java.util(part 4 of 5).
Note: If you are looking for high quality webhost to host and run your jsp application check Vision jsp web hosting services