• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

make text areas and textfields streach as window resizes

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
getMinimumSize() isnt working either
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
works and doesn't take up 10 pages of code! ty!
 
Bartender
Posts: 5167
11
Netbeans IDE Opera Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Sheriff
Posts: 22783
131
Eclipse IDE Spring VI Editor Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Chop, please BeForthrightWhenCrosspostingToOtherSites.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic