• Post Reply Bookmark Topic Watch Topic
  • New Topic

resizing without using gridbaglayout

 
Chris Dancy
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hey guys we've been using gridbaglayout in class now for quite sometime now, and everyone including the professor thinks its overly complicated. I have now one question. When using gridbaglayout its possible to set the variables to let specific panels stretch horizontally and vertically. Is it possible to do this without using gridbagLayout. My professor sais it is, but that its more complicated? someone please tell me he's wrong? and if so, how would i go about doing so?
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
just a matter of putting the components into nested JPanels - each panel a
different layoutManager
e.g a label next to a textField
set the panel as a BorderLayout
put the label in WEST
put the textfield in CENTER
now, when the frame/panel is stretched wider, the label will remain the same,
while the textfield stretches

its only complicated if you don't know how - just like a gridbaglayout

more info
http://java.sun.com/docs/books/tutorial/uiswing/layout/visual.html
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!