aspose file tools*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes BookingFieldListener Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "BookingFieldListener" Watch "BookingFieldListener" New topic
Author

BookingFieldListener

Mario Zott
Greenhorn

Joined: Feb 02, 2003
Posts: 21
Hello to everyone,
My GUI is almost done, but I have one question about handling the ENABLE state of the booking button. I created 2 JTextFields (Flightnr, seatsToBook), but the bookButton should only be enabled, if both field contain some text. So i created the following class:

is this a "good way" to handle this ...?
pleased to get some suggestions...
thanx mario
Ben Ritchie
Ranch Hand

Joined: Nov 18, 2002
Posts: 98
I did it differently - a flight is selected by clicking on a row in the table, and I use a JSpinner for the number of seats to book. Each time a new row is selected the spinner limits are set so that 1 <= number to book <= available seats. If the flight is full then the spinner and the book button are disabled. This means you can never try and book seats that are not available.


SCJP1.4, SCJD, SCEA (in progress)
Mario Zott
Greenhorn

Joined: Feb 02, 2003
Posts: 21
sounds nice (actually this is how I had it before), until the following thought came into my mind: what about booking a flight without selecting it from the table - usually the person who operates the booking - keeps some high recomended flightNr's in mind, - so he/she enters the flightNr and some seats, and presses the bookbutton... (by the way JSpinner was the only class i used from the 1.4 api - so i decided to give all machines with < 1.4 version a chance to run my application )
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: BookingFieldListener