Re: Best Layout?
[post re-ordered]
<bcr07548@creighton.edu> wrote in message
news:1151445779.571471.127340@u72g2000cwu.googlegroups.com...
Is there really no layout that allows you to position a component using
(X,Y) coordinates instead of "directions" like north and center
You are not compelled to use any layout manager. See
<http://java.sun.com/docs/books/tutorial/uiswing/layout/none.html>
Just what I was looking for. I was unsure at first because everything
online discourages it (including Sun)
The reason LayoutManagers are encouraged is that the layout of the GUI
widgets in most applications are similar to most other applications. In
North American locales, you typically have the menu at the top, labels to
the left of the text fields that they're describing, and both layouts and
text fields are wider than they are tall, etc. There's sort of an "expected
look" for these widgets to have.
The reason manual laying-out is discouraged is that most developers
don't have enough experience with cross-platform and cross-locale GUI
design. In some locales, the reading-orientation is right-to-left instead of
left-to-right, and so the labels should appear to the right of the text
fields that they are describing. Perhaps in other locales, text is read
vertically, and so labels should be taller than they are wide, etc. On OSX,
the buttons have rounded corners, and thus the buttons have to be wider
(have more padding) so that the text would fit on them, compared to WinXP.
By using a LayoutManager, you can ensure that your GUI "looks right"
across all of these locales and platforms. If you do it manually, you'll
have to implement the checks for different locales and operating systems
yourself.
In your case, there is no "expected look" for your widget. You want the
user to be able to click and drag the widgets around manually. So a layout
manager would only be getting in the way.
- Oliver