本文整理汇总了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());
}
示例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();
}
}
示例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();
}
}
示例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);
}
示例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);
}
示例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));
}
}
示例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);
}
}
示例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;
}