use of javax.swing.plaf.nimbus.NimbusLookAndFeel 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.nimbus.NimbusLookAndFeel in project jdk8u_jdk by JetBrains.
the class Bug8154069 method main.
public static void main(String[] args) throws Exception {
try {
try {
UIManager.setLookAndFeel(new NimbusLookAndFeel());
} catch (Exception e) {
throw new RuntimeException(e);
}
SwingUtilities.invokeAndWait(() -> {
frame = new JFrame();
String[] petStrings = { "Bird", "Cat" };
JComboBox<String> cb = new JComboBox<>(petStrings);
// select Cat
cb.setSelectedIndex(1);
frame.add(cb);
frame.pack();
try {
cb.setSelectedIndex(-1);
int i = cb.getSelectedIndex();
if (i != -1) {
throw new RuntimeException("getSelectedIndex is not -1");
}
Object o = cb.getSelectedItem();
if (o != null) {
throw new RuntimeException("getSelectedItem is not null");
}
AccessibleContext ac = cb.getAccessibleContext();
AccessibleSelection as = ac.getAccessibleSelection();
int count = as.getAccessibleSelectionCount();
if (count != 0) {
throw new RuntimeException("getAccessibleSelection count is not 0");
}
Accessible a = as.getAccessibleSelection(0);
if (a != null) {
throw new RuntimeException("getAccessibleSelection(0) is not null");
}
} catch (Exception e) {
exception = e;
}
});
if (exception != null) {
System.out.println("Test failed: " + exception.getMessage());
throw exception;
} else {
System.out.println("Test passed.");
}
} finally {
SwingUtilities.invokeAndWait(() -> {
frame.dispose();
});
}
}
use of javax.swing.plaf.nimbus.NimbusLookAndFeel in project jdk8u_jdk by JetBrains.
the class Test6827032 method main.
public static void main(String[] args) throws Exception {
UIManager.setLookAndFeel(new NimbusLookAndFeel());
Robot robot = new Robot();
robot.setAutoDelay(50);
SunToolkit toolkit = (SunToolkit) Toolkit.getDefaultToolkit();
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
createAndShowGUI();
}
});
toolkit.realSync();
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
Component previewPanel = Util.findSubComponent(cc, "javax.swing.colorchooser.DefaultPreviewPanel");
point = previewPanel.getLocationOnScreen();
}
});
point.translate(5, 5);
robot.mouseMove(point.x, point.y);
robot.mousePress(InputEvent.BUTTON1_MASK);
robot.mouseRelease(InputEvent.BUTTON1_MASK);
}
use of javax.swing.plaf.nimbus.NimbusLookAndFeel in project jdk8u_jdk by JetBrains.
the class ColorCustomizationTest method main.
public static void main(String[] args) throws Exception {
nimbus = new NimbusLookAndFeel();
try {
UIManager.setLookAndFeel(nimbus);
} catch (UnsupportedLookAndFeelException e) {
throw new Error("Unable to set Nimbus LAF");
}
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
new ColorCustomizationTest().test();
}
});
}
Aggregations