163

I am developing a desktop application with Java Swing for my personal use.I am in need of some beautiful Look and Feel for my application. How can I do it using Java or a 3rd party API?

rajesh
  • 1,773
  • 3
  • 12
  • 6
  • 1
    LGPL'ed look-n-feel Nimrod by Nilo J. González: http://personales.ya.com/nimrod/faq-en.html. A little bit buggy (unable to set background color for a JButton - solved with paintComponent() override using a translucent BufferedImage technique) – ecle Mar 22 '12 at 16:08

4 Answers4

198

There is a lot of possibilities for LaFs :


Resources :

Related topics :

Community
  • 1
  • 1
Colin Hebert
  • 91,525
  • 15
  • 160
  • 151
  • 2
    Quick way to see how your application looks under Nimbus, start the app with the argument ` -Dswing.defaultlaf=javax.swing.plaf.nimbus.NimbusLookAndFeel` e.g. `java -Dswing.defaultlaf=javax.swing.plaf.nimbus.NimbusLookAndFeel -jar MyApp.jar` – nos Oct 17 '10 at 18:36
  • 3
    To use [Metal look and feel](http://docs.oracle.com/javase/7/docs/api/javax/swing/plaf/metal/MetalLookAndFeel.html) in existing apps add `-Dswing.defaultlaf=javax.swing.plaf.metal.MetalLookAndFeel` parameter to java invocation. – maciej Jul 07 '12 at 18:08
  • Which of them are okay on "Retina" displays? (not only on OS X, there are laptops on Win 8 with high DPI screens now, too) – Display Name Jun 03 '14 at 22:15
61

You can try L&F which i am developing - WebLaF
It combines three parts required for successful UI development:

  • Cross-platform re-stylable L&F for Swing applications
  • Large set of extended Swing components
  • Various utilities and managers

Binaries: https://github.com/mgarin/weblaf/releases
Source: https://github.com/mgarin/weblaf
Licenses: GPLv3 and Commercial

A few examples showing how some of WebLaF components look like: Some of WebLaF components

Main reason why i have started with a totally new L&F is that most of existing L&F lack flexibility - you cannot re-style them in most cases (you can only change a few colors and turn on/off some UI elements in best case) and/or there are only inconvenient ways to do that. Its even worse when it comes to custom/3rd party components styling - they doesn't look similar to other components styled by some specific L&F or even totally different - that makes your application look unprofessional and unpleasant.

My goal is to provide a fully customizable L&F with a pack of additional widely-known and useful components (for example: date chooser, tree table, dockable and document panes and lots of other) and additional helpful managers and utilities, which will reduce the amount of code required to quickly integrate WebLaF into your application and help creating awesome UIs using Swing.

Mikle Garin
  • 10,083
  • 37
  • 59
  • Note that before jumping in without looking at the license that the license is gpl. This might or might not be a problem for some. – Tinus Tate Feb 20 '18 at 14:39
  • I think spending a few hundred euro for a commercial license is far better than giving that money to your lawyer for his advice, which is likely going to be "buy a commercial license if you use the product". Besides, their site says you get prioritized technical support when you buy a commercial license. – Jeff Holt Mar 22 '18 at 18:09
4

You can also use JTattoo (http://www.jtattoo.net/), it has a couple of cool themes that can be used.

Just download the jar and import it into your classpath, or add it as a maven dependency:

<dependency>
        <groupId>com.jtattoo</groupId>
        <artifactId>JTattoo</artifactId>
        <version>1.6.11</version>
</dependency>

Here is a list of some of the cool themes they have available:

  • com.jtattoo.plaf.acryl.AcrylLookAndFeel
  • com.jtattoo.plaf.aero.AeroLookAndFeel
  • com.jtattoo.plaf.aluminium.AluminiumLookAndFeel
  • com.jtattoo.plaf.bernstein.BernsteinLookAndFeel
  • com.jtattoo.plaf.fast.FastLookAndFeel
  • com.jtattoo.plaf.graphite.GraphiteLookAndFeel
  • com.jtattoo.plaf.hifi.HiFiLookAndFeel
  • com.jtattoo.plaf.luna.LunaLookAndFeel
  • com.jtattoo.plaf.mcwin.McWinLookAndFeel
  • com.jtattoo.plaf.mint.MintLookAndFeel
  • com.jtattoo.plaf.noire.NoireLookAndFeel
  • com.jtattoo.plaf.smart.SmartLookAndFeel
  • com.jtattoo.plaf.texture.TextureLookAndFeel
  • com.jtattoo.plaf.custom.flx.FLXLookAndFeel

Regards

diegeelvis_SA
  • 453
  • 3
  • 8
1

Heres the code that creates a Dialog which allows the user of your application to change the Look And Feel based on the user's systems. Alternatively, if you can store the wanted Look And Feel's on your application, then they could be "portable", which is the desired result.

   public void changeLookAndFeel() {

        List<String> lookAndFeelsDisplay = new ArrayList<>();
        List<String> lookAndFeelsRealNames = new ArrayList<>();

        for (LookAndFeelInfo each : UIManager.getInstalledLookAndFeels()) {
            lookAndFeelsDisplay.add(each.getName());
            lookAndFeelsRealNames.add(each.getClassName());
        }

        String changeLook = (String) JOptionPane.showInputDialog(this, "Choose Look and Feel Here:", "Select Look and Feel", JOptionPane.QUESTION_MESSAGE, null, lookAndFeelsDisplay.toArray(), null);

        if (changeLook != null) {
            for (int i = 0; i < lookAndFeelsDisplay.size(); i++) {
                if (changeLook.equals(lookAndFeelsDisplay.get(i))) {
                    try {
                        UIManager.setLookAndFeel(lookAndFeelsRealNames.get(i));
                        break;
                    }
                    catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) {
                        err.println(ex);
                        ex.printStackTrace(System.err);
                    }
                }
            }
        }
    }
TheArchon
  • 313
  • 5
  • 15