use of javax.swing.UnsupportedLookAndFeelException in project jdk8u_jdk by JetBrains.
the class bug8033069NoScrollBar method iterateLookAndFeels.
protected static void iterateLookAndFeels(final bug8033069NoScrollBar test) throws Exception {
LookAndFeelInfo[] lafInfo = UIManager.getInstalledLookAndFeels();
for (LookAndFeelInfo info : lafInfo) {
try {
UIManager.setLookAndFeel(info.getClassName());
System.out.println("Look and Feel: " + info.getClassName());
test.runTest();
} catch (UnsupportedLookAndFeelException e) {
System.out.println("Skipping unsupported LaF: " + info);
}
}
}
use of javax.swing.UnsupportedLookAndFeelException 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.UnsupportedLookAndFeelException 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.UnsupportedLookAndFeelException in project JMRI by JMRI.
the class GuiLafPreferencesManager method applyLookAndFeel.
/**
* Apply the existing look and feel.
*/
public void applyLookAndFeel() {
String lafClassName = null;
for (LookAndFeelInfo LAF : UIManager.getInstalledLookAndFeels()) {
if (LAF.getName().equals(this.lookAndFeel)) {
lafClassName = LAF.getClassName();
}
}
log.debug("Look and feel selection \"{}\" ({})", this.lookAndFeel, lafClassName);
if (lafClassName != null) {
if (!lafClassName.equals(UIManager.getLookAndFeel().getClass().getName())) {
log.debug("Apply look and feel \"{}\" ({})", this.lookAndFeel, lafClassName);
try {
UIManager.setLookAndFeel(lafClassName);
} catch (ClassNotFoundException ex) {
log.error("Could not find look and feel \"{}\".", this.lookAndFeel);
} catch (IllegalAccessException | InstantiationException ex) {
log.error("Could not load look and feel \"{}\".", this.lookAndFeel);
} catch (UnsupportedLookAndFeelException ex) {
log.error("Look and feel \"{}\" is not supported on this platform.", this.lookAndFeel);
}
} else {
log.debug("Not updating look and feel {} matching existing look and feel" + lafClassName);
}
}
}
use of javax.swing.UnsupportedLookAndFeelException in project jdk8u_jdk by JetBrains.
the class MenuItemIconTest method main.
public static void main(String[] args) throws Exception {
robot = new Robot();
String name = UIManager.getSystemLookAndFeelClassName();
try {
UIManager.setLookAndFeel(name);
} catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) {
throw new RuntimeException("Test Failed");
}
createUI();
robot.waitForIdle();
executeTest();
if (!"".equals(errorMessage)) {
throw new RuntimeException(errorMessage);
}
}
Aggregations