Just what I was looking for. I was unsure at first because everything
online discourages it (including Sun) but I tried it out late last
night and ended up playing around with it a bit today too. Thanks for
the reply.
[post re-ordered]
>> >Is there really no layout that allows you to position a component using
>> >(X,Y) coordinates instead of "directions" like north and center
[quoted text clipped - 3 lines]
> 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
andrewthommo@gmail.com - 29 Jun 2006 17:54 GMT
> [post re-ordered]
>
[quoted text clipped - 7 lines]
>
> The reason LayoutManagers are encouraged
<snip excellent reasons>
Another tack is that once you have the 'logic' of your
layout manager, it takes but a few lines of code to
incorporate it in an 'XYLayout' manager.
Further, I'm not sure if this has been mentioned yet,
but JFreeChart may be a better way to achieve the
overall effect the OP is after.
Andrew T.