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

make text areas and textfields streach as window resizes  RSS feed

 
chop ficaro
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i want to make the text fields resize while stopping the lables from resizing, right now theyre both resizing, and this doesnt seem to work
 
chop ficaro
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
getMinimumSize() isnt working either
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
use the appropriate layoutManger/s

often requires nesting panels with different layoutManagers
 
chop ficaro
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
im using the grid layout manager right now
i think i could do it with the label in BorderLayout.EAST and the field in BorderLayout.CENTER, but i have a huge list of labels and fields, and something about creating a new panel for each one just doesn't seem right, thats a lot of copying and pasting for something that should require much less code.
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
who said anything about one panel per component?

e.g.
put all your labels in a JPanel (perhaps GridLayout with only single column)
put all your textfields in a JPanel (again, perhaps GridLayout with only single column)
labelPanel in BorderLayout.EAST
textfieldPanel in BorderLayout.CENTER

now, if the frame is dragged wider/thinner, only the textfields will grow/shrink
 
chop ficaro
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
works and doesn't take up 10 pages of code! ty!
 
Darryl Burke
Bartender
Posts: 5167
11
Java Netbeans IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Cross posted and answered
http://forums.sun.com/thread.jspa?threadID=5438234

edit
http://forums.devshed.com/java-help-9/awt-make-text-areas-and-textfields-streach-as-window-resizes-701595.html
 
Rob Spoor
Sheriff
Posts: 20893
81
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Chop, please BeForthrightWhenCrosspostingToOtherSites.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!