Jump to content
  • Advertisement
Sign in to follow this  
Radiocreed

Swing help please

This topic is 4909 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

The height of my JTextField is too high and I'm using box layout. The setpreferredsize, setminsize and setmaxsize methods don't work. Here's a pic of my problem. http://www.student.cs.uwaterloo.ca/~thalamya/trouble.JPG Any help please?

Share this post


Link to post
Share on other sites
Advertisement
I don't know this widget, and I don't know java, but it looks like your window is cut in half by the layout, and that the box you're talking about is stretched to that limit.

Perhaps if you try to set a pixel size for the top half of your window layout, the textbox will be smaller in size.

Albert

Share this post


Link to post
Share on other sites
Your layout manager is screwing it up, I think (one reason I find layout managers annoying). If you don't want to try an alternate layout (which would/could definitely fix this), try also messing around with that button on the right. Maybe it has a border size set? A bad "preferred" size? If that button has a huge border around it a box layout manager (going from memory here) would probably behave like this. (I'm a little surprised the button isn't huge too, which is what makes me think about the border.)

If it's not a border for the button causing it and you're stumped, you could always try a GridLayout or GridBagLayout.

This is from the java docs:
Quote:

BoxLayout attempts to arrange components at their preferred widths (for horizontal layout) or heights (for vertical layout). For a horizontal layout, if not all the components are the same height, BoxLayout attempts to make all the components as high as the highest component.


Note the last sentence...so maybe it's your button in the same row causing it?

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!