• Post Reply Bookmark Topic Watch Topic
  • New Topic

GridBagLauot playing dirty tricks  RSS feed

 
Peter Miklosko
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm back to start again with GBL. Application start-up layout is as desired. However as soon as I draw upon "main page view panel" with paintComponent() page view panel does overlay thumbnail panel on the left.

Code for main panel to group up 3 main components


and drawing on main view panel ( I do not think issue is here)
gbl_overlap.png
[Thumbnail for gbl_overlap.png]
 
Peter Miklosko
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I may say that I'm little disappointed. So many professional programmers and nobody is able to provide a suggestion.
gbc.ipadx = 185; in my code may not be best thing to use.

But how to force width of thumbnail panel to certain size if layout manager ignores preferred size set in component?

Or is there any other layout that may satisfies requirements of the situation? (Toolbar height 65px, fill rest; thumbnail panel 185 width, fill vertically; view panel fill in both directions)
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
> I may say that I'm little disappointed. So many professional programmers and nobody is able to provide a suggestion.

most don't use GridBagLayout.

at the very least, if you want someone to look at a problem in gbl code, you would need to provide a working example,
not a snippet or part program - the numerous constraints make reading gbl code almost impossible to 'vision'.

> Or is there any other layout that may satisfies requirements of the situation?
> (Toolbar height 65px, fill rest; thumbnail panel 185 width, fill vertically; view panel fill in both directions)

perhaps a BorderLayout
Toolbar in NORTH
thumbnailPanel at WEST
viewPanel in CENTER

 
Mikko Kohtamäki
Ranch Hand
Posts: 112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes, maybe GridBagLayout wont calculate ipadx to thumbnailPanel's preferred- / minimumSize when placing another component next to it (who knows?) and will only see the minimumSize when adding viewPanel ?

BorderLayout should be better choice when placing such few components like Michael suggested...
 
Peter Miklosko
Ranch Hand
Posts: 76
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It was original frame display mode that was playing havoc with my layout. Setting frame size based on Toolkit.getDefaultToolkit().getScreenSize(); doesn't put frame in max mod.
This was enforced by

Now frame layout is what I wanted from the start. Unfortunately resize have to be disabled as any change will mess up again. I'm not sure why this does happens....
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!