Search in sources :

Example 6 with MetalLookAndFeel

use of javax.swing.plaf.metal.MetalLookAndFeel in project jdk8u_jdk by JetBrains.

the class Metalworks method main.

public static void main(String[] args) {
    UIManager.put("swing.boldMetal", Boolean.FALSE);
    JDialog.setDefaultLookAndFeelDecorated(true);
    JFrame.setDefaultLookAndFeelDecorated(true);
    Toolkit.getDefaultToolkit().setDynamicLayout(true);
    System.setProperty("sun.awt.noerasebackground", "true");
    try {
        UIManager.setLookAndFeel(new MetalLookAndFeel());
    } catch (UnsupportedLookAndFeelException e) {
        System.out.println("Metal Look & Feel not supported on this platform. \n" + "Program Terminated");
        System.exit(0);
    }
    JFrame frame = new MetalworksFrame();
    frame.setVisible(true);
}
Also used : UnsupportedLookAndFeelException(javax.swing.UnsupportedLookAndFeelException) JFrame(javax.swing.JFrame) MetalLookAndFeel(javax.swing.plaf.metal.MetalLookAndFeel)

Example 7 with MetalLookAndFeel

use of javax.swing.plaf.metal.MetalLookAndFeel in project jdk8u_jdk by JetBrains.

the class bug7170310 method main.

public static void main(String[] args) throws Exception {
    try {
        UIManager.setLookAndFeel(new MetalLookAndFeel());
        SwingUtilities.invokeAndWait(bug7170310::createAndShowUI);
        SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
        toolkit.realSync();
        for (int i = 0; i < TABS_NUMBER; i++) {
            SwingUtilities.invokeAndWait(bug7170310::addTab);
            toolkit.realSync();
        }
        SwingUtilities.invokeAndWait(bug7170310::check);
        if (exception != null) {
            System.out.println("Test failed: " + exception.getMessage());
            throw exception;
        } else {
            System.out.printf("Test passed");
        }
    } finally {
        frame.dispose();
    }
}
Also used : SunToolkit(sun.awt.SunToolkit) MetalLookAndFeel(javax.swing.plaf.metal.MetalLookAndFeel)

Example 8 with MetalLookAndFeel

use of javax.swing.plaf.metal.MetalLookAndFeel in project jdk8u_jdk by JetBrains.

the class bug8048506 method main.

public static void main(String[] args) throws Exception {
    UIManager.setLookAndFeel(new MetalLookAndFeel());
    SwingUtilities.invokeAndWait(new Runnable() {

        @Override
        public void run() {
            createAndShowGUI();
        }
    });
    System.out.println("The test passed");
}
Also used : MetalLookAndFeel(javax.swing.plaf.metal.MetalLookAndFeel)

Example 9 with MetalLookAndFeel

use of javax.swing.plaf.metal.MetalLookAndFeel in project jgnash by ccavanaugh.

the class ThemeManager method setLookAndFeel.

private static void setLookAndFeel(final String lookAndFeel) {
    Preferences pref = Preferences.userNodeForPackage(ThemeManager.class);
    String theme = pref.get(THEME, DEFAULT_THEME);
    try {
        Class<?> lafClass = Class.forName(lookAndFeel);
        Object lafInstance = lafClass.newInstance();
        if (lafInstance instanceof SubstanceSkin) {
            UIManager.put(SubstanceLookAndFeel.SHOW_EXTRA_WIDGETS, Boolean.TRUE);
            if (isSubstanceAnimationsEnabled()) {
                AnimationConfigurationManager.getInstance().setTimelineDuration(animationDuration);
            } else {
                AnimationConfigurationManager.getInstance().setTimelineDuration(0);
            }
            SubstanceLookAndFeel.setSkin(lookAndFeel);
        } else if (lafInstance instanceof NimbusLookAndFeel) {
            UIManager.setLookAndFeel((LookAndFeel) lafInstance);
            NimbusUtils.changeFontSize(getNimbusFontSize());
        } else if (lafInstance instanceof MetalLookAndFeel) {
            UIManager.setLookAndFeel((LookAndFeel) lafInstance);
            setTheme(theme);
        } else if (lafInstance instanceof LookAndFeel) {
            UIManager.setLookAndFeel((LookAndFeel) lafInstance);
        }
    } catch (final ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) {
        Logger.getLogger(ThemeManager.class.getName()).log(Level.WARNING, null, e);
    }
}
Also used : LookAndFeel(javax.swing.LookAndFeel) NimbusLookAndFeel(javax.swing.plaf.nimbus.NimbusLookAndFeel) SubstanceLookAndFeel(org.pushingpixels.substance.api.SubstanceLookAndFeel) MetalLookAndFeel(javax.swing.plaf.metal.MetalLookAndFeel) MetalLookAndFeel(javax.swing.plaf.metal.MetalLookAndFeel) SubstanceSkin(org.pushingpixels.substance.api.SubstanceSkin) UnsupportedLookAndFeelException(javax.swing.UnsupportedLookAndFeelException) NimbusLookAndFeel(javax.swing.plaf.nimbus.NimbusLookAndFeel) Preferences(java.util.prefs.Preferences)

Example 10 with MetalLookAndFeel

use of javax.swing.plaf.metal.MetalLookAndFeel in project intellij-community by JetBrains.

the class LafManagerImpl method setCurrentLookAndFeel.

/**
   * Sets current LAF. The method doesn't update component hierarchy.
   */
@Override
public void setCurrentLookAndFeel(UIManager.LookAndFeelInfo lookAndFeelInfo) {
    if (findLaf(lookAndFeelInfo.getClassName()) == null) {
        LOG.error("unknown LookAndFeel : " + lookAndFeelInfo);
        return;
    }
    // Set L&F
    if (IdeaLookAndFeelInfo.CLASS_NAME.equals(lookAndFeelInfo.getClassName())) {
        // that is IDEA default LAF
        IdeaLaf laf = new IdeaLaf();
        MetalLookAndFeel.setCurrentTheme(new IdeaBlueMetalTheme());
        try {
            UIManager.setLookAndFeel(laf);
        } catch (Exception e) {
            Messages.showMessageDialog(IdeBundle.message("error.cannot.set.look.and.feel", lookAndFeelInfo.getName(), e.getMessage()), CommonBundle.getErrorTitle(), Messages.getErrorIcon());
            return;
        }
    } else if (DarculaLookAndFeelInfo.CLASS_NAME.equals(lookAndFeelInfo.getClassName())) {
        DarculaLaf laf = new DarculaLaf();
        try {
            UIManager.setLookAndFeel(laf);
            JBColor.setDark(true);
            IconLoader.setUseDarkIcons(true);
        } catch (Exception e) {
            Messages.showMessageDialog(IdeBundle.message("error.cannot.set.look.and.feel", lookAndFeelInfo.getName(), e.getMessage()), CommonBundle.getErrorTitle(), Messages.getErrorIcon());
            return;
        }
    } else {
        // non default LAF
        try {
            LookAndFeel laf = ((LookAndFeel) Class.forName(lookAndFeelInfo.getClassName()).newInstance());
            if (laf instanceof MetalLookAndFeel) {
                MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
            }
            UIManager.setLookAndFeel(laf);
        } catch (Exception e) {
            Messages.showMessageDialog(IdeBundle.message("error.cannot.set.look.and.feel", lookAndFeelInfo.getName(), e.getMessage()), CommonBundle.getErrorTitle(), Messages.getErrorIcon());
            return;
        }
    }
    myCurrentLaf = ObjectUtils.chooseNotNull(findLaf(lookAndFeelInfo.getClassName()), lookAndFeelInfo);
    checkLookAndFeel(lookAndFeelInfo, false);
}
Also used : DarculaLaf(com.intellij.ide.ui.laf.darcula.DarculaLaf) SynthLookAndFeel(javax.swing.plaf.synth.SynthLookAndFeel) MetalLookAndFeel(javax.swing.plaf.metal.MetalLookAndFeel) MetalLookAndFeel(javax.swing.plaf.metal.MetalLookAndFeel) InvocationTargetException(java.lang.reflect.InvocationTargetException) DefaultMetalTheme(javax.swing.plaf.metal.DefaultMetalTheme)

Aggregations

MetalLookAndFeel (javax.swing.plaf.metal.MetalLookAndFeel)18 LookAndFeel (javax.swing.LookAndFeel)3 MetalTheme (javax.swing.plaf.metal.MetalTheme)3 ValueNamePair (org.compiere.util.ValueNamePair)3 DefaultComboBoxModel (javax.swing.DefaultComboBoxModel)2 UnsupportedLookAndFeelException (javax.swing.UnsupportedLookAndFeelException)2 AppContext (sun.awt.AppContext)2 SunToolkit (sun.awt.SunToolkit)2 DarculaLaf (com.intellij.ide.ui.laf.darcula.DarculaLaf)1 File (java.io.File)1 IOException (java.io.IOException)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 Method (java.lang.reflect.Method)1 Charset (java.nio.charset.Charset)1 Level (java.util.logging.Level)1 Preferences (java.util.prefs.Preferences)1 JFrame (javax.swing.JFrame)1 UIDefaults (javax.swing.UIDefaults)1 FontUIResource (javax.swing.plaf.FontUIResource)1 DefaultMetalTheme (javax.swing.plaf.metal.DefaultMetalTheme)1