File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Layout design problem

 
david arnold
Ranch Hand
Posts: 133
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!
layout.JPG
[Thumbnail for layout.JPG]
 
Darryl Burke
Bartender
Posts: 5115
11
Java Netbeans IDE Opera
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
david arnold
Ranch Hand
Posts: 133
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 133
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 5115
11
Java Netbeans IDE Opera
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Add a Box.createVerticalGlue()
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic