Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

formatting the GUI

 
Jason Richard
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi All,

I'm creating a GUI to sit on top of some already existing code. I'm doing it by hand, and staying away from the Netbeans auto gen stuff, because quite frankly my experience is they cause more problems then they solve.

Regardless.

In this effort I'm trying to stick with with the basic layout structures (Border/Grid). I'm using GridBag in very SMALL Areas because quite frankly I can't seem to get things to go how/where I want them on any sort of bigger panel.

I'm having a hard time getting things (most notably JTextFields) to be the size i want them to be. What I have been doing to adjust for this is creating blank panels and inserting them as needed to shrink things down. For example I might want four JTextlabels and four TTextFields in the upper left quadrant of a panel, so I'll add those items to it's own panel using a Grid Layout (2,2) and add that panel to another grid layout on another panel (2,2) I would then add 3 blank panels as either placeholders for things in the future, or simply for the blank space.

Is this a bad/unacceptable practice? IS there something better I should be doing?

 
Randall Twede
Ranch Hand
Posts: 4371
3
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
bad/ unacceptable? not as far as i know. there are many other features of swing some others might help you with. you can use horizontal glue for instance to space something over to the other side with blank in the middle. you can also set the preferred size of components to make them smaller for instance.
 
Jason Richard
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It would seem that Box Layout is going to be helpful as well. Oh why did I ignore thee to start??
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic