Win a copy of Five Lines of Code this week in the OO, Patterns, UML and Refactoring forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

GridBagLayout and Canvases

 
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 ?
 
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 !!!
 
Trailboss
Posts: 23210
IntelliJ IDE Firefox Browser Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm moving this thread to the AWT/Swing forum ...
 
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.
 
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
 
    Bookmark Topic Watch Topic
  • New Topic