File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Layout design problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Layout design problem" Watch "Layout design problem" New topic
Author

Layout design problem

david arnold
Ranch Hand

Joined: Apr 10, 2009
Posts: 129
Hi,

I want to create a window like the attached image. I am thinking to do it this way, but I do not know if it is a good way?



Another thing is that scroll pane needs to contain multiple pane3 according to database image number, in such case, should I create array panel3, array leftPane, array rightPane, array checkbox..... to accomplish the purpose? or there is other better ways?

Thanks for the advice and help!


[Thumbnail for layout.JPG]

Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4523
    
    5

I see you've done the whole thing using BorderLayout. If the proportions in your illustration are close to what you need, I would suggest:

For the inner panels:
-- a GridLayout(1, 2) with
---- the image in the first cell
---- A JPanel with either BoxLayout.Y_AXIS or GridLayout(0, 1) in the second cell, holding the check boxes etc

For the outer panel, the one which is housed in a scroll pane:
-- Again, either BoxLayout.Y_AXIS or GridLayout(0, 1).

The choice of BoxLayout or GridLayout(0, 1) in both cases largely depends on whether you want each enclosed component to appear at its own preferredSize.height or you want them to take up equal vertical space.


luck, db
There are no new questions, but there may be new answers.
david arnold
Ranch Hand

Joined: Apr 10, 2009
Posts: 129
Thank you Darryl for the help!

As mentioned in the above post, I have another problem about how to create multiple pane3. Should I create array of each component that belong to pane3, or there is other better ways. One requirement is that user can only check the checkbox(s) on one of the pane3. In other words, user can not check the checkbox that belong to different pane3.

Thanks.
david arnold
Ranch Hand

Joined: Apr 10, 2009
Posts: 129
The choice of BoxLayout or GridLayout(0, 1) in both cases largely depends on whether you want each enclosed component to appear at its own preferredSize.height or you want them to take up equal vertical space.


Another question, I tried using BoxLayout like this


And when there are two pane3, it occupy the whole contentPane though I set the preferredSize for each pane3. Could I use BoxLayout and set its componet with prefered height. For example, the contentPane height is 100, each pane3 height is 30, then there should be 100-30*2= 40 height space below the two pane3. Could i do that?
Darryl Burke
Bartender

Joined: May 03, 2008
Posts: 4523
    
    5

Add a Box.createVerticalGlue()
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Layout design problem
 
Similar Threads
Help with the Layout
Stii having problems
Can I set up a JTable columns?
JFrame Help Please
JFileChooser