• Post Reply Bookmark Topic Watch Topic
  • New Topic

How can I achieve this layout?  RSS feed

 
Mike Lipay
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm not sure how to create this window, the upper portion is static (in that it is not alterable by this window), the lower portion is also static, but scrollable. Clicking on the button on the left (1,2) will bring up a detailed window that can be edited.

What I am unsure of is how to create a scrollable pane inside a non-scrollable pane, and to have field columns within the scrollable pane.

Thanks, Mike.



 
Rob Spoor
Sheriff
Posts: 20892
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This requires a mix of layout managers, each with its own panel.

You start with the main panel, that will have a BorderLayout.
The static top part will be added to the main panel using BorderLayout.NORTH. To go the easy way the top panel can use a right-aligned FlowLayout.
The remainder can be a JScrollPane that will be added to the main panel using BorderLayout.CENTER. Inside this JScrollPane you add a JTable - that seems to be the best option for your tabular data. That only leaves the buttons at the start of each column; do a search in this forum for how to add buttons inside tables.

Summarizing:
Check out the Javadoc pages of JScrollPane for how to use it best. Especially check out the "How to Use Scroll Panes" link.
 
Mike Lipay
Ranch Hand
Posts: 171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks. I hadn't heard of JTable before, will have to look into the docs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!