Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Question about layout

 
david arnold
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I want to create a GUI like the attachment. Well, I am thinking of using BorderLayout (which I am only familiar with) to do it. But I found it kind of troublesome. I created many pane to draw the GUI, any good idea about how to achieve this?

Thanks.
layout.JPG
[Thumbnail for layout.JPG]
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> Well, I am thinking of using BorderLayout (which I am only familiar with) to do it. But I found it kind of troublesome.

only 2 borderLayout panels are required, so it has to be a lot easier (less troublesome) than a GridBagLayout.

simple demo (titledBorder code only to show where they are)



[edit]
and holdingPanel1 could be the contentPane instead
 
david arnold
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Wow, that is cool, much better than what I did. Thank you Michael very much for the help. I really appreciate it.

Actually I was thinking to use GridBagLayout, which only needs one layer to create this UI, but it looks complicated for me. The reason I want to use it is that I am not sure if I want to update panel 3 which will show a scanned image, do I also need to update holdingPanel 2 which hold panel 3? Thanks.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> The reason I want to use it is that I am not sure if I want to update panel 3 which will show a scanned image,
> do I also need to update holdingPanel 2 which hold panel 3?

if I'm reading this correctly, all you'd probably need to do is make panel3 a BorderLayout or a Gridlayout(1,1),
then add to panel3 a JLabel to display your image, using label.setIcon(..) to change/update the image.
 
david arnold
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I see. Thanks again for your help, Michael!

Regards.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic