• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Devaka Cooray
  • Ron McLeod
  • Jeanne Boyarsky
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
  • Tim Holloway
Bartenders:
  • Martijn Verburg
  • Frits Walraven
  • Himai Minh

Question about layout

 
Ranch Hand
Posts: 133
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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]
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I see. Thanks again for your help, Michael!

Regards.
 
What are you doing in my house? Get 'em tiny ad!
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic