當前位置: 首頁>>代碼示例>>Java>>正文


Java DefaultMetalTheme類代碼示例

本文整理匯總了Java中javax.swing.plaf.metal.DefaultMetalTheme的典型用法代碼示例。如果您正苦於以下問題:Java DefaultMetalTheme類的具體用法?Java DefaultMetalTheme怎麽用?Java DefaultMetalTheme使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


DefaultMetalTheme類屬於javax.swing.plaf.metal包,在下文中一共展示了DefaultMetalTheme類的14個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: main

import javax.swing.plaf.metal.DefaultMetalTheme; //導入依賴的package包/類
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);
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:13,代碼來源:bug6742358.java

示例2: main

import javax.swing.plaf.metal.DefaultMetalTheme; //導入依賴的package包/類
/**
 * 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);
    }
  });
}
 
開發者ID:vilie,項目名稱:javify,代碼行數:20,代碼來源:MiniDemo.java

示例3: main

import javax.swing.plaf.metal.DefaultMetalTheme; //導入依賴的package包/類
public static void main(String _a[]) {
    try{
        MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
    }catch(Exception e){
        e.printStackTrace();
    }
    new CubemapAssembler();
}
 
開發者ID:riccardobl,項目名稱:JCubemapAssembler,代碼行數:9,代碼來源:CubemapAssembler.java

示例4: configureUI

import javax.swing.plaf.metal.DefaultMetalTheme; //導入依賴的package包/類
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);
    }
}
 
開發者ID:javachen,項目名稱:IBMDataMovementTool,代碼行數:31,代碼來源:IBMExtractGUI2.java

示例5: createThemesMenuItem

import javax.swing.plaf.metal.DefaultMetalTheme; //導入依賴的package包/類
/**
    * 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;
   }
 
開發者ID:bulenkov,項目名稱:Darcula,代碼行數:14,代碼來源:SwingSet2.java

示例6: FreeColLookAndFeel

import javax.swing.plaf.metal.DefaultMetalTheme; //導入依賴的package包/類
/**
 * 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"));
            }
        });
}
 
開發者ID:vishal-mittal,項目名稱:SOEN6471-FreeCol,代碼行數:39,代碼來源:FreeColLookAndFeel.java

示例7: setCurrentLookAndFeel

import javax.swing.plaf.metal.DefaultMetalTheme; //導入依賴的package包/類
/**
 * 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);
}
 
開發者ID:consulo,項目名稱:consulo,代碼行數:32,代碼來源:LafManagerImpl.java

示例8: FreeColLookAndFeel

import javax.swing.plaf.metal.DefaultMetalTheme; //導入依賴的package包/類
/**
 * 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"));
            }
        });
}
 
開發者ID:FreeCol,項目名稱:freecol,代碼行數:46,代碼來源:FreeColLookAndFeel.java

示例9: buildMenus

import javax.swing.plaf.metal.DefaultMetalTheme; //導入依賴的package包/類
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);
}
 
開發者ID:SunburstApps,項目名稱:OpenJSharp,代碼行數:42,代碼來源:MetalworksFrame.java

示例10: main

import javax.swing.plaf.metal.DefaultMetalTheme; //導入依賴的package包/類
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);
        }
    });
}
 
開發者ID:lambdalab-mirror,項目名稱:jdk8u-jdk,代碼行數:20,代碼來源:bug4252173.java

示例11: Theme

import javax.swing.plaf.metal.DefaultMetalTheme; //導入依賴的package包/類
/**
 * 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());
}
 
開發者ID:tzaffi,項目名稱:webcrypt-admin,代碼行數:49,代碼來源:ThemeManager.java

示例12: createMetalTheme

import javax.swing.plaf.metal.DefaultMetalTheme; //導入依賴的package包/類
protected DefaultMetalTheme createMetalTheme() {
  return new DarculaMetalTheme();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:4,代碼來源:DarculaLaf.java

示例13: createMetalTheme

import javax.swing.plaf.metal.DefaultMetalTheme; //導入依賴的package包/類
@Override
protected DefaultMetalTheme createMetalTheme() {
  return new IdeaBlueMetalTheme();
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:5,代碼來源:IntelliJLaf.java

示例14: cycleAddons

import javax.swing.plaf.metal.DefaultMetalTheme; //導入依賴的package包/類
/**
 * 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);
  }
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:52,代碼來源:TestUtilities.java


注:本文中的javax.swing.plaf.metal.DefaultMetalTheme類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。