Search in sources :

Example 1 with LookAndFeelInfo

use of javax.swing.UIManager.LookAndFeelInfo in project pcgen by PCGen.

the class LookAndFeelManager method initLookAndFeel.

//
//	public static LookAndFeelManager getInstance()
//	{
//		if (instance == null)
//		{
//			instance = new LookAndFeelManager();
//		}
//		return instance;
//	}
/**
	 * Initialise the look and feel to be used for this session. The look and 
	 * feel used will be the one saved in the preferences, or if none is 
	 * selected, nimbus will be used if present and the screen is a decent 
	 * size, otherwise Java will be used. Nimbus doesn't work so well on small 
	 * screens, hence the test for screen size.
	 */
public static void initLookAndFeel() {
    //set Java as the fallback look and feel
    currentLAF = "Java";
    Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
    LookAndFeelInfo nimbus = getNimbusLaf();
    if (screenSize.height > 800 && nimbus != null) {
        currentLAF = nimbus.getName();
    }
    String laf = ConfigurationSettings.initSystemProperty("lookAndFeel", currentLAF);
    selectedTheme = ConfigurationSettings.getSystemProperty("selectedThemePack");
    setLookAndFeel(laf);
}
Also used : LookAndFeelInfo(javax.swing.UIManager.LookAndFeelInfo) Dimension(java.awt.Dimension)

Example 2 with LookAndFeelInfo

use of javax.swing.UIManager.LookAndFeelInfo in project jdk8u_jdk by JetBrains.

the class bug8033069NoScrollBar method iterateLookAndFeels.

protected static void iterateLookAndFeels(final bug8033069NoScrollBar test) throws Exception {
    LookAndFeelInfo[] lafInfo = UIManager.getInstalledLookAndFeels();
    for (LookAndFeelInfo info : lafInfo) {
        try {
            UIManager.setLookAndFeel(info.getClassName());
            System.out.println("Look and Feel: " + info.getClassName());
            test.runTest();
        } catch (UnsupportedLookAndFeelException e) {
            System.out.println("Skipping unsupported LaF: " + info);
        }
    }
}
Also used : LookAndFeelInfo(javax.swing.UIManager.LookAndFeelInfo) UnsupportedLookAndFeelException(javax.swing.UnsupportedLookAndFeelException)

Example 3 with LookAndFeelInfo

use of javax.swing.UIManager.LookAndFeelInfo in project jdk8u_jdk by JetBrains.

the class UITest method main.

public static void main(String[] args) {
    OSType os = OSInfo.getOSType();
    LookAndFeelInfo[] lafInfo = UIManager.getInstalledLookAndFeels();
    switch(os) {
        case WINDOWS:
            // Make sure we don't have GTK.
            if (hasLAF("gtk", lafInfo)) {
                throw new RuntimeException("On windows, but GTK is present");
            }
            // Make sure we don't have Aqua.
            if (hasLAF("mac", lafInfo)) {
                throw new RuntimeException("On windows, but Aqua is present");
            }
            // Make sure we have Windows.
            if (!hasLAF("windows", lafInfo)) {
                throw new RuntimeException("On windows and don't have Windows");
            }
            break;
        case MACOSX:
            // Make sure we don't have GTK.
            if (hasLAF("gtk", lafInfo)) {
                throw new RuntimeException("On mac, but GTK is present");
            }
            // Make sure we don't have Windows.
            if (hasLAF("windows", lafInfo)) {
                throw new RuntimeException("On mac, but Windows is present");
            }
            // Make sure we have Aqua.
            if (!hasLAF("mac", lafInfo)) {
                throw new RuntimeException("On mac and don't have Aqua");
            }
            break;
        default:
            // Make sure we don't have Windows.
            if (hasLAF("windows", lafInfo)) {
                throw new RuntimeException("Not on windows and have Windows");
            }
            // Make sure we don't have Aqua.
            if (hasLAF("mac", lafInfo)) {
                throw new RuntimeException("Not on mac and have Aqua");
            }
            // Make sure we have GTK.
            if (!hasLAF("gtk", lafInfo)) {
                throw new RuntimeException("Not on Windows and Mac and don't have GTK!");
            }
    }
}
Also used : LookAndFeelInfo(javax.swing.UIManager.LookAndFeelInfo) OSType(sun.awt.OSInfo.OSType)

Example 4 with LookAndFeelInfo

use of javax.swing.UIManager.LookAndFeelInfo in project jdk8u_jdk by JetBrains.

the class DimensionEncapsulation method main.

public static void main(final String[] args) throws Exception {
    for (final LookAndFeelInfo laf : getInstalledLookAndFeels()) {
        SwingUtilities.invokeAndWait(() -> setLookAndFeel(laf));
        SwingUtilities.invokeAndWait(new DimensionEncapsulation());
    }
}
Also used : LookAndFeelInfo(javax.swing.UIManager.LookAndFeelInfo)

Example 5 with LookAndFeelInfo

use of javax.swing.UIManager.LookAndFeelInfo in project jdk8u_jdk by JetBrains.

the class bug8080628 method runTest.

private static void runTest() {
    try {
        LookAndFeelInfo[] lafInfo = UIManager.getInstalledLookAndFeels();
        for (LookAndFeelInfo info : lafInfo) {
            UIManager.setLookAndFeel(info.getClassName());
            for (Locale locale : LOCALES) {
                for (String key : MNEMONIC_KEYS) {
                    int mnemonic = SwingUtilities2.getUIDefaultsInt(key, locale);
                    if (mnemonic != 0) {
                        throw new RuntimeException("No mnemonic expected (" + mnemonic + ") " + "for '" + key + "' " + "in locale '" + locale + "' " + "in Look-and-Feel '" + UIManager.getLookAndFeel().getClass().getName() + "'");
                    }
                }
            }
        }
        System.out.println("Test passed");
    } catch (Exception e) {
        exception = e;
    }
}
Also used : Locale(java.util.Locale) LookAndFeelInfo(javax.swing.UIManager.LookAndFeelInfo)

Aggregations

LookAndFeelInfo (javax.swing.UIManager.LookAndFeelInfo)41 IOException (java.io.IOException)7 JPanel (javax.swing.JPanel)6 UnsupportedLookAndFeelException (javax.swing.UnsupportedLookAndFeelException)6 Dimension (java.awt.Dimension)5 JFrame (javax.swing.JFrame)5 JLabel (javax.swing.JLabel)4 BorderLayout (java.awt.BorderLayout)3 File (java.io.File)3 JFileChooser (javax.swing.JFileChooser)3 Color (java.awt.Color)2 FlowLayout (java.awt.FlowLayout)2 GridLayout (java.awt.GridLayout)2 JButton (javax.swing.JButton)2 JTextField (javax.swing.JTextField)2 PropertiesPreferences (com.igormaznitsa.mindmap.swing.panel.utils.PropertiesPreferences)1 MessagesService (com.igormaznitsa.sciareto.notifications.MessagesService)1 PrinterPlugin (com.igormaznitsa.sciareto.plugins.services.PrinterPlugin)1 MainFrame (com.igormaznitsa.sciareto.ui.MainFrame)1 SplashScreen (com.igormaznitsa.sciareto.ui.UiUtils.SplashScreen)1