The Source for Java Technology Collaboration

Home » java.net Forums » Java Desktop Technologies » Swing & AWT

Thread: System PLAF not GTK under Linux?

Welcome, Guest Help
Login Login
Guest Settings Guest Settings
Reply to this Thread Reply to this Thread Search Forum Search Forum Back to Thread List Back to Thread List

Permlink Replies: 11 - Last Post: Dec 26, 2006 6:02 AM by: stayer
qu0ll

Posts: 306
System PLAF not GTK under Linux?
Posted: Dec 18, 2006 5:25 AM
  Click to reply to this thread Reply

I would have thought that the system PLAF for Linux environments would be GTK but on my Fedora Core 6 machine running KDE 3.5.5 and Java 6.0 FCS this UIManager.getSystemLookAndFeelClassName() returns MetalLookAndFeel.

Is this correct? Why is it Metal instead of GTK?

--
And loving it,

qu0ll
______________________________________________
qu0llSixFour@gmail.com
(Replace the "SixFour" with numbers to email)

stayer

Posts: 12
Re: System PLAF not GTK under Linux?
Posted: Dec 18, 2006 5:51 AM   in response to: qu0ll
  Click to reply to this thread Reply

It depends on whether native GTK L&F is available on your machine.

Run this simple test
[CODE]
import java.awt.Toolkit;
import sun.awt.UNIXToolkit;

public class CheckGTK
{
public static void main(String[] args)
{
Toolkit toolkit = Toolkit.getDefaultToolkit();

if(toolkit instanceof UNIXToolkit)
System.out.println( "Is Native GTK = " + ((UNIXToolkit)toolkit).checkGTK());
}
}

[/CODE]

qu0ll

Posts: 306
Re: System PLAF not GTK under Linux?
Posted: Dec 18, 2006 5:59 AM   in response to: stayer
  Click to reply to this thread Reply

That program returns true. Does that mean GTK should be the system PLAF on my machine?

--
And loving it,

qu0ll
______________________________________________
qu0llSixFour@gmail.com
(Replace the "SixFour" with numbers to email)

stayer

Posts: 12
Re: System PLAF not GTK under Linux?
Posted: Dec 18, 2006 7:04 AM   in response to: qu0ll
  Click to reply to this thread Reply

No. It just means that your system supports native GTK L&F.
But why UIManager.getSystemLookAndFeelClassName() returns MetalLookAndFee is another topic of investigation.
I should look into it a bit closer.

Scott Violet
Re: System PLAF not GTK under Linux?
Posted: Dec 18, 2006 10:19 AM   in response to: qu0ll
  Click to reply to this thread Reply

As you have found, we only return GTK as the system look and feel if
you're running under GNOME. There's an environment variable we look for
that controls this.

-Scott

swing@javadesktop.org wrote:
> I would have thought that the system PLAF for Linux environments would be GTK but on my Fedora Core 6 machine running KDE 3.5.5 and Java 6.0 FCS this UIManager.getSystemLookAndFeelClassName() returns MetalLookAndFeel.
>
> Is this correct? Why is it Metal instead of GTK?
>


qu0ll

Posts: 306
Re: System PLAF not GTK under Linux?
Posted: Dec 18, 2006 8:17 PM   in response to: Scott Violet
  Click to reply to this thread Reply

Scott, why is this so? The GTK PLAF seems to pick up the KDE look and feel and system colours correctly. It seems more logical to have it as the system PLAF.

--
And loving it,

qu0ll
______________________________________________
qu0llSixFour@gmail.com
(Replace the "SixFour" with numbers to email)

qu0ll

Posts: 306
Re: System PLAF not GTK under Linux?
Posted: Dec 21, 2006 5:19 AM   in response to: qu0ll
  Click to reply to this thread Reply

Scott, I received an email to say that you had replied to this thread but before I got a chance to read it the server seems to have had a bit of a hiccup and it's gone missing.

Could you please post that reply again?

--
And loving it,

qu0ll
______________________________________________
qu0llSixFour@gmail.com
(Replace the "SixFour" with numbers to email)

Scott Violet
Re: System PLAF not GTK under Linux?
Posted: Dec 21, 2006 10:39 AM   in response to: qu0ll
  Click to reply to this thread Reply

swing@javadesktop.org wrote:
> Scott, I received an email to say that you had replied to this thread
> but before I got a chance to read it the server seems to have had a bit
> of a hiccup and it's gone missing.
>
> Could you please post that reply again?
>

Sure thing. Here's my post again:


Some systems may ship GTK and KDE side by side, and tune the themes of
each toolkit so they look similar, but not all. Additionally we have no
way of detecting if GTK and KDE would look similar. As such, if you're
not running under a GNOME desktop, we don't make GTK the system look and
feel.

-Scott


theuserbl

Posts: 38
Re: System PLAF not GTK under Linux?
Posted: Dec 22, 2006 6:55 AM   in response to: qu0ll
  Click to reply to this thread Reply

I think, MetalLAF is still the SystelLF on Linux, because the GtkLAF is not mature enough to use it for all programs, which wants the Native-LAF and where the programmers have never tested it with the GtkLAF.
It is possible, that with the GtkLAF some things don´t work.

If you have a program which use System PLAF, then start it with

java -Dswing.systemlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel -jar program.jar

if you want to run it with the GTK-LAF.

alexfromsun

Posts: 404
Re: System PLAF not GTK under Linux?
Posted: Dec 22, 2006 7:03 AM   in response to: theuserbl
  Click to reply to this thread Reply

Hello theuserbl

Are you talking about JDK 6.0 GTK LaF ?

>It is possible, that with the GtkLAF some things don´t work.

What do you mean by that ?
Could you please be more specific

Thanks
alexp

linuxhippy

Posts: 646
Re: System PLAF not GTK under Linux?
Posted: Dec 23, 2006 7:34 AM   in response to: alexfromsun
  Click to reply to this thread Reply

I also think thet the new (6.0) GTK-Laf isn't ready for prime time.
Not because of an incomplete implementation or stability issues just because its that slow.

When running larger Swing-Apps with GTK-Laf theres a visible difference in performance and running the MigLayout-Swing-Benchmark (using the server-compiler) 350ms for metal/steel vs. ~4000ms for GTK-Laf per run.
An oprofile run showed that a lot of time is spent inside of GTK's libraries, so I even can't blame SUN for this. They did it as well as the underlaying system allowed.

lg Clemens

stayer

Posts: 12
Re: System PLAF not GTK under Linux?
Posted: Dec 26, 2006 6:02 AM   in response to: theuserbl
  Click to reply to this thread Reply

You can also use another flag:
-Dswing.defaultlaf=com.sun.java.swing.plaf.gtk.GTKLookAndFeel
And your programs will use GTK L&F without setting any specific L&F in the code. Java will pick up this system setting and set the L&F to GTK L&F.




 XML java.net RSS