Java 类javax.swing.plaf.metal.DefaultMetalTheme 实例源码

项目:jdk8u-jdk    文件:bug6742358.java   
public static void main(String[] args) {
    MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());

    JFrame frame = new JFrame();

    frame.setContentPane(new TestPanel());
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frame.pack();
    frame.setLocationRelativeTo(null);

    frame.setVisible(true);
}
项目:openjdk-jdk10    文件:bug6742358.java   
public static void main(String[] args) {
    MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());

    JFrame frame = new JFrame();

    frame.setContentPane(new TestPanel());
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frame.pack();
    frame.setLocationRelativeTo(null);

    frame.setVisible(true);
}
项目:openjdk9    文件:bug6742358.java   
public static void main(String[] args) {
    MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());

    JFrame frame = new JFrame();

    frame.setContentPane(new TestPanel());
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frame.pack();
    frame.setLocationRelativeTo(null);

    frame.setVisible(true);
}
项目:jdk8u_jdk    文件:bug6742358.java   
public static void main(String[] args) {
    MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());

    JFrame frame = new JFrame();

    frame.setContentPane(new TestPanel());
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frame.pack();
    frame.setLocationRelativeTo(null);

    frame.setVisible(true);
}
项目:lookaside_java-1.8.0-openjdk    文件:bug6742358.java   
public static void main(String[] args) {
    MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());

    JFrame frame = new JFrame();

    frame.setContentPane(new TestPanel());
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frame.pack();
    frame.setLocationRelativeTo(null);

    frame.setVisible(true);
}
项目:javify    文件:MiniDemo.java   
/**
 * Starts the demo application.
 *
 * @param args the command line arguments (ignored)
 */
public static void main(String[] args)
{
  SwingUtilities.invokeLater(new Runnable() {
    public void run()
    {
      MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
      MiniDemo demo = new MiniDemo();
      demo.setSize(320, 200);
      demo.setUndecorated(true);
      demo.setVisible(true);
      demo.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }
  });
}
项目:jvm-stm    文件:MiniDemo.java   
/**
 * Starts the demo application.
 *
 * @param args the command line arguments (ignored)
 */
public static void main(String[] args)
{
  SwingUtilities.invokeLater(new Runnable() {
    public void run()
    {
      MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
      MiniDemo demo = new MiniDemo();
      demo.setSize(320, 200);
      demo.setUndecorated(true);
      demo.setVisible(true);
      demo.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }
  });
}
项目:JCubemapAssembler    文件:CubemapAssembler.java   
public static void main(String _a[]) {
    try{
        MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
    }catch(Exception e){
        e.printStackTrace();
    }
    new CubemapAssembler();
}
项目:infobip-open-jdk-8    文件:bug6742358.java   
public static void main(String[] args) {
    MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());

    JFrame frame = new JFrame();

    frame.setContentPane(new TestPanel());
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frame.pack();
    frame.setLocationRelativeTo(null);

    frame.setVisible(true);
}
项目:jdk8u-dev-jdk    文件:bug6742358.java   
public static void main(String[] args) {
    MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());

    JFrame frame = new JFrame();

    frame.setContentPane(new TestPanel());
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frame.pack();
    frame.setLocationRelativeTo(null);

    frame.setVisible(true);
}
项目:jdk7-jdk    文件:bug6742358.java   
public static void main(String[] args) {
    MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());

    JFrame frame = new JFrame();

    frame.setContentPane(new TestPanel());
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frame.pack();
    frame.setLocationRelativeTo(null);

    frame.setVisible(true);
}
项目:openjdk-source-code-learn    文件:bug6742358.java   
public static void main(String[] args) {
    MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());

    JFrame frame = new JFrame();

    frame.setContentPane(new TestPanel());
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frame.pack();
    frame.setLocationRelativeTo(null);

    frame.setVisible(true);
}
项目:OLD-OpenJDK8    文件:bug6742358.java   
public static void main(String[] args) {
    MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());

    JFrame frame = new JFrame();

    frame.setContentPane(new TestPanel());
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frame.pack();
    frame.setLocationRelativeTo(null);

    frame.setVisible(true);
}
项目:JamVM-PH    文件:MiniDemo.java   
/**
 * Starts the demo application.
 *
 * @param args the command line arguments (ignored)
 */
public static void main(String[] args)
{
  SwingUtilities.invokeLater(new Runnable() {
    public void run()
    {
      MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
      MiniDemo demo = new MiniDemo();
      demo.setSize(320, 200);
      demo.setUndecorated(true);
      demo.setVisible(true);
      demo.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }
  });
}
项目:JAVA_UNIT    文件:bug6742358.java   
public static void main(String[] args) {
    MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());

    JFrame frame = new JFrame();

    frame.setContentPane(new TestPanel());
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frame.pack();
    frame.setLocationRelativeTo(null);

    frame.setVisible(true);
}
项目:openjdk-jdk7u-jdk    文件:bug6742358.java   
public static void main(String[] args) {
    MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());

    JFrame frame = new JFrame();

    frame.setContentPane(new TestPanel());
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frame.pack();
    frame.setLocationRelativeTo(null);

    frame.setVisible(true);
}
项目:IBMDataMovementTool    文件:IBMExtractGUI2.java   
private void configureUI() {
    Options.setDefaultIconSize(new Dimension(18, 18));

    Options.setUseNarrowButtons(this.settings.isUseNarrowButtons());

    Options.setTabIconsEnabled(this.settings.isTabIconsEnabled());
    UIManager.put("jgoodies.popupDropShadowEnabled", this.settings
            .isPopupDropShadowEnabled());

    LookAndFeel selectedLaf = this.settings.getSelectedLookAndFeel();
    if ((selectedLaf instanceof PlasticLookAndFeel)) {
        PlasticLookAndFeel
                .setPlasticTheme(this.settings.getSelectedTheme());
        PlasticLookAndFeel.setTabStyle(this.settings.getPlasticTabStyle());
        PlasticLookAndFeel.setHighContrastFocusColorsEnabled(this.settings
                .isPlasticHighContrastFocusEnabled());
    } else if (selectedLaf.getClass() == MetalLookAndFeel.class) {
        MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
    }

    JRadioButton radio = new JRadioButton();
    radio.getUI().uninstallUI(radio);
    JCheckBox checkBox = new JCheckBox();
    checkBox.getUI().uninstallUI(checkBox);
    try {
        UIManager.setLookAndFeel(selectedLaf);
    } catch (Exception e) {
        System.out.println("Can't change L&F: " + e);
    }
}
项目:classpath    文件:MiniDemo.java   
/**
 * Starts the demo application.
 *
 * @param args the command line arguments (ignored)
 */
public static void main(String[] args)
{
  SwingUtilities.invokeLater(new Runnable() {
    public void run()
    {
      MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
      MiniDemo demo = new MiniDemo();
      demo.setSize(320, 200);
      demo.setUndecorated(true);
      demo.setVisible(true);
      demo.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }
  });
}
项目:Darcula    文件:SwingSet2.java   
/**
    * Creates a JRadioButtonMenuItem for the Themes menu
    */
   public JMenuItem createThemesMenuItem(JMenu menu, String label, String mnemonic,
               String accessibleDescription, DefaultMetalTheme theme) {
       JRadioButtonMenuItem mi = (JRadioButtonMenuItem) menu.add(new JRadioButtonMenuItem(getString(label)));
themesMenuGroup.add(mi);
mi.setMnemonic(getMnemonic(mnemonic));
mi.getAccessibleContext().setAccessibleDescription(getString(accessibleDescription));
mi.addActionListener(new ChangeThemeAction(this, theme));

return mi;
   }
项目:openjdk-icedtea7    文件:bug6742358.java   
public static void main(String[] args) {
    MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());

    JFrame frame = new JFrame();

    frame.setContentPane(new TestPanel());
    frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
    frame.pack();
    frame.setLocationRelativeTo(null);

    frame.setVisible(true);
}
项目:SOEN6471-FreeCol    文件:FreeColLookAndFeel.java   
/**
 * Initiates a new FreeCol look and feel.
 *
 * @exception FreeColException If the ui directory could not be found.
 */
public FreeColLookAndFeel() throws FreeColException {
    super();

    setCurrentTheme(new DefaultMetalTheme() {
            protected ColorUIResource getPrimary1() {
                return new ColorUIResource(ResourceManager.getColor("lookAndFeel.primary1.color"));
            }

            protected ColorUIResource getPrimary2() {
                return new ColorUIResource(ResourceManager.getColor("lookAndFeel.backgroundSelect.color"));
            }

            protected ColorUIResource getPrimary3() {
                return new ColorUIResource(ResourceManager.getColor("lookAndFeel.primary3.color"));
            }

            protected ColorUIResource getSecondary1() {
                return new ColorUIResource(ResourceManager.getColor("lookAndFeel.secondary1.color"));
            }

            protected ColorUIResource getSecondary2() {
                return new ColorUIResource(ResourceManager.getColor("lookAndFeel.disabled.color"));
            }

            protected ColorUIResource getSecondary3() {
                return new ColorUIResource(ResourceManager.getColor("lookAndFeel.background.color"));
            }

            public ColorUIResource getMenuDisabledForeground() {
                return new ColorUIResource(ResourceManager.getColor("lookAndFeel.disabledMenu.color"));
            }
        });
}
项目:consulo    文件:LafManagerImpl.java   
/**
 * 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;
  }
  try {
    LookAndFeel laf = ((LookAndFeel)Class.forName(lookAndFeelInfo.getClassName()).newInstance());
    if (laf instanceof MetalLookAndFeel) {
      MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
    }

    boolean dark = laf instanceof BuildInLookAndFeel && ((BuildInLookAndFeel)laf).isDark();
    JBColor.setDark(dark);
    UIModificationTracker.getInstance().incModificationCount();
    IconLoader.setUseDarkIcons(dark);
    fireUpdate();
    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 = lookAndFeelInfo;

  checkLookAndFeel(lookAndFeelInfo, false);
}
项目:freecol    文件:FreeColLookAndFeel.java   
/**
 * Initiates a new FreeCol look and feel.
 *
 * @exception FreeColException If the ui directory could not be found.
 */
public FreeColLookAndFeel() throws FreeColException {
    super();

    setCurrentTheme(new DefaultMetalTheme() {
            @Override
            protected ColorUIResource getPrimary1() {
                return new ColorUIResource(ResourceManager.getColor("color.primary1.LookAndFeel"));
            }

            @Override
            protected ColorUIResource getPrimary2() {
                return new ColorUIResource(ResourceManager.getColor("color.backgroundSelect.LookAndFeel"));
            }

            @Override
            protected ColorUIResource getPrimary3() {
                return new ColorUIResource(ResourceManager.getColor("color.primary3.LookAndFeel"));
            }

            @Override
            protected ColorUIResource getSecondary1() {
                return new ColorUIResource(ResourceManager.getColor("color.secondary1.LookAndFeel"));
            }

            @Override
            protected ColorUIResource getSecondary2() {
                return new ColorUIResource(ResourceManager.getColor("color.disabled.LookAndFeel"));
            }

            @Override
            protected ColorUIResource getSecondary3() {
                return new ColorUIResource(ResourceManager.getColor("color.background.LookAndFeel"));
            }

            @Override
            public ColorUIResource getMenuDisabledForeground() {
                return new ColorUIResource(ResourceManager.getColor("color.disabledMenu.LookAndFeel"));
            }
        });
}
项目:OpenJSharp    文件:MetalworksFrame.java   
protected void buildMenus() {
    menuBar = new JMenuBar();
    menuBar.setOpaque(true);
    JMenu file = buildFileMenu();
    JMenu edit = buildEditMenu();
    JMenu views = buildViewsMenu();
    JMenu speed = buildSpeedMenu();
    JMenu help = buildHelpMenu();

    // load a theme from a text file
    MetalTheme myTheme = null;
    try {
        InputStream istream = getClass().getResourceAsStream(
                "/resources/MyTheme.theme");
        myTheme = new PropertiesMetalTheme(istream);
    } catch (NullPointerException e) {
        System.out.println(e);
    }

    // build an array of themes
    MetalTheme[] themes = { new OceanTheme(),
        new DefaultMetalTheme(),
        new GreenMetalTheme(),
        new AquaMetalTheme(),
        new KhakiMetalTheme(),
        new DemoMetalTheme(),
        new ContrastMetalTheme(),
        new BigContrastMetalTheme(),
        myTheme };

    // put the themes in a menu
    JMenu themeMenu = new MetalThemeMenu("Theme", themes);

    menuBar.add(file);
    menuBar.add(edit);
    menuBar.add(views);
    menuBar.add(themeMenu);
    menuBar.add(speed);
    menuBar.add(help);
    setJMenuBar(menuBar);
}
项目:jdk8u-jdk    文件:MetalworksFrame.java   
protected void buildMenus() {
    menuBar = new JMenuBar();
    menuBar.setOpaque(true);
    JMenu file = buildFileMenu();
    JMenu edit = buildEditMenu();
    JMenu views = buildViewsMenu();
    JMenu speed = buildSpeedMenu();
    JMenu help = buildHelpMenu();

    // load a theme from a text file
    MetalTheme myTheme = null;
    try {
        InputStream istream = getClass().getResourceAsStream(
                "/resources/MyTheme.theme");
        myTheme = new PropertiesMetalTheme(istream);
    } catch (NullPointerException e) {
        System.out.println(e);
    }

    // build an array of themes
    MetalTheme[] themes = { new OceanTheme(),
        new DefaultMetalTheme(),
        new GreenMetalTheme(),
        new AquaMetalTheme(),
        new KhakiMetalTheme(),
        new DemoMetalTheme(),
        new ContrastMetalTheme(),
        new BigContrastMetalTheme(),
        myTheme };

    // put the themes in a menu
    JMenu themeMenu = new MetalThemeMenu("Theme", themes);

    menuBar.add(file);
    menuBar.add(edit);
    menuBar.add(views);
    menuBar.add(themeMenu);
    menuBar.add(speed);
    menuBar.add(help);
    setJMenuBar(menuBar);
}
项目:jdk8u-jdk    文件:bug4252173.java   
public static void main(String[] args) throws InvocationTargetException, InterruptedException {
    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());

            JComponent component = new JLabel();

            Icon horizontalThumbIcon = UIManager.getIcon("Slider.horizontalThumbIcon");

            Icon verticalThumbIcon = UIManager.getIcon("Slider.verticalThumbIcon");

            Graphics g = new BufferedImage(100, 100, BufferedImage.TYPE_4BYTE_ABGR).getGraphics();

            horizontalThumbIcon.paintIcon(component, g, 0, 0);

            verticalThumbIcon.paintIcon(component, g, 0, 0);
        }
    });
}
项目:openjdk-jdk10    文件:MetalworksFrame.java   
protected void buildMenus() {
    menuBar = new JMenuBar();
    menuBar.setOpaque(true);
    JMenu file = buildFileMenu();
    JMenu edit = buildEditMenu();
    JMenu views = buildViewsMenu();
    JMenu speed = buildSpeedMenu();
    JMenu help = buildHelpMenu();

    // load a theme from a text file
    MetalTheme myTheme = null;
    try {
        InputStream istream = getClass().getResourceAsStream(
                "/resources/MyTheme.theme");
        myTheme = new PropertiesMetalTheme(istream);
    } catch (NullPointerException e) {
        System.out.println(e);
    }

    // build an array of themes
    MetalTheme[] themes = { new OceanTheme(),
        new DefaultMetalTheme(),
        new GreenMetalTheme(),
        new AquaMetalTheme(),
        new KhakiMetalTheme(),
        new DemoMetalTheme(),
        new ContrastMetalTheme(),
        new BigContrastMetalTheme(),
        myTheme };

    // put the themes in a menu
    JMenu themeMenu = new MetalThemeMenu("Theme", themes);

    menuBar.add(file);
    menuBar.add(edit);
    menuBar.add(views);
    menuBar.add(themeMenu);
    menuBar.add(speed);
    menuBar.add(help);
    setJMenuBar(menuBar);
}
项目:openjdk-jdk10    文件:bug4252173.java   
public static void main(String[] args) throws InvocationTargetException, InterruptedException {
    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());

            JComponent component = new JLabel();

            Icon horizontalThumbIcon = UIManager.getIcon("Slider.horizontalThumbIcon");

            Icon verticalThumbIcon = UIManager.getIcon("Slider.verticalThumbIcon");

            Graphics g = new BufferedImage(100, 100, BufferedImage.TYPE_4BYTE_ABGR).getGraphics();

            horizontalThumbIcon.paintIcon(component, g, 0, 0);

            verticalThumbIcon.paintIcon(component, g, 0, 0);
        }
    });
}
项目:FreeCol    文件:FreeColLookAndFeel.java   
/**
 * Initiates a new FreeCol look and feel.
 *
 * @exception FreeColException If the ui directory could not be found.
 */
public FreeColLookAndFeel() throws FreeColException {
    super();

    setCurrentTheme(new DefaultMetalTheme() {
            @Override
            protected ColorUIResource getPrimary1() {
                return new ColorUIResource(ResourceManager.getColor("color.primary1.LookAndFeel"));
            }

            @Override
            protected ColorUIResource getPrimary2() {
                return new ColorUIResource(ResourceManager.getColor("color.backgroundSelect.LookAndFeel"));
            }

            @Override
            protected ColorUIResource getPrimary3() {
                return new ColorUIResource(ResourceManager.getColor("color.primary3.LookAndFeel"));
            }

            @Override
            protected ColorUIResource getSecondary1() {
                return new ColorUIResource(ResourceManager.getColor("color.secondary1.LookAndFeel"));
            }

            @Override
            protected ColorUIResource getSecondary2() {
                return new ColorUIResource(ResourceManager.getColor("color.disabled.LookAndFeel"));
            }

            @Override
            protected ColorUIResource getSecondary3() {
                return new ColorUIResource(ResourceManager.getColor("color.background.LookAndFeel"));
            }

            @Override
            public ColorUIResource getMenuDisabledForeground() {
                return new ColorUIResource(ResourceManager.getColor("color.disabledMenu.LookAndFeel"));
            }
        });
}
项目:openjdk9    文件:MetalworksFrame.java   
protected void buildMenus() {
    menuBar = new JMenuBar();
    menuBar.setOpaque(true);
    JMenu file = buildFileMenu();
    JMenu edit = buildEditMenu();
    JMenu views = buildViewsMenu();
    JMenu speed = buildSpeedMenu();
    JMenu help = buildHelpMenu();

    // load a theme from a text file
    MetalTheme myTheme = null;
    try {
        InputStream istream = getClass().getResourceAsStream(
                "/resources/MyTheme.theme");
        myTheme = new PropertiesMetalTheme(istream);
    } catch (NullPointerException e) {
        System.out.println(e);
    }

    // build an array of themes
    MetalTheme[] themes = { new OceanTheme(),
        new DefaultMetalTheme(),
        new GreenMetalTheme(),
        new AquaMetalTheme(),
        new KhakiMetalTheme(),
        new DemoMetalTheme(),
        new ContrastMetalTheme(),
        new BigContrastMetalTheme(),
        myTheme };

    // put the themes in a menu
    JMenu themeMenu = new MetalThemeMenu("Theme", themes);

    menuBar.add(file);
    menuBar.add(edit);
    menuBar.add(views);
    menuBar.add(themeMenu);
    menuBar.add(speed);
    menuBar.add(help);
    setJMenuBar(menuBar);
}
项目:openjdk9    文件:bug4252173.java   
public static void main(String[] args) throws InvocationTargetException, InterruptedException {
    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());

            JComponent component = new JLabel();

            Icon horizontalThumbIcon = UIManager.getIcon("Slider.horizontalThumbIcon");

            Icon verticalThumbIcon = UIManager.getIcon("Slider.verticalThumbIcon");

            Graphics g = new BufferedImage(100, 100, BufferedImage.TYPE_4BYTE_ABGR).getGraphics();

            horizontalThumbIcon.paintIcon(component, g, 0, 0);

            verticalThumbIcon.paintIcon(component, g, 0, 0);
        }
    });
}
项目:jdk8u_jdk    文件:MetalworksFrame.java   
protected void buildMenus() {
    menuBar = new JMenuBar();
    menuBar.setOpaque(true);
    JMenu file = buildFileMenu();
    JMenu edit = buildEditMenu();
    JMenu views = buildViewsMenu();
    JMenu speed = buildSpeedMenu();
    JMenu help = buildHelpMenu();

    // load a theme from a text file
    MetalTheme myTheme = null;
    try {
        InputStream istream = getClass().getResourceAsStream(
                "/resources/MyTheme.theme");
        myTheme = new PropertiesMetalTheme(istream);
    } catch (NullPointerException e) {
        System.out.println(e);
    }

    // build an array of themes
    MetalTheme[] themes = { new OceanTheme(),
        new DefaultMetalTheme(),
        new GreenMetalTheme(),
        new AquaMetalTheme(),
        new KhakiMetalTheme(),
        new DemoMetalTheme(),
        new ContrastMetalTheme(),
        new BigContrastMetalTheme(),
        myTheme };

    // put the themes in a menu
    JMenu themeMenu = new MetalThemeMenu("Theme", themes);

    menuBar.add(file);
    menuBar.add(edit);
    menuBar.add(views);
    menuBar.add(themeMenu);
    menuBar.add(speed);
    menuBar.add(help);
    setJMenuBar(menuBar);
}
项目:jdk8u_jdk    文件:bug4252173.java   
public static void main(String[] args) throws InvocationTargetException, InterruptedException {
    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());

            JComponent component = new JLabel();

            Icon horizontalThumbIcon = UIManager.getIcon("Slider.horizontalThumbIcon");

            Icon verticalThumbIcon = UIManager.getIcon("Slider.verticalThumbIcon");

            Graphics g = new BufferedImage(100, 100, BufferedImage.TYPE_4BYTE_ABGR).getGraphics();

            horizontalThumbIcon.paintIcon(component, g, 0, 0);

            verticalThumbIcon.paintIcon(component, g, 0, 0);
        }
    });
}
项目:lookaside_java-1.8.0-openjdk    文件:MetalworksFrame.java   
protected void buildMenus() {
    menuBar = new JMenuBar();
    menuBar.setOpaque(true);
    JMenu file = buildFileMenu();
    JMenu edit = buildEditMenu();
    JMenu views = buildViewsMenu();
    JMenu speed = buildSpeedMenu();
    JMenu help = buildHelpMenu();

    // load a theme from a text file
    MetalTheme myTheme = null;
    try {
        InputStream istream = getClass().getResourceAsStream(
                "/resources/MyTheme.theme");
        myTheme = new PropertiesMetalTheme(istream);
    } catch (NullPointerException e) {
        System.out.println(e);
    }

    // build an array of themes
    MetalTheme[] themes = { new OceanTheme(),
        new DefaultMetalTheme(),
        new GreenMetalTheme(),
        new AquaMetalTheme(),
        new KhakiMetalTheme(),
        new DemoMetalTheme(),
        new ContrastMetalTheme(),
        new BigContrastMetalTheme(),
        myTheme };

    // put the themes in a menu
    JMenu themeMenu = new MetalThemeMenu("Theme", themes);

    menuBar.add(file);
    menuBar.add(edit);
    menuBar.add(views);
    menuBar.add(themeMenu);
    menuBar.add(speed);
    menuBar.add(help);
    setJMenuBar(menuBar);
}
项目:lookaside_java-1.8.0-openjdk    文件:bug4252173.java   
public static void main(String[] args) throws InvocationTargetException, InterruptedException {
    SwingUtilities.invokeAndWait(new Runnable() {
        public void run() {
            MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());

            JComponent component = new JLabel();

            Icon horizontalThumbIcon = UIManager.getIcon("Slider.horizontalThumbIcon");

            Icon verticalThumbIcon = UIManager.getIcon("Slider.verticalThumbIcon");

            Graphics g = new BufferedImage(100, 100, BufferedImage.TYPE_4BYTE_ABGR).getGraphics();

            horizontalThumbIcon.paintIcon(component, g, 0, 0);

            verticalThumbIcon.paintIcon(component, g, 0, 0);
        }
    });
}
项目:webcrypt-admin    文件:ThemeManager.java   
/**
 * This constructor reads all the values it needs from the
 * GUIResourceBundle.  It uses intelligent defaults if properties
 * are not specified.
 **/
public Theme(GUIResourceBundle resources, String name) {
    // Use this theme object to get default font values from
    DefaultMetalTheme defaultTheme = new DefaultMetalTheme();

    // Look up the display name of the theme
    displayName = resources.getString(name + ".name", null);

    // Look up the fonts for the theme
    Font control = resources.getFont(name + ".controlFont", null);
    Font menu = resources.getFont(name + ".menuFont", null);
    Font small = resources.getFont(name + ".smallFont", null);
    Font system = resources.getFont(name + ".systemFont", null);
    Font user = resources.getFont(name + ".userFont", null);
    Font title = resources.getFont(name + ".titleFont", null);

    // Convert fonts to FontUIResource, or get defaults
    if (control != null) controlFont = new FontUIResource(control);
    else controlFont = defaultTheme.getControlTextFont();
    if (menu != null) menuFont = new FontUIResource(menu);
    else menuFont = defaultTheme.getMenuTextFont();
    if (small != null) smallFont = new FontUIResource(small);
    else smallFont = defaultTheme.getSubTextFont();
    if (system != null) systemFont = new FontUIResource(system);
    else systemFont = defaultTheme.getSystemTextFont();
    if (user != null) userFont = new FontUIResource(user);
    else userFont = defaultTheme.getUserTextFont();
    if (title != null) titleFont = new FontUIResource(title);
    else titleFont = defaultTheme.getWindowTitleFont();

    // Look up primary and secondary colors
    Color primary = resources.getColor(name + ".primary", null);
    Color secondary = resources.getColor(name + ".secondary", null);

    // Derive all six colors from these two, using defaults if needed
    if (primary != null) primary1 = new ColorUIResource(primary);
    else primary1 = new ColorUIResource(102, 102, 153);
    primary2 = new ColorUIResource(primary1.brighter());
    primary3 = new ColorUIResource(primary2.brighter());
    if (secondary != null) secondary1 = new ColorUIResource(secondary);
    else secondary1 = new ColorUIResource(102, 102, 102);
    secondary2 = new ColorUIResource(secondary1.brighter());
    secondary3 = new ColorUIResource(secondary2.brighter());
}
项目:code-similarity    文件:ThemeManager.java   
/**
 * This constructor reads all the values it needs from the
 * GUIResourceBundle.  It uses intelligent defaults if properties
 * are not specified.
 **/
public Theme(GUIResourceBundle resources, String name) {
    // Use this theme object to get default font values from
    DefaultMetalTheme defaultTheme = new DefaultMetalTheme();

    // Look up the display name of the theme
    displayName = resources.getString(name + ".name", null);

    // Look up the fonts for the theme
    Font control = resources.getFont(name + ".controlFont", null);
    Font menu = resources.getFont(name + ".menuFont", null);
    Font small = resources.getFont(name + ".smallFont", null);
    Font system = resources.getFont(name + ".systemFont", null);
    Font user = resources.getFont(name + ".userFont", null);
    Font title = resources.getFont(name + ".titleFont", null);

    // Convert fonts to FontUIResource, or get defaults
    if (control != null) controlFont = new FontUIResource(control);
    else controlFont = defaultTheme.getControlTextFont();
    if (menu != null) menuFont = new FontUIResource(menu);
    else menuFont = defaultTheme.getMenuTextFont();
    if (small != null) smallFont = new FontUIResource(small);
    else smallFont = defaultTheme.getSubTextFont();
    if (system != null) systemFont = new FontUIResource(system);
    else systemFont = defaultTheme.getSystemTextFont();
    if (user != null) userFont = new FontUIResource(user);
    else userFont = defaultTheme.getUserTextFont();
    if (title != null) titleFont = new FontUIResource(title);
    else titleFont = defaultTheme.getWindowTitleFont();

    // Look up primary and secondary colors
    Color primary = resources.getColor(name + ".primary", null);
    Color secondary = resources.getColor(name + ".secondary", null);

    // Derive all six colors from these two, using defaults if needed
    if (primary != null) primary1 = new ColorUIResource(primary);
    else primary1 = new ColorUIResource(102, 102, 153);
    primary2 = new ColorUIResource(primary1.brighter());
    primary3 = new ColorUIResource(primary2.brighter());
    if (secondary != null) secondary1 = new ColorUIResource(secondary);
    else secondary1 = new ColorUIResource(102, 102, 102);
    secondary2 = new ColorUIResource(secondary1.brighter());
    secondary3 = new ColorUIResource(secondary2.brighter());
}
项目:intellij-ce-playground    文件:DarculaLaf.java   
protected DefaultMetalTheme createMetalTheme() {
  return new DarculaMetalTheme();
}
项目:intellij-ce-playground    文件:IntelliJLaf.java   
@Override
protected DefaultMetalTheme createMetalTheme() {
  return new IdeaBlueMetalTheme();
}
项目:swingx    文件:TestUtilities.java   
/**
 * Go through all existing LookAndFeelAddons. This leads all registered
 * {@link org.jdesktop.swingx.plaf.ComponentAddon} to initialize/uninitialize
 * themselves.
 */
public static void cycleAddons(JComponent component) throws Exception {
  LookAndFeelAddons.setAddon(MacOSXLookAndFeelAddons.class.getName());
  component.updateUI();

  MetalTheme oldTheme = MetalLookAndFeel.getCurrentTheme();
  try {
    MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
    LookAndFeelAddons.setAddon(MetalLookAndFeelAddons.class.getName());
    component.updateUI();

    MetalLookAndFeel.setCurrentTheme(new OceanTheme());
    LookAndFeelAddons.setAddon(MetalLookAndFeelAddons.class.getName());
    component.updateUI();
  } finally {
    MetalLookAndFeel.setCurrentTheme(oldTheme);
  }

  LookAndFeelAddons.setAddon(MotifLookAndFeelAddons.class.getName());
  component.updateUI();

  LookAndFeelAddons.setAddon(WindowsLookAndFeelAddons.class.getName());
  component.updateUI();

  String property = UIManager.getString("win.xpstyle.name");
  try {
    UIManager.put("win.xpstyle.name",
      WindowsLookAndFeelAddons.HOMESTEAD_VISUAL_STYLE);
    LookAndFeelAddons.setAddon(WindowsClassicLookAndFeelAddons.class
      .getName());
    component.updateUI();

    UIManager.put("win.xpstyle.name",
      WindowsLookAndFeelAddons.SILVER_VISUAL_STYLE);
    LookAndFeelAddons.setAddon(WindowsClassicLookAndFeelAddons.class
      .getName());
    component.updateUI();

    UIManager.put("win.xpstyle.name", null);
    LookAndFeelAddons.setAddon(WindowsClassicLookAndFeelAddons.class
      .getName());
    component.updateUI();

  } finally {
    UIManager.put("win.xpstyle.name", property);
  }
}