use of javax.swing.plaf.nimbus.NimbusLookAndFeel in project jdk8u_jdk by JetBrains.
the class bug8057791 method main.
public static void main(String[] args) {
try {
UIManager.setLookAndFeel(new NimbusLookAndFeel());
SwingUtilities.invokeAndWait(new Runnable() {
@Override
public void run() {
final int listWidth = 50;
final int listHeight = 50;
final int selCellIndex = 0;
JList<String> list = new JList<String>();
list.setSize(listWidth, listHeight);
DefaultListModel<String> listModel = new DefaultListModel<String>();
listModel.add(selCellIndex, "E");
list.setModel(listModel);
list.setSelectedIndex(selCellIndex);
BufferedImage img = new BufferedImage(listWidth, listHeight, BufferedImage.TYPE_INT_ARGB);
Graphics g = img.getGraphics();
list.paint(g);
g.dispose();
Rectangle cellRect = list.getCellBounds(selCellIndex, selCellIndex);
HashSet<Color> cellColors = new HashSet<Color>();
int uniqueColorIndex = 0;
for (int x = cellRect.x; x < (cellRect.x + cellRect.width); x++) {
for (int y = cellRect.y; y < (cellRect.y + cellRect.height); y++) {
Color cellColor = new Color(img.getRGB(x, y), true);
if (cellColors.add(cellColor)) {
System.err.println(String.format("Cell color #%d: %s", uniqueColorIndex++, cellColor));
}
}
}
Color selForegroundColor = list.getSelectionForeground();
Color selBackgroundColor = list.getSelectionBackground();
if (!cellColors.contains(new Color(selForegroundColor.getRGB(), true))) {
throw new RuntimeException(String.format("Selected cell is drawn without selection foreground color '%s'.", selForegroundColor));
}
if (!cellColors.contains(new Color(selBackgroundColor.getRGB(), true))) {
throw new RuntimeException(String.format("Selected cell is drawn without selection background color '%s'.", selBackgroundColor));
}
}
});
} catch (UnsupportedLookAndFeelException | InterruptedException | InvocationTargetException e) {
throw new RuntimeException(e);
}
}
use of javax.swing.plaf.nimbus.NimbusLookAndFeel in project jdk8u_jdk by JetBrains.
the class Test6933784 method main.
public static void main(String[] args) throws Exception {
UIManager.setLookAndFeel(new SynthLookAndFeel());
checkImages();
UIManager.setLookAndFeel(new NimbusLookAndFeel());
checkImages();
}
use of javax.swing.plaf.nimbus.NimbusLookAndFeel in project jdk8u_jdk by JetBrains.
the class Test6919629 method main.
public static void main(String[] args) throws Exception {
UIManager.setLookAndFeel(new NimbusLookAndFeel());
Test6919629 t = new Test6919629();
t.test();
System.gc();
t.check();
}
use of javax.swing.plaf.nimbus.NimbusLookAndFeel in project jdk8u_jdk by JetBrains.
the class Test7048204 method main.
public static void main(String[] args) throws Exception {
UIManager.setLookAndFeel(new NimbusLookAndFeel());
SwingUtilities.invokeAndWait(new Runnable() {
public void run() {
new JLabel();
UIDefaults uid = UIManager.getDefaults();
uid.putDefaults(new Object[0]);
uid.put("what.ever", "else");
}
});
}
use of javax.swing.plaf.nimbus.NimbusLookAndFeel in project jgnash by ccavanaugh.
the class ThemeManager method getNimbusFontSize.
public static int getNimbusFontSize() {
Preferences p = Preferences.userNodeForPackage(ThemeManager.class);
int preferredSize = p.getInt(NIMBUS_FONT_SIZE, 0);
// and save it
if (preferredSize == 0) {
LookAndFeel old = UIManager.getLookAndFeel();
try {
UIManager.setLookAndFeel(new NimbusLookAndFeel());
preferredSize = NimbusUtils.getBaseFontSize();
p.putInt(NIMBUS_FONT_SIZE, preferredSize);
UIManager.setLookAndFeel(old);
} catch (Exception e) {
Logger.getLogger(ThemeManager.class.getName()).log(Level.SEVERE, e.toString(), e);
}
}
return preferredSize;
}
Aggregations