Which are Open source lafs[look n feel] for java swing application?
Substance LAF from Kirill Grouchnikov is the best I know.
Here is a great answer on another question: Java Look & Feel
Edit:
Don't forget the system look and feel:
try
{
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
} catch (Exception e) {}
Don't forget
Seaglass : a LAF inspired by the OSX theme and, well, you knew it, seaglass (beautiful!)
Nimbus : The standard Java L&F for Java 6
Related
I want to run my application in different platform and i want to use different look and feel for each platform. could you please guide how can approach this?
This is what i did.
in main java class i added static block and by adding below condition.
if(System.getProperty("os.name").startsWith("Windows")) //Added for linux
{
UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
}
else
{
UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
}
When I run my application in linux platform, it is not showing metal look and feel rather it's showing java default look and feel mainly in JOptionPane.
Perhaps your answer is available here: http://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
Or read into this SO question:
How to set jframe look and feel
Use the System Look And Feel.
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
I have a swing application. Below is a small screenshot.
OS: Win 7
What is irritating is the theme. I have tried several other screens but they all have such appearance. Eclipse and Netbeans for example have a much better UI. The FileChooser and Frame is general is much pleasing. How do I have such a theme.
Thanks.
Change the look and feel to the Windows one before creating anything UI-related in your program:
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
Looks like you are using the Metal Look and Feel. Try using some other look and feel that might interest you.
Refer http://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html, for more information.
This will give you everything you want to know
http://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
UIManager.getSystemLookAndFeelClassName() will give you the most appropriate for the OS it's running on
there is many look and feels packages like :
1)JTattoo
2)BlueLight
3)joxy
4)Nimrod
5)Oyoaha
6)TinyLaf
....etc
you have to read about previous types
The default Look & Feel of Swing is not good looking for Linux platforms, The target Platforms are Windows and Linux, Can someone suggest are there any library which gives better look and feel similar to components appearing on windows platforms for Linux systems?
For windows, I am using system look and feel, this looks much better than in Linux. Also like to know how to load different look and feel depending on the platform.
You'll need to read the 'howto' for setting the look and feel. Oracle has one here: http://docs.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
To use GTK, you would use:
try
{
UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
}
catch (ClassNotFoundException e)
{
}
catch (UnsupportedLookAndFeelException e)
{
}
I'm trying to change LAF of my program in this way:
try {
UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
} catch (Exception ex) {
Logger.getLogger(MainWin.class.getName()).log(Level.SEVERE, null, ex);
}
But this doesn't affect and program still looks as METAL while this reports "com.sun.java.swing.plaf.gtk.GTKLookAndFeel" that means it must be changed:
UIManager.getLookAndFeel().getClass().getName();
Changing to other LAFs has the same problem!
What's the problem?
Thanks
Do you set look and feel before you create your GUI? Because if your GUI is already created (even if not shown), you have to tell Swing that LAF was updated:
SwingUtilities.updateComponentTreeUI(frame);
GTKLookAndFeel only gets applied if the operating system is Linux.
Using GTKLookAndFeel for a application running on Windows does not change the Look and Feel.
It will still display the Metal Look and Feel.
Note: The GTK+ L&F will only run on UNIX or Linux systems with GTK+
2.2 or later installed, while the Windows L&F runs only on Windows
systems. Like the Java (Metal) L&F, the Motif L&F will run on any
platform.
More info on Modifying the Look and Feel
I use UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); to set a LAF and it works fine. But this time I also implemented a tray and it looks ugly - like Motif. How can I set LAF for the tray?
The class you're probably using for this is java.awt.SystemTray.
The tray uses AWT, not Swing. You cant set the look and feel of it.
I think there is a duplicate of this somewhere on here.