Hi coders, Im confused about the GUI for FBN. Isn't JList more appropriate than JTable. The way I see it, the user searchs for a particular flight. Matching flights are return as a list(JLIst) of flights. The user clicks on the flight he is interested in, which gives more specific information about the flight and an option to enter number of seats and book flight. Where does the JTAble fit into this? How are people using JTAble in their GUI design? Do you edit a 'no. of seats' cell directly to book a flight? Richard Walter
Hi, the JTable is used to display the result set. An action listener needs to be attached to the ListModel of the JTable to process list selection events. Once a list selection event is fired, the event handler needs to determine which row was selected, then display details for that row. The number of seats to book text field may be part of the row detail which is displayed every time the row selection changes.
The spec says JTable. Unless you want some points deducted you'd better use JTable. I kinda see where they are going with this too. JTable is more flexible where it comes to column-based data. For example, you (on user request) may want to extend the JTable so that it shows Number Of Seat in different color, or use an a Warning icon if departure time is approaching, or edit some fields later on , or simply re-arrange columns for better viewing, stuff like that. JList is a simplistic approach to this problem. But again, it would be a matter of your choice if the spec had not explicitely stated to use JTable. Hope this helps. [This message has been edited by Gennady Shapiro (edited October 31, 2001).]
posted 18 years ago
Thanks guys for answering. Its starting to make a little more sense. If I have understood correctly the JTable is more customizable but you are treating it like a list, where the user selects a row which is associated with a particular flight. There is no modification of individual cells, Am I right here? I presume when a row is selected from the JTable, a dialog window pops-up (or, alternatively is displayed in another view on the main GUI) which allows the number of seats to book to be entered.
This is how I did my gui, comments would be great... I have to combo boxes which are populate with the data from the database, with the "any" word added as the first choice. Upon startup I display all of the database record (which at the moment isn't a problem because there are only 24 records). I made my combo boxes "active" so to speak, in that I don't have to click any search button. If I changed the origin combo box, just the orgins in my jtable change. I then just placed a textfield to take the number of desired seats and "book" button immediately above my jtable, and have a pop-up window displaying the success or failure of booking. I did things this way to reduce the amount of mouse clicking by the user. Dave
Just noticed some talk of using a gui builder such like the one you would find with IDE's such as Jbuilder. I've been using jbuilder for my programming, but I did not use it to create my gui. I was looking more for clean, easy functionality than something fancy with a lot of bells and whistles. The project specifications say we "may" use and IDE but there musn't be any residual dependencies because of it. I kept my button on the top as to centralize mouse movment/clicking as much as posible.I was also thinking of reducing clicking even more by not even having pop-up windows, instead have just a label with the "status" and the success/failure messages. Anyone who has already passed the project aspect of the certification have any comment on this?
So it takes a day for light to pass through this glass? So this was yesterday's tiny ad?