• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

GUI question

 
Cathy Young
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have a question about GUI in the assignment. What I am using is JFrame-JScrollPane-JTable. But I had run time error saying the layout manager for JScrollPane has to be ScrollPaneLayout, but I could not find out how to specify the position of JScrollPane (something similar to BorderLayout.EAST) in API. If I simply add them one by one (I have more than one JScrollPane), it seems that they are overlapping each other.
Any idea on how to deal with this or other altenative solutions?
Thanks!
Cathy
 
Sai Prasad
Ranch Hand
Posts: 560
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Set the container of your JFrame to BorderLayout. Add the panel containing the search criteria to the BorderLayout.NORTH. Add the JScrollPane which contains the JTable to BorderLayout.CENTER.
You add the the panel with the Details button to BorderLayout.SOUTH. I don't know why you have two JScrollPane(s). Keep it simple.
 
Cathy Young
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
the panel containing the search criteria to the BorderLayout.NORTH.

Hi, Sai,
Is this "panel" a JPanel or JScrollPane? I believe you still need to set the layout manager for it since you need to order the criteria combo's and the button for submit. Then how will you do with this? Thanks!
 
Sai Prasad
Ranch Hand
Posts: 560
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I would use a JPanel to add the search criteria components and set one of the layouts. I used GridBagLayout to add the JComboBox and JTextField(s). It is your choice.
 
Cathy Young
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Sai Prasad:
I would use a JPanel to add the search criteria components and set one of the layouts. I used GridBagLayout to add the JComboBox and JTextField(s). It is your choice.


Thanks, Sai!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic