本文整理汇总了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);
}
}
示例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);
}
示例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);
}
示例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();
}
}
示例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);
}
}
示例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;
}
示例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);
}
}
}
示例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);
}
示例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);
}
示例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);
}
}
示例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);
}
}
示例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();
}
示例13: enable
import javax.swing.plaf.metal.MetalLookAndFeel; //导入方法依赖的package包/类
public static void enable() {
MetalLookAndFeel.setCurrentTheme(new SilverOceanTheme());
}
示例14: actionPerformed
import javax.swing.plaf.metal.MetalLookAndFeel; //导入方法依赖的package包/类
public void actionPerformed(ActionEvent e) {
MetalLookAndFeel.setCurrentTheme(theme);
swingset.updateLookAndFeel();
}
示例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);
}
}