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


Java MetalLookAndFeel.getCurrentTheme方法代碼示例

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


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

示例1: addMetalDefaults

import javax.swing.plaf.metal.MetalLookAndFeel; //導入方法依賴的package包/類
@Override
protected void addMetalDefaults(LookAndFeelAddons addon, DefaultsList defaults) {
  super.addMetalDefaults(addon, defaults);
  
  if (MetalLookAndFeel.getCurrentTheme() instanceof OceanTheme) {
      defaults.add(JXTaskPane.uiClassID, "org.jdesktop.swingx.plaf.misc.GlossyTaskPaneUI");
  } else {
      defaults.add(JXTaskPane.uiClassID, "org.jdesktop.swingx.plaf.metal.MetalTaskPaneUI");
  }
  
  //TODO use safe methods
  defaults.add("TaskPane.foreground", UIManager.getColor("activeCaptionText"));
  defaults.add("TaskPane.background", MetalLookAndFeel.getControl());
  defaults.add("TaskPane.specialTitleBackground", MetalLookAndFeel.getPrimaryControl());
  defaults.add("TaskPane.titleBackgroundGradientStart", MetalLookAndFeel.getPrimaryControl());
  defaults.add("TaskPane.titleBackgroundGradientEnd", MetalLookAndFeel.getPrimaryControlHighlight());
  defaults.add("TaskPane.titleForeground", MetalLookAndFeel.getControlTextColor());
  defaults.add("TaskPane.specialTitleForeground", MetalLookAndFeel.getControlTextColor());
  defaults.add("TaskPane.borderColor", MetalLookAndFeel.getPrimaryControl());
  defaults.add("TaskPane.titleOver", new ColorUIResource(MetalLookAndFeel.getControl().darker()));
  defaults.add("TaskPane.specialTitleOver", MetalLookAndFeel.getPrimaryControlHighlight());
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:23,代碼來源:TaskPaneAddon.java

示例2: themeSelectionChanged

import javax.swing.plaf.metal.MetalLookAndFeel; //導入方法依賴的package包/類
/**
 * Handle theme selection changed
 * @param e
 */
private void themeSelectionChanged(final ListSelectionEvent e)
{
	if (m_setting)
		return;
	setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
	try
	{
		ValueNamePair laf = lookList.getSelectedValue();
		ValueNamePair theme = themeList.getSelectedValue();
		LookAndFeel currentLaf = UIManager.getLookAndFeel();
		MetalTheme currentTheme = MetalLookAndFeel.getCurrentTheme();
		AdempierePLAF.setPLAF(laf, theme, false);
		previewPanel.refresh(currentLaf, currentTheme);
		SwingUtilities.updateComponentTreeUI(previewPanel);
		updatePreviewComponents();
		setLFSelection();
	}
	finally
	{
		setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
		this.repaint();
	}
}
 
開發者ID:metasfresh,項目名稱:metasfresh,代碼行數:28,代碼來源:PLAFEditorPanel.java

示例3: lookAndFeelSelectionChanged

import javax.swing.plaf.metal.MetalLookAndFeel; //導入方法依賴的package包/類
/**
 * Handle look and feel selection changed
 * @param e
 */
private void lookAndFeelSelectionChanged(final ListSelectionEvent e)
{
	if (m_setting)
		return;
	setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
	try
	{
		ValueNamePair laf = lookList.getSelectedValue();
		LookAndFeel currentLaf = UIManager.getLookAndFeel();
		MetalTheme currentTheme = MetalLookAndFeel.getCurrentTheme();
		AdempierePLAF.setPLAF(laf, null, false);
		previewPanel.refresh(currentLaf, currentTheme);
		SwingUtilities.updateComponentTreeUI(previewPanel);
		updatePreviewComponents();
		setLFSelection();
	}
	finally
	{
		setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
		this.repaint();
	}
}
 
開發者ID:metasfresh,項目名稱:metasfresh,代碼行數:27,代碼來源:PLAFEditorPanel.java

示例4: paintBorder

import javax.swing.plaf.metal.MetalLookAndFeel; //導入方法依賴的package包/類
/**
 * Paints the border for the specified component.
 *
 * @param c  the component (ignored).
 * @param g  the graphics device.
 * @param x  the x-coordinate.
 * @param y  the y-coordinate.
 * @param w  the width.
 * @param h  the height.
 */
public void paintBorder(Component c, Graphics g, int x, int y, int w,
    int h)
{
  g.translate(x, y);
  if (MetalLookAndFeel.getCurrentTheme() instanceof OceanTheme)
    {
      g.setColor(MetalLookAndFeel.getControlDarkShadow());
      g.drawLine(0, 0, w - 1, 0);
      g.drawLine(0, 0, 0, h - 1);
      g.drawLine(0, h - 1, w - 1, h - 1);
      g.setColor(MetalLookAndFeel.getControlShadow());
      g.drawLine(1, 1, w - 2, 1);
      g.drawLine(1, 1, 1, h - 2);
      g.drawLine(1, h - 2, w - 1, h - 2);
      g.drawLine(w - 1, 1, w - 1, h - 2);
    }
  else
    {
      g.setColor(MetalLookAndFeel.getControlDarkShadow());
      g.drawLine(0, 0, w - 1, 0);
      g.drawLine(0, 0, 0, h - 2);
      g.drawLine(0, h - 2, w - 1, h - 2);
      g.setColor(MetalLookAndFeel.getControlHighlight());
      g.drawLine(1, 1, w - 1, 1);
      g.drawLine(1, 1, 1, h - 1);
      g.drawLine(1, h - 1, w - 1, h - 1);
      g.setColor(MetalLookAndFeel.getControl());
      g.drawLine(1, h - 2, 1, h - 2);
    }
  g.translate(-x, -y);
}
 
開發者ID:vilie,項目名稱:javify,代碼行數:42,代碼來源:MetalComboBoxEditor.java

示例5: paintBorder

import javax.swing.plaf.metal.MetalLookAndFeel; //導入方法依賴的package包/類
/**
 * Paints the border for the specified component.
 * 
 * @param c  the component (ignored).
 * @param g  the graphics device.
 * @param x  the x-coordinate.
 * @param y  the y-coordinate.
 * @param w  the width.
 * @param h  the height.
 */
public void paintBorder(Component c, Graphics g, int x, int y, int w, 
    int h)
{
  g.translate(x, y);
  if (MetalLookAndFeel.getCurrentTheme() instanceof OceanTheme)
    {
      g.setColor(MetalLookAndFeel.getControlDarkShadow());
      g.drawLine(0, 0, w - 1, 0);
      g.drawLine(0, 0, 0, h - 1);
      g.drawLine(0, h - 1, w - 1, h - 1);
      g.setColor(MetalLookAndFeel.getControlShadow());
      g.drawLine(1, 1, w - 2, 1);
      g.drawLine(1, 1, 1, h - 2);
      g.drawLine(1, h - 2, w - 1, h - 2);
      g.drawLine(w - 1, 1, w - 1, h - 2);
    }
  else
    {
      g.setColor(MetalLookAndFeel.getControlDarkShadow());
      g.drawLine(0, 0, w - 1, 0);
      g.drawLine(0, 0, 0, h - 2);
      g.drawLine(0, h - 2, w - 1, h - 2);
      g.setColor(MetalLookAndFeel.getControlHighlight());
      g.drawLine(1, 1, w - 1, 1);
      g.drawLine(1, 1, 1, h - 1);
      g.drawLine(1, h - 1, w - 1, h - 1);
      g.setColor(MetalLookAndFeel.getControl());
      g.drawLine(1, h - 2, 1, h - 2);
    }
  g.translate(-x, -y);
}
 
開發者ID:nmldiegues,項目名稱:jvm-stm,代碼行數:42,代碼來源:MetalComboBoxEditor.java

示例6: addMetalDefaults

import javax.swing.plaf.metal.MetalLookAndFeel; //導入方法依賴的package包/類
/**
 * {@inheritDoc}
 */
@Override
protected void addMetalDefaults(LookAndFeelAddons addon, DefaultsList defaults) {
    super.addMetalDefaults(addon, defaults);
    
    if (MetalLookAndFeel.getCurrentTheme() instanceof OceanTheme) {
        defaults.add("UIColorHighlighter.stripingBackground", new ColorUIResource(230, 238, 246));
    } else {
        defaults.add("UIColorHighlighter.stripingBackground", new ColorUIResource(235, 235, 255));
    }
}
 
開發者ID:RockManJoe64,項目名稱:swingx,代碼行數:14,代碼來源:UIColorHighlighterAddon.java

示例7: 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

示例8: login

import javax.swing.plaf.metal.MetalLookAndFeel; //導入方法依賴的package包/類
@Override
public String login(int AD_Org_ID, int AD_Role_ID, int AD_User_ID)
{
	if (!Ini.isClient())
		return null;
	//
	// UI
	boolean changed = false;
	final ISysConfigBL sysConfigBL = Services.get(ISysConfigBL.class);
	ValueNamePair laf = getLookByName(sysConfigBL.getValue(SYSCONFIG_UILookFeel, Env.getAD_Client_ID(Env.getCtx())));
	ValueNamePair theme = getThemeByName(sysConfigBL.getValue(SYSCONFIG_UITheme, Env.getAD_Client_ID(Env.getCtx())));
	if (laf != null && theme != null)
	{
		String clazz = laf.getValue();
		String currentLaf = UIManager.getLookAndFeel().getClass().getName();
		if (!Check.isEmpty(clazz) && !currentLaf.equals(clazz))
		{
			// laf changed
			AdempierePLAF.setPLAF(laf, theme, true);
			AEnv.updateUI();
			changed = true;
		}
		else
		{
			if (UIManager.getLookAndFeel() instanceof MetalLookAndFeel)
			{
				MetalTheme currentTheme = MetalLookAndFeel.getCurrentTheme();
				String themeClass = currentTheme.getClass().getName();
				String sTheme = theme.getValue();
				if (sTheme != null && sTheme.length() > 0 && !sTheme.equals(themeClass))
				{
					ValueNamePair plaf = new ValueNamePair(
							UIManager.getLookAndFeel().getClass().getName(),
							UIManager.getLookAndFeel().getName());
					AdempierePLAF.setPLAF(plaf, theme, true);
					AEnv.updateUI();
					changed = true;
				}
			}
		}
	}
	//
	if (changed)
		Ini.saveProperties();

	//
	// Make sure the UIDefauls from sysconfig were loaded
	SysConfigUIDefaultsRepository.ofCurrentLookAndFeelId()
			.loadAllFromSysConfigTo(UIManager.getDefaults());

	return null;
}
 
開發者ID:metasfresh,項目名稱:metasfresh,代碼行數:53,代碼來源:IniDefaultsValidator.java


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