• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Nested panels & gridbaglayout

 
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi all,

Iam using gridbag layout and have run in to problems.

The following is my scenario:

My top level container is a JFrame.
To the JFrame,I have added a Jpanel & made it the content pane of the JFrame.
For the panel,I have used the GridBagLayout.

Now to the panel,I have added a toolbar and a splitpane(top level).

The splitpane is a nested pane with another splitpane inside & another component.

My questions ,here are

[1]As a rule ,is it recommended to set a min size,max size & a preferred size for each of the component or container put in the contentpane.

[2]I have provided the gridconstraints only for the toolbar & the toplevel splitpane.Is that sufficient or is it necessary to provide it for all the other containers & components as well.

for eg:- in the above said toolbar,Iam adding some buttons.I havent set any layout for the toolbar, co's the containing panel is set with the gridbaglayout.Is that sufficient .If not,what is the right thing to do...

Its really difficult to explain it in words.I have developed a quick & dirty application depicting the above behaviour.

Would be nice,If I could send the application to any one of you....Would appreciate it very much...

Thanks.......
 
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
[1]As a rule ,is it recommended to set a min size,max size & a preferred size for each of
the component or container put in the contentpane.

Generally, no. Sometimes the minimumPS and maximumPS come in handy and in BoxLayout they
seem to be used more often than in others. The preferredSize is often used to provide size
hints in Swing and especially in layouts that respect a child components preferredSize such
as GridBagLayout and FlowLayout.
[2]I have provided the gridconstraints only for the toolbar & the toplevel splitpane.Is that
sufficient or is it necessary to provide it for all the other containers & components as
well.

You only need to provide the constraints for child components that are added to a container
whose layout manager is GridBagLayout. Layout managers of children of the container aren't
concerned about the parent containers constraints per se. So, no.
Its really difficult to explain it in words.I have developed a quick & dirty application
depicting the above behaviour

Okay, let's have a look.

edit: Correct the formatting.
[ April 25, 2007: Message edited by: Craig Wood ]
 
Arun Sanker
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Craig.But How can I send my application to you.The forum contains no attachment functionality.....
 
Marshal
Posts: 79177
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The reason there is no attachment facility is that this is a public forum. We don't send code to one another, we post it (preferably using code tags and shortened only showing the problem area) so everybody can read it and learn from it.

CR
 
That is a really big piece of pie for such a tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic