File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes CONFUSED ... Isn't JList more appropriate than JTable? 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 "CONFUSED ... Isn Watch "CONFUSED ... Isn New topic
Author

CONFUSED ... Isn't JList more appropriate than JTable?

Richard Walter
Greenhorn

Joined: May 26, 2001
Posts: 22
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
Mike Wiegand
Greenhorn

Joined: May 30, 2001
Posts: 15
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.
Gennady Shapiro
Ranch Hand

Joined: Sep 25, 2001
Posts: 196
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).]
Richard Walter
Greenhorn

Joined: May 26, 2001
Posts: 22
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.
Dave McCarthy
Greenhorn

Joined: Jun 12, 2001
Posts: 23
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
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17249
    
    6

Hey Dave, it sounds like you stole my GUI. Actually my drop downs aren't active and the number of seats to book and the book button is underneath my JTable.
Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Dave McCarthy
Greenhorn

Joined: Jun 12, 2001
Posts: 23

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?

Dave
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: CONFUSED ... Isn't JList more appropriate than JTable?
 
Similar Threads
How many different flight bookings per invocation?
JTable/GUI Questions
question about my JTable
lock(-1)...
Problems with JTable & JComboBox