This week's book giveaway is in the Jython/Python forum.
We're giving away four copies of Murach's Python Programming and have Michael Urban and Joel Murach on-line!
See this thread for details.
Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

GridBagLayout and Canvases  RSS feed

 
Chris Felton
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Using Gridlayout, i can add canvasses (with pictures/drawings etc) no problem, but when I use GridBagLayout, I cannot get the canvas (or even a space on screen where the canvas should be) to appear.
Any Ideas ?
 
AJ Dussault
Ranch Hand
Posts: 53
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chris,
Are you setting the GridBagConstraints?
 
Chris Felton
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for response. Yes I had set constraints, and I thought I had solved the problem but not so !
Even on the simplest of design, say 2 Rows,
if I change one to an image, then it disappears. This does NOT happen if I use GridLayout, and it doesn't make any difference if I add the image as a component of the GridBagLayout or of a Panel.
Thanks
[This message has been edited by Chris Felton (edited August 16, 2000).]
 
Chris Felton
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorted !
I looked through some tutorials mentioned on the javaranch site and found one that mentioned that in some layouts, images are resized, and can be invisible, unless their size is set by the method that is doing the drawing !!!
 
paul wheaton
Trailboss
Posts: 22258
Firefox Browser IntelliJ IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm moving this thread to the AWT/Swing forum ...
 
TransZamboni
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try setting the minimum, maximum and preffered sizes before adding the components to the layout. Hope that helps.
 
Pete Bullock
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you ever get that to work, Chris? I'm having the same problem and would LOVE to see working code.
Thanks,
Pete
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!