• Post Reply Bookmark Topic Watch Topic
  • New Topic

Text location is messed up on some computers

 
Tyler Hanson
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I'm having a little bit of trouble with text locations on components for some computers. When I run the application on my computer (and on most computers) the text looks fine, but when it is run on some others, it is set so the bottom "line" is midway through the component. See attachments for examples.

I'm not sure how to fix this. I'm completely baffled. I used Netbeans to build the application and used it's gui designer for the design. Any help would be much appreciated. The image only shows buttons and texfields, but checkboxes are also messed up (bottom of text is at midpoint of checkbox).

Also, some text fields show up as a different size than what they should be (it isn't uniform, a random textbox will be longer than the one above it.

Thanks

Edit:
Also affected, JMenus and JMenuItems are about double the height they need to be.
login screen.JPG
[Thumbnail for login screen.JPG]
shows what is happening with login screen
 
Rob Spoor
Sheriff
Posts: 20820
68
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It looks lite NetBeans uses absolute positions and sizes, and that's just about always a bad idea. The preferred button sizes are simply different on both machines, and a proper use of layout managers would have resized and repositioned your controls, and made the entire Window a bit better.

This is also why a lot of people (including me) discourage using a GUI builder. It creates code for you that you do not understand as a beginner in Swing, and if problems arise (like now) it is quite hard to solve them. Try using the link I provided (and the rest of the Swing tutorial) to create that screen using only a text editor (or at least without the GUI builder).
 
Tyler Hanson
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hi Rob,

Thanks for your info. I actually didn't write the gui as I inherited this application. It isn't that I am unfamiliar with building my own gui, I was just hoping that there would be a quick fix for now. I do plan on redoing the whole layout (there are other bad practices as well) as time allows. Right now it uses NetBeans "Free Design" layout manager (which I have never been happy with). I'll probably switch them to GridBagLayouts when I can finally get around to it.

Thanks again
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!