aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes how to display textfield in a gridbaglayout Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "how to display textfield in a gridbaglayout" Watch "how to display textfield in a gridbaglayout" New topic
Author

how to display textfield in a gridbaglayout

Josh Raj
Greenhorn

Joined: Feb 04, 2008
Posts: 7
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

Joined: Oct 13, 2005
Posts: 39436
    
  28
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

    Joined: Jan 14, 2004
    Posts: 1535
     
     
    subject: how to display textfield in a gridbaglayout