|
|
GridLayout or JTable in Java
|
|
|
|
Fresh-Faced Recruit
Join Date: Jan 2003
Location: In front of a 12 inch PowerBook
Status:
Offline
|
|
I am trying to decide on a strategy for displaying a grid-like array of GUI elements
Each element is a JPanel, and will have various subcomponents which will be updated by other parts of my program.
The elements need to be displayed in 9 x 9 array to the user. At various points columns need to be added to the array. There are also 2 such arrays in the program. Only 1 array will be visible to the user at a time. The arrays also need to be alternatively swapped at various points.
I would like to display the array in a JPanel as part of a larger layout.
Should I use GridLayout and add and remove elements or should I use JTable. I have never used JTable before? Can the elements in a JTable be JPanels?
Thanks,
Jonathan
|
|
|
|
|
|
|
|
|
Registered User
Join Date: Feb 2003
Status:
Offline
|
|
|
|
|
|
|
|
|
|
|
Fresh-Faced Recruit
Join Date: Jan 2003
Location: In front of a 12 inch PowerBook
Status:
Offline
|
|
Thanks for the suggestion. I just did that.
Jonathan
|
|
|
|
|
|
|
|
|
Fresh-Faced Recruit
Join Date: Mar 2003
Status:
Offline
|
|
|
|
|
|
|
|
|
|
|
Forum Regular
Join Date: Jan 2003
Location: Jersey City, NJ
Status:
Offline
|
|
Originally posted by jameshays:
Also, post it at www.JavaOnUnix.net You should have a good answer shortly.
I'd recommend using GridBagLayout since it is very flexible. I'm sure you can probably achieve the same effect using a JTable but I'd image you will have to put in alot more efforts.
Here is a set of tutorials: http://java.sun.com/docs/books/tutorial/uiswing/
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Forum Rules
|
|
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
|
HTML code is Off
|
|
|
|
|
|
|
|
|
|
|
|