> Hello Java-GUI-Developers,
>
> did anyone ever try to develop a Java GUI conforming with Sun's "Java
> Look and Feel Design Guidelines"? I receive the impression this is a
> hard job.
GUI development in general is a hard job, often vastly underestimated.
The Sun styleguide does only apply to the Sun PLAF. It is better than
nothing, and not too complex compared to other guides in the field. In
fact, it is too simple in several areas. If the alternatives are to use
Sun's PLAF without any guide, or with Sun's guide, use the guide.
Following it makes things better, although not perfect. If you use a
platform-specific PLAF, follow the styleguide for the particular
platform instead.
> I tried to implement a layout with two radiobuttons with the
> below-mentioned code. Somehow the vertical distance between these two
> radiobuttons is 11 pixels, not 5 like I intended. Even if I set the
> buttons margins to zero,
Don't do this. The distances as described by Sun are additional
distances. If you use GBL, you control them entirely via the Insets.
For non trivial GBL-based layouts you will basically need a
GridBagConstraint with different Insets for each cell in the grid. Your
approach with recycling one GBC might work for your simple example, but
will not scale. The same goes for anchoring, filling, weights, etc. You
will find that many cells need different values.
/Thomas

Signature
The comp.lang.java.gui FAQ:
ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
Dirk Starke - 24 Feb 2005 10:42 GMT
Hello Thomas,
> > did anyone ever try to develop a Java GUI conforming with Sun's "Java
> > Look and Feel Design Guidelines"? I receive the impression this is a
[quoted text clipped - 9 lines]
> platform-specific PLAF, follow the styleguide for the particular
> platform instead.
Perhaps I should explain the background of my question. I've done GUI
development for several years now. It's not my main job, but part of
it. But whenever I dealt with GridBagLayout I found it difficult to
use. And especially when I wanted to construct an expandable container
it was horrible. That brought me to the idea to implement my own
layout manager, and that's what I did. It works now and I want to
publish it. I was in need of some examples, showing the difference
between GridBagLayout and my layout manager. And I wanted those
examples to be conforming with Sun's styleguide.
> > I tried to implement a layout with two radiobuttons with the
> > below-mentioned code. Somehow the vertical distance between these two
[quoted text clipped - 3 lines]
> Don't do this. The distances as described by Sun are additional
> distances. If you use GBL, you control them entirely via the Insets.
I chose the panel shown in figure 29 of the styleguide as an example
(see http://java.sun.com/products/jlf/ed2/book/HIG.Visual2.html) -- it
seems to be a screenshot. The radiobuttons do not look too narrow. The
distance between the two radiobuttons shown is 5 pixels, you can check
it with M$ Paint. It does not appear that additional insets are meant.
The distance between two radiobuttons without insets is 11 pixels
(without taking the white border into account).
I tried to implement the layout of that container, but had my
problems.
Setting the margins of the radiobuttons to zero was an experiment, but
did not assure success. Believe me, that would not be my first
approach.
> For non trivial GBL-based layouts you will basically need a
> GridBagConstraint with different Insets for each cell in the grid. Your
> approach with recycling one GBC might work for your simple example, but
> will not scale. The same goes for anchoring, filling, weights, etc. You
> will find that many cells need different values.
I tried to show the code as it is shown in Sun's tutorial. With the
constraints class of my layout manager it is easy to reuse the
constraints object.
Greetings
Dirk