Skip to main content

L&F improvements: native fidelity with native controls

3 replies [Last post]
Joined: 2003-06-10

I absolutely love the API for Swing. I've been working with GUIs for more than a decade and find the Swing API to be the most intuitive thus far. That said, the fidelity of the L&F has always been lacking.

In Tiger, the "look" has actually gotten closer to native Windows fidelity. It still isn't perfect though, although it is debatable if the remaining 20% of problems (ie drop shadows for menus) is worth the 80% of the time. GTK is a harder target to hit since it is moving every 6 months. The current Swing GTK file selection dialog doesn't look anything like that in GTK 2.8 for instance (and even 2.6 is a stretch).

The "feel" is hard to pin down, but I'll define it as how users expect the UI to behave as they use it (ie a button action isn't executed unless the mouse is still over the button while it is released). This lags in Swing, not because these things aren't possible, but because they take a lot of work investigating. What are the deficiencies? I'm thinking of watching Windows users try to copy-n-paste by right clicking in a text field. Or watching them scroll by right clicking on a scroll bar. Or watching them use some seemingly improbable, but native key sequence to operate on the GUI.

So this long buildup boils down to this question: Can Swing take a page from SWT's book and use native widgets? That seems like it'd give everyone best of both worlds.

Message was edited by: jtr

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2004-10-07

I agree with the critical importance of a quality native widget library in J2SE.

Here's my opinion on how it should be done:
1. start with SWT from the Eclipse project, it is a mature and well designed library;
2. provide an SWT implementation that uses Swing, so that SWT can run in pure-Java mode if desired; there is an project working on this;
3. provide a Swing L&F that uses SWT, there is also a project towards this;
4. deprecate AWT and have SWT replace it.

Please consider this enhancement for Mustang. The other benefit from blessing SWT into J2SE would be a more integrated future for Netbeans and Eclipse.... ;-)

Joined: 2004-05-26

Your comment about right-clicking on the scroll bar had me mystified until I played around and discovered that this is something only some native applications support.

Swing allows you to create popup menus with copy/paste options. I haven't tried popup menus on scrollbars, but I'm sure that's possible in Swing, too. Keyboard shortcuts are all customizable in Swing.

If you want to argue that it's harder to get those things right in Swing than is necessary, or that Swing should do them all for you by default, then you have a case. But, they [i]are[/i] possible. :-)

Joined: 2003-06-10

> right-clicking on the scroll bar

Yeah, it's not even there in firefox.

> they are possible

Of course! But as you mention, the point is that Swing should get this right by default. Otherwise most Swing apps won't have them.

I can't blame the Swing team. Keeping up with changing L&Fs is a Sisyphean task.