当前位置: 首页>>代码示例>>Java>>正文


Java MetalLookAndFeel.setCurrentTheme方法代码示例

本文整理汇总了Java中javax.swing.plaf.metal.MetalLookAndFeel.setCurrentTheme方法的典型用法代码示例。如果您正苦于以下问题:Java MetalLookAndFeel.setCurrentTheme方法的具体用法?Java MetalLookAndFeel.setCurrentTheme怎么用?Java MetalLookAndFeel.setCurrentTheme使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.plaf.metal.MetalLookAndFeel的用法示例。


在下文中一共展示了MetalLookAndFeel.setCurrentTheme方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: actionPerformed

import javax.swing.plaf.metal.MetalLookAndFeel; //导入方法依赖的package包/类
public void actionPerformed(ActionEvent e) {
    String numStr = e.getActionCommand();
    MetalTheme selectedTheme = themes[Integer.parseInt(numStr)];
    MetalLookAndFeel.setCurrentTheme(selectedTheme);
    try {
        UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
    } catch (Exception ex) {
        System.out.println("Failed loading Metal");
        System.out.println(ex);
    }

}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:13,代码来源:MetalThemeMenu.java

示例2: setLookAndFeel

import javax.swing.plaf.metal.MetalLookAndFeel; //导入方法依赖的package包/类
/**
 * Statyczna metoda ustawiająca temat(Ocean) LookAndFeel 
 */
public static void setLookAndFeel() {
    
  MetalLookAndFeel.setCurrentTheme(new OceanTheme());
  try {
    UIManager.setLookAndFeel(new MetalLookAndFeel());
  }
  catch(Exception e) {
    System.err.println(e);
  }
  
  JFrame.setDefaultLookAndFeelDecorated(true);   
  JDialog.setDefaultLookAndFeelDecorated(true); 
    
  
}
 
开发者ID:makaw,项目名称:somado,代码行数:19,代码来源:GUI.java

示例3: actionPerformed

import javax.swing.plaf.metal.MetalLookAndFeel; //导入方法依赖的package包/类
/**
 * Changes the theme to the one specified in the constructor.
 *
 * @param event the action event that triggered this action
 */
public void actionPerformed(ActionEvent event)
{
  MetalLookAndFeel.setCurrentTheme(theme);
  try
    {
      // Only switch theme if we have a metal L&F. It is still necessary
      // to install a new MetalLookAndFeel instance.
      if (UIManager.getLookAndFeel() instanceof MetalLookAndFeel)
        UIManager.setLookAndFeel(new MetalLookAndFeel());
    }
  catch (UnsupportedLookAndFeelException ex)
    {
      ex.printStackTrace();
    }
  SwingUtilities.updateComponentTreeUI(frame);
}
 
开发者ID:vilie,项目名称:javify,代码行数:22,代码来源:Demo.java

示例4: setTheme

import javax.swing.plaf.metal.MetalLookAndFeel; //导入方法依赖的package包/类
/** Look up the named theme, and apply it to the frame */
   public void setTheme(String themeName) {
// Look up the theme in the resource bundle
Theme theme = new Theme(resources, themeName);
// Make it the current theme
MetalLookAndFeel.setCurrentTheme(theme);
// Re-apply the Metal look-and-feel to install new theme
try { UIManager.setLookAndFeel(new MetalLookAndFeel()); }
catch(UnsupportedLookAndFeelException e) {}
// Propagate the new l&f across the entire component tree of the frame
SwingUtilities.updateComponentTreeUI(frame);

//ZEPH ADD-ON:
//Change also the font of the viewed page:
if (frame instanceof WebBrowser){
    WebBrowser wbf = (WebBrowser)frame;
    wbf.textPane.setFont(theme.systemFont);
    wbf.textPane.updateUI();
}
   }
 
开发者ID:tzaffi,项目名称:webcrypt-admin,代码行数:21,代码来源:ThemeManager.java

示例5: actionPerformed

import javax.swing.plaf.metal.MetalLookAndFeel; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
@Override
public void actionPerformed(ActionEvent actionEvent) {
	try {
		String lookAndFeelClassName = actionEvent.getActionCommand();
		Class<LookAndFeel> lookAndFeelClass = (Class<LookAndFeel>) Class.forName(lookAndFeelClassName);
		LookAndFeel lookAndFeel = lookAndFeelClass.newInstance();
		if (lookAndFeel instanceof MetalThemeProvider) {
			MetalTheme theme = ((MetalThemeProvider) lookAndFeel).getMetalTheme();
			MetalLookAndFeel.setCurrentTheme(theme);
		}
		UIManager.setLookAndFeel(lookAndFeel);
		for (Window window : JFrame.getWindows()) {
			SwingUtilities.updateComponentTreeUI(window);
			window.validate();
			window.repaint();
		}
	} catch (Exception exception) {
		exception.printStackTrace();
		JOptionPane.showMessageDialog(null, "Can't change look and feel", "Invalid PLAF", JOptionPane.ERROR_MESSAGE);
	}
}
 
开发者ID:BrunoEberhard,项目名称:minimal-j,代码行数:23,代码来源:LookAndFeelAction.java

示例6: installTheme

import javax.swing.plaf.metal.MetalLookAndFeel; //导入方法依赖的package包/类
private boolean installTheme(LookAndFeel lf) {
    boolean themeInstalled = false;
    //Load the theme
    if (themeURL != null) {
        themeInstalled = true;
        NbTheme nbTheme = new NbTheme(themeURL, lf);
        MetalLookAndFeel.setCurrentTheme(nbTheme);
    }
    return themeInstalled;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:Startup.java

示例7: initLookAndFeel

import javax.swing.plaf.metal.MetalLookAndFeel; //导入方法依赖的package包/类
/** Sets the look-and-feel. */
public static void initLookAndFeel() {
    if (!lookAndFeelInit) {
        lookAndFeelInit = true;
        try {
            // LAF specific options that should be done before setting the LAF
            // go here
            MetalLookAndFeel.setCurrentTheme(new DesertBlue());
            // Set the look and feel
            UIManager.setLookAndFeel(new com.jgoodies.looks.plastic.PlasticLookAndFeel());
        } catch (Exception e) {
            throw new IllegalStateException(e);
        }
    }
}
 
开发者ID:meteoorkip,项目名称:JavaGraph,代码行数:16,代码来源:Options.java

示例8: main

import javax.swing.plaf.metal.MetalLookAndFeel; //导入方法依赖的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

示例9: setTheme

import javax.swing.plaf.metal.MetalLookAndFeel; //导入方法依赖的package包/类
/** Look up the named theme, and apply it to the frame */
   public void setTheme(String themeName) {
// Look up the theme in the resource bundle
Theme theme = new Theme(resources, themeName);
// Make it the current theme
MetalLookAndFeel.setCurrentTheme(theme);
// Re-apply the Metal look-and-feel to install new theme
try { UIManager.setLookAndFeel(new MetalLookAndFeel()); }
catch(UnsupportedLookAndFeelException e) {}
// Propagate the new l&f across the entire component tree of the frame
SwingUtilities.updateComponentTreeUI(frame);
   }
 
开发者ID:shashanksingh28,项目名称:code-similarity,代码行数:13,代码来源:ThemeManager.java

示例10: setupLookAndFeel

import javax.swing.plaf.metal.MetalLookAndFeel; //导入方法依赖的package包/类
/**
 * Setup applications Look and Feel.
 */
private void setupLookAndFeel(ApplicationArguments args)
{
	/* 
	 * Don't prevent the user from overriding the laf is they choose to use 
	 * Swing's default laf prop 
	 */
	String userSpecifiedOverride = System.getProperty("swing.defaultlaf");
	if (userSpecifiedOverride != null && !"".equals(userSpecifiedOverride)) { return; }

	String lafClassName =
		args.useNativeLAF() ? UIManager.getSystemLookAndFeelClassName() : MetalLookAndFeel.class.getName();

	if (!args.useDefaultMetalTheme())
	{
		MetalLookAndFeel.setCurrentTheme(new AllBluesBoldMetalTheme());
	}

	try
	{
		// The following is a work-around for the problem on Mac OS X where
		// the Apple LAF delegates to the Swing Popup factory but then
		// tries to set a 90% alpha on the underlying Cocoa window, which
		// will always be null if you're using JGoodies L&F
		// see http://www.caimito.net/pebble/2005/07/26/1122392314480.html#comment1127522262179
		// This has no effect on Linux/Windows
		PopupFactory.setSharedInstance(new PopupFactory());

		UIManager.setLookAndFeel(lafClassName);
	}
	catch (Exception ex)
	{
		// i18n[Application.error.setlaf=Error setting LAF]
		s_log.error(s_stringMgr.getString("Application.error.setlaf"), ex);
	}
}
 
开发者ID:realxujiang,项目名称:bigtable-sql,代码行数:39,代码来源:Application.java

示例11: setCurrentMetalTheme

import javax.swing.plaf.metal.MetalLookAndFeel; //导入方法依赖的package包/类
/**
 * Invoke the correct method to set current metal based theme.
 * Supported look and feel are Metal, Plastic and Compiere.  
 * @param laf Metal based look and feel
 * @param theme Metal based theme
 */
static void setCurrentMetalTheme(final MetalLookAndFeel laf, final MetalTheme theme)
{
	if (laf instanceof AdempiereLookAndFeel && theme instanceof PlasticTheme)
	{
		AdempiereLookAndFeel.setCurrentTheme((PlasticTheme)theme);
	}
	else
	{
		MetalLookAndFeel.setCurrentTheme(theme);
	}
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:18,代码来源:AdempierePLAF.java

示例12: main

import javax.swing.plaf.metal.MetalLookAndFeel; //导入方法依赖的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

示例13: enable

import javax.swing.plaf.metal.MetalLookAndFeel; //导入方法依赖的package包/类
public static void enable() {
    MetalLookAndFeel.setCurrentTheme(new SilverOceanTheme());
}
 
开发者ID:workcraft,项目名称:workcraft,代码行数:4,代码来源:SilverOceanTheme.java

示例14: actionPerformed

import javax.swing.plaf.metal.MetalLookAndFeel; //导入方法依赖的package包/类
public void actionPerformed(ActionEvent e) {
	MetalLookAndFeel.setCurrentTheme(theme);
	swingset.updateLookAndFeel();
}
 
开发者ID:JackJiang2011,项目名称:beautyeye,代码行数:5,代码来源:SwingSet2.java

示例15: cycleAddons

import javax.swing.plaf.metal.MetalLookAndFeel; //导入方法依赖的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.MetalLookAndFeel.setCurrentTheme方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。