In Java 6, though, the GTK LAF has made the leap. There are lots of bugs still, but for the first time it's looking like a solveable problem.
I've got a big list of bugs, and I keep meaning to file them on the bug parade, but some of them are so blindingly obvious that I've been wondering what I can do to help fix the deeper problem. My answer is a Java imitation of Richard Stellingwerff's The Widget Factory. Here's a picture of the GTK+ original running on my Ubuntu 5.10 box:
And here's a picture of my JavaWidgetFactory running under Java 6 b81 on the same machine:
I won't show you Java 5. It's too sad.
I've committed JavaWidgetFactory to salma-hayek. There are a few limitations in my translation. Vertical JSeparators don't appear to work, so I haven't used them. Swing's progress bars and sliders don't let you configure them the wrong way round, so they don't appear in pairs in the Java version. I haven't tied the models because I couldn't be bothered. I didn't try to implement the titled borders because I don't think they're part of the LAF. I didn't get round to adding the menu or the toolbar. I didn't bother imitating the non-default column widths or getting any of the layout particularly close because it didn't seem to make much difference for the purpose I had in mind.
I also duplicated the flaw in the original that means the table is empty, so you can't see what rendered rows look like (Java really screws this up as up to and including Java 6 b81). Given the likely use of JavaWidgetFactory, I should probably have automatically opened a FatBits window, rather than expecting the user to run it themselves.
If you look closely at the pictures, you'll notice a number of bugs:
- All four corners of the editable combo box are wrong. The left corners should be rounded rather than "snapped", and the right corners should join into the button (which shouldn't be rounded on its left edge).
- The focus ring on the editable text components is wrong, but you can't see that from the screenshots.
- The spinner's buttons are too narrow, and the right edge of the text area should be flush with the left edge of the button area. (The button area's edge is correct, so it looks like they're working on this.) [Fixed in 1.6.0-b82.]
- The enabled toggle button's rollover color is wrong (it should be a solid color rather than the standard button rollover gradient), but you can't see that from the screenshots.
- All disabled text components/subcomponents have the wrong border and background.
- The non-editable combo box is completely wrong. The wrong icon is used, there should be just a subtle groove between the text and the icon, and the whole thing should be rendered in a button-like style.
- The preferred size of JProgressBar doesn't match its native equivalent.
- JSlider doesn't render the two sides of the slider in different colors like its native equivalent.
- JSlider always has a text label, unlike its native equivalent.
- JTable's header is rendered incorrectly, seemingly using the button renderer.
- JTable's rows are rendered incorrectly, but you can't see that from the screenshots.
- JScrollPane doesn't contain a table in the GTK way; the scrollbar should fill the top right corner.
- JScrollPane doesn't seem to render unneeded scrollbars correctly, though GNOME seems to prescribe as-needed behavior, so this is perhaps an application error rather than a LAF problem.
- JTabbedPane's tabs are slightly wrong. There's a single-pixel glitch at the start of each row of tabs, there are two dark gray lines between tabs rather than one, there are white lines on edges that shouldn't have them (at most one edge on a tab should have a white line; Java has one or two too many, depending on orientation).
There are a variety of problems with the various Swing dialogs, too, but they're outside the scope of this test. (The color chooser is really close, and only really spoiled by its buttons.)
Although the list above might seem very long, only three are really glaring even to the casual observer. The disabled text components/subcomponents having the wrong border and background, the JTable header renderer, and the non-editable JComboBox are the big three, I reckon, though obviously that depends on your particular program. FatBits, for example, doesn't use disabled text components, tables, or non-editable combo boxes, but it does use JSlider, so it's only affected by the JSlider problems.
Anyway, I hope that JavaWidgetFactory will be useful to people working on the GTK LAF, and maybe to people writing their own LAFs (the original GTK+ version was meant to help people writing GTK+ themes).
I've submitted Sun bug 6417110 for all the bugs mentioned above, and the other bugs I'd been meaning to report, and the dialog bugs too.