PDA

View Full Version : Java Swing L&F on Gnome



InfoRital
October 8th, 2005, 10:55 PM
Hello,
I've installed Ubuntu Breezy and Java 1.5.
I've got two questions :
1)I've a big problem : Swing apps doesn't look like normal Swing apps (with the Ocean default look&feel) when i'm on Gnome. They get a GTK (not GTK++) like look&feel and that's quite horrible !
When I'm on KDE, they look like normal.

2)How can i desinstall GCJ/GIJ ? When i try to desinstall GIJ, Synaptic said me that openoffice2 and ubuntu-desktop !! must be removed...

Thanks for your answers and sorry for my english, i'm french.

fjleal
October 8th, 2005, 11:38 PM
Swing apps doesn't look like normal Swing apps (with the Ocean default look&feel) when i'm on Gnome. They get a GTK (not GTK++) like look&feel and that's quite horrible !
To user the default L&F:

UIManager.setLookAndFeel(UIManager.getCrossPlatfor mLookAndFeelClassName());
To use the system L&F:

UIManager.setLookAndFeel(UIManager.getSystemLookAn dFeelClassName());

InfoRital
October 9th, 2005, 12:11 AM
Thanks but i know that. The problem isn't in my applications (i don't develop Swing applications) but in applications that i haven't the source code and which are not mine.
For example, when i launch "javaws", it looks like that
http://213.251.134.220/~linuxproje/javaws.jpg

fjleal
October 9th, 2005, 09:58 AM
javaws is using the system default L&F, and Sun hasn't come up with a decent GTK look & feel yet, so it's using the "old" GTK widgets design. It's disgusting, you're right! And because the software isn't free, you can't change that behaviour. :(

But that's specific to that application. Other Swing apps. (hopefully) won't follow that regrettable design decision, and won't be bind to a particular L&F. Look for command-line options that may allow you to change the L&F - try executing "<app.> --help" on the CLI to see if there's such an option. On certaing Swing apps. (like the Netbeans IDE) you can pass a parameter to the application to choose the L&F.

;)

InfoRital
October 9th, 2005, 10:59 AM
Thanks for your reply.

Yes some applications follow that design decision and some others don't.
I've found that you can set the defaut L&F for all Java applications. You must make a swing.properties file in the lib/ directory of your jre. And you can set the default l&f in this file.