當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。