CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 2 of 2
  1. #1
    Join Date
    Jul 2009

    JTextField setBounds

    ok so i am trying to create a program but when i try set its bounds, i always get a small box each time...
    JTextField ip = new JTextField();
    		JLabel ipAdd = new JLabel("Internet Protocal");
    am i doing something wrong, i have tried many different numbers for the bounds and it just doesn't want to work. What is a good size text area?

  2. #2
    dlorde is offline Elite Member Power Poster
    Join Date
    Aug 1999

    Re: JTextField setBounds

    Quote Originally Posted by Alexz003 View Post
    ... i have tried many different numbers for the bounds and it just doesn't want to work.
    Setting the bounds relocates and resizes the component in the absence of any layout managers. If you are using a layout manager (which you will be unless you explicitly set it null), you'll find that only max, min, and preferred size are respected - otherwise the layout manager couldn't do its job. I would suggest setting the preferred size to the size you want and letting the layout manager handle the positioning. See Laying Out Components Within a Container.

    What is a good size text area?
    That depends what you want to use it for, and the design of your application.

    Thatís whatís cool about working with computers. They donít argue, they remember everything, and they donít drink all your beer...
    Paul Leary
    Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Windows Mobile Development Center

Click Here to Expand Forum to Full Width

On-Demand Webinars (sponsored)

We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.