Java Look and Feel (L&F) [closed]
Asked Answered
K

4

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?

Kell answered 17/10, 2010 at 18:26 Comment(1)
LGPL'ed look-n-feel Nimrod by Nilo J. González: 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)Addiel
N
198

There is a lot of possibilities for LaFs :


Resources :

Related topics :

Nestle answered 17/10, 2010 at 18:31 Comment(3)
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.jarBathsheb
To use Metal look and feel in existing apps add -Dswing.defaultlaf=javax.swing.plaf.metal.MetalLookAndFeel parameter to java invocation.Viscoid
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)Shopwindow
C
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.

Chemist answered 22/3, 2012 at 16:1 Comment(2)
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.Repute
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.Rufe
E
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

Electromagnet answered 14/4, 2015 at 10:16 Comment(0)
C
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);
                    }
                }
            }
        }
    }
Campanile answered 18/7, 2015 at 15:42 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.