Java Reference
In-Depth Information
206 browseButtonActionPerformed(evt);
207 }
208 }
209 );
210
211 add(browseButton);
212
213 insertButton.setText( "Insert New Entry" );
214 insertButton.addActionListener(
215 new ActionListener()
216 {
217 public void actionPerformed(ActionEvent evt)
218 {
219 insertButtonActionPerformed(evt);
220 }
221 }
222 );
223
224 add(insertButton);
225
226 addWindowListener(
227 new WindowAdapter()
228 {
229 public void windowClosing(WindowEvent evt)
230 {
231 personQueries.close(); // close database connection
232 System.exit( 0 );
233 }
234 }
235 );
236
237 setVisible( true );
238 } // end constructor
239
240 // handles call when previousButton is clicked
241 private void previousButtonActionPerformed(ActionEvent evt)
242 {
243 currentEntryIndex--;
244
245 if (currentEntryIndex < 0 )
246 currentEntryIndex = numberOfEntries - 1 ;
247
248 indexTextField.setText( "" + (currentEntryIndex + 1 ));
249 indexTextFieldActionPerformed(evt);
250 }
251
252 // handles call when nextButton is clicked
253 private void nextButtonActionPerformed(ActionEvent evt)
254 {
255 currentEntryIndex++;
256
257 if (currentEntryIndex >= numberOfEntries)
258 currentEntryIndex = 0 ;
Fig. 24.32 | A simple address book. (Part 5 of 8.)
Search WWH ::




Custom Search