use of javax.swing.plaf.metal.MetalLookAndFeel in project jdk8u_jdk by JetBrains.
the class Metalworks method main.
public static void main(String[] args) {
UIManager.put("swing.boldMetal", Boolean.FALSE);
JDialog.setDefaultLookAndFeelDecorated(true);
JFrame.setDefaultLookAndFeelDecorated(true);
Toolkit.getDefaultToolkit().setDynamicLayout(true);
System.setProperty("sun.awt.noerasebackground", "true");
try {
UIManager.setLookAndFeel(new MetalLookAndFeel());
} catch (UnsupportedLookAndFeelException e) {
System.out.println("Metal Look & Feel not supported on this platform. \n" + "Program Terminated");
System.exit(0);
}
JFrame frame = new MetalworksFrame();
frame.setVisible(true);
}
use of javax.swing.plaf.metal.MetalLookAndFeel in project jdk8u_jdk by JetBrains.
the class bug7170310 method main.
public static void main(String[] args) throws Exception {
try {
UIManager.setLookAndFeel(new MetalLookAndFeel());
SwingUtilities.invokeAndWait(bug7170310::createAndShowUI);
SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
toolkit.realSync();
for (int i = 0; i < TABS_NUMBER; i++) {
SwingUtilities.invokeAndWait(bug7170310::addTab);
toolkit.realSync();
}
SwingUtilities.invokeAndWait(bug7170310::check);
if (exception != null) {
System.out.println("Test failed: " + exception.getMessage());
throw exception;
} else {
System.out.printf("Test passed");
}
} finally {
frame.dispose();
}
}
use of javax.swing.plaf.metal.MetalLookAndFeel in project jdk8u_jdk by JetBrains.
the class bug8048506 method main.
public static void main(String[] args) throws Exception {
UIManager.setLookAndFeel(new MetalLookAndFeel());
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
createAndShowGUI();
}
});
System.out.println("The test passed");
}
use of javax.swing.plaf.metal.MetalLookAndFeel in project jgnash by ccavanaugh.
the class ThemeManager method setLookAndFeel.
private static void setLookAndFeel(final String lookAndFeel) {
Preferences pref = Preferences.userNodeForPackage(ThemeManager.class);
String theme = pref.get(THEME, DEFAULT_THEME);
try {
Class<?> lafClass = Class.forName(lookAndFeel);
Object lafInstance = lafClass.newInstance();
if (lafInstance instanceof SubstanceSkin) {
UIManager.put(SubstanceLookAndFeel.SHOW_EXTRA_WIDGETS, Boolean.TRUE);
if (isSubstanceAnimationsEnabled()) {
AnimationConfigurationManager.getInstance().setTimelineDuration(animationDuration);
} else {
AnimationConfigurationManager.getInstance().setTimelineDuration(0);
}
SubstanceLookAndFeel.setSkin(lookAndFeel);
} else if (lafInstance instanceof NimbusLookAndFeel) {
UIManager.setLookAndFeel((LookAndFeel) lafInstance);
NimbusUtils.changeFontSize(getNimbusFontSize());
} else if (lafInstance instanceof MetalLookAndFeel) {
UIManager.setLookAndFeel((LookAndFeel) lafInstance);
setTheme(theme);
} else if (lafInstance instanceof LookAndFeel) {
UIManager.setLookAndFeel((LookAndFeel) lafInstance);
}
} catch (final ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) {
Logger.getLogger(ThemeManager.class.getName()).log(Level.WARNING, null, e);
}
}
use of javax.swing.plaf.metal.MetalLookAndFeel in project intellij-community by JetBrains.
the class LafManagerImpl method setCurrentLookAndFeel.
/**
* Sets current LAF. The method doesn't update component hierarchy.
*/
@Override
public void setCurrentLookAndFeel(UIManager.LookAndFeelInfo lookAndFeelInfo) {
if (findLaf(lookAndFeelInfo.getClassName()) == null) {
LOG.error("unknown LookAndFeel : " + lookAndFeelInfo);
return;
}
// Set L&F
if (IdeaLookAndFeelInfo.CLASS_NAME.equals(lookAndFeelInfo.getClassName())) {
// that is IDEA default LAF
IdeaLaf laf = new IdeaLaf();
MetalLookAndFeel.setCurrentTheme(new IdeaBlueMetalTheme());
try {
UIManager.setLookAndFeel(laf);
} catch (Exception e) {
Messages.showMessageDialog(IdeBundle.message("error.cannot.set.look.and.feel", lookAndFeelInfo.getName(), e.getMessage()), CommonBundle.getErrorTitle(), Messages.getErrorIcon());
return;
}
} else if (DarculaLookAndFeelInfo.CLASS_NAME.equals(lookAndFeelInfo.getClassName())) {
DarculaLaf laf = new DarculaLaf();
try {
UIManager.setLookAndFeel(laf);
JBColor.setDark(true);
IconLoader.setUseDarkIcons(true);
} catch (Exception e) {
Messages.showMessageDialog(IdeBundle.message("error.cannot.set.look.and.feel", lookAndFeelInfo.getName(), e.getMessage()), CommonBundle.getErrorTitle(), Messages.getErrorIcon());
return;
}
} else {
// non default LAF
try {
LookAndFeel laf = ((LookAndFeel) Class.forName(lookAndFeelInfo.getClassName()).newInstance());
if (laf instanceof MetalLookAndFeel) {
MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme());
}
UIManager.setLookAndFeel(laf);
} catch (Exception e) {
Messages.showMessageDialog(IdeBundle.message("error.cannot.set.look.and.feel", lookAndFeelInfo.getName(), e.getMessage()), CommonBundle.getErrorTitle(), Messages.getErrorIcon());
return;
}
}
myCurrentLaf = ObjectUtils.chooseNotNull(findLaf(lookAndFeelInfo.getClassName()), lookAndFeelInfo);
checkLookAndFeel(lookAndFeelInfo, false);
}
Aggregations