Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / GUI / December 2006

Tip: Looking for answers? Try searching our database.

Cross-platform development issue with PLAF classes

Thread view: 
qu0ll - 13 Dec 2006 13:54 GMT
I am trying to develop an application to run on both Linux and Windows so I
need to use both the GTK look and feel and the Windows look and feel.
However, it seems that the JRE's rt.jar does not contain the GTK classes on
the Windows platform whereas the Linux platform does include the Windows
classes.  The result is that I cannot fully build the system on the Windows
platform which is my chief development environment.

While it makes sense not to include unsupported classes in the runtime, why
are the Windows classes included on Linux and how do I build my system on
Windows?  I am using Mustang FCS.

Signature

And loving it,

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

Ian Wilson - 13 Dec 2006 14:27 GMT
> I am trying to develop an application to run on both Linux and Windows so I
> need to use both the GTK look and feel and the Windows look and feel.

I assume that you want your app to automatically use the GTK LAF on
Linux and use the Windows LAF on Windows

> However, it seems that the JRE's rt.jar does not contain the GTK classes on
> the Windows platform whereas the Linux platform does include the Windows
[quoted text clipped - 4 lines]
> are the Windows classes included on Linux and how do I build my system on
> Windows?  I am using Mustang FCS.

Doesn't
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
do what you want?
Andrew Thompson - 13 Dec 2006 14:27 GMT
> I am trying to develop an application to run on both Linux and Windows so I
> need to use both the GTK look and feel and the Windows look and feel.

// Set System L&F
 UIManager.setLookAndFeel(
       UIManager.getSystemLookAndFeelClassName());
// builds on Win (and presumably other platforms)
// works for Win/Linux/Unix/Solaris/Mac. OS/...

> While it makes sense not to include unsupported classes in the runtime, why
> are the Windows classes included on Linux

I do not know.

>...and how do I build my system on Windows?

I set the System PLAF on most projects I deploy,
and have never needed direct access to the other
PLAF's.  Why do you?

Andrew T.
Thomas A. Russ - 13 Dec 2006 17:40 GMT
> > I am trying to develop an application to run on both Linux and Windows so I

Well, if you are trying to be cross-platform, why limit yourself to just
Linux and Windows?  What about Solaris?  MacOS?  Other Unix types?

> > need to use both the GTK look and feel and the Windows look and feel.
>
[quoted text clipped - 3 lines]
> // builds on Win (and presumably other platforms)
> // works for Win/Linux/Unix/Solaris/Mac. OS/...

Which is why Andrew's suggestion has much merit.

> >...and how do I build my system on Windows?
>
> I set the System PLAF on most projects I deploy,
> and have never needed direct access to the other
> PLAF's.  Why do you?

Signature

Thomas A. Russ,  USC/Information Sciences Institute

qu0ll - 14 Dec 2006 10:48 GMT
> // Set System L&F
>  UIManager.setLookAndFeel(
>        UIManager.getSystemLookAndFeelClassName());
> // builds on Win (and presumably other platforms)
> // works for Win/Linux/Unix/Solaris/Mac. OS/...

No, it doesn't seem to work in my environment.  On a Fedora Core 6 machine
running KDE 3.5.5 and Mustang FCS it returns Metal as the system look and
feel.  Shouldn't it be GTK?

Signature

And loving it,

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

qu0ll - 13 Dec 2006 14:41 GMT
I have a number of PLAFs that I want to use and I thought I needed to
specify each one by name.  But you are both correct in that I can use the
method to set the system PLAF for both Windows and GTK PLAFs.  Thanks.

Signature

And loving it,

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

Thomas Fritsch - 13 Dec 2006 14:48 GMT
> I am trying to develop an application to run on both Linux and Windows
> so I need to use both the GTK look and feel and the Windows look and feel.
> However, it seems that the JRE's rt.jar does not contain the GTK classes
> on the Windows platform whereas the Linux platform does include the
> Windows classes.  The result is that I cannot fully build the system
> the Windows platform which is my chief development environment.
Why do you need these LookAndFeel classes for building at all?
I guess you have lines like
 UIManager.setLookAndFeel(new GTKLookAndFeel());
 UIManager.setLookAndFeel(new WindowsLookAndFeel());
in your code.
If so, you should replace them by
 UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
 UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
The advantage is that your building then becomes independent of these
LookAndFeel classes.

Signature

Thomas



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.