Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to display textfield in a gridbaglayout

 
Josh Raj
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi all,
Using a gridbag layout & constaints i want to place a small textfield and a button near to it.when the applet window is maximized the textfield will expand upto 40-50% of the window but the button will be of same size and near to the textfield without much change.I tried a lot but the text button when maximized is moving awat frm the textfield.Help Me.
 
Campbell Ritchie
Sheriff
Posts: 48910
58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Welcome to the Ranch.

Go and find Cay Horstmann's GBC class, read the link about "strike fear" and study the class. This makes GridBag much easier to use.
Difficult to tell what is going on without seeing code, but make sure
  • You set a big "x weight" on the Component you want to change size.
  • You set a 0 weight on the Component you want to stay the same size.
  • You set anchors on the components
  • You set a fill (probably HORIZONTAL) on the text field.
  •  
    Craig Wood
    Ranch Hand
    Pie
    Posts: 1535
    • Mark post as helpful
    • send pies
    • Quote
    • Report post to moderator
     
    • Post Reply
    • Bookmark Topic Watch Topic
    • New Topic