Java Code Examples for javax.swing.UIManager.LookAndFeelInfo

The following are top voted examples for showing how to use javax.swing.UIManager.LookAndFeelInfo. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: Kaeon-FUSION   File: IDE.java   View source code 7 votes vote down vote up
public static void initializeLookAndFeel() {

		try {

			for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {

				if ("Nimbus".equals(info.getName())) {
					UIManager.setLookAndFeel(info.getClassName());
					break;
				}
			}
		}

		catch (Exception exception) {

		}
	}
 
Example 2
Project: jdk8u-jdk   File: TableExample.java   View source code 7 votes vote down vote up
public static void main(String s[]) {
    // Trying to set Nimbus look and feel
    try {
        for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
            if ("Nimbus".equals(info.getName())) {
                UIManager.setLookAndFeel(info.getClassName());
                break;
            }
        }
    } catch (Exception ex) {
        Logger.getLogger(TableExample.class.getName()).log(Level.SEVERE,
                "Failed to apply Nimbus look and feel", ex);
    }

    new TableExample();
}
 
Example 3
Project: JDigitalSimulator   File: Guitilities.java   View source code 6 votes vote down vote up
public static boolean setLookAndFeel(String classname, String name) {
	if((classname==null||classname.isEmpty())&&(name==null||name.isEmpty()))
		return false;
	try {
		UIManager.setLookAndFeel(classname);
		usingNimbusLookAndFeel = UIManager.getLookAndFeel().getName().equals("Nimbus");
		return true;
	}	catch(Exception e_a) {
		try {
			for(LookAndFeelInfo look_and_feel:UIManager.getInstalledLookAndFeels())
				if(name.equals(look_and_feel.getName())) {
					UIManager.setLookAndFeel(look_and_feel.getClassName());
					usingNimbusLookAndFeel = UIManager.getLookAndFeel().getName().equals("Nimbus");
					return true;
				}
		} catch(Exception e_b) {}
	}
	return false;
}
 
Example 4
Project: OpenJSharp   File: TableExample2.java   View source code 6 votes vote down vote up
public static void main(String[] args) {
    if (args.length != 5) {
        System.err.println("Needs database parameters eg. ...");
        System.err.println(
                "java TableExample2 \"jdbc:derby://localhost:1527/sample\" "
                + "org.apache.derby.jdbc.ClientDriver app app "
                + "\"select * from app.customer\"");
        return;
    }

    // Trying to set Nimbus look and feel
    try {
        for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
            if ("Nimbus".equals(info.getName())) {
                UIManager.setLookAndFeel(info.getClassName());
                break;
            }
        }
    } catch (Exception ex) {
        Logger.getLogger(TableExample2.class.getName()).log(Level.SEVERE,
                "Failed to apply Nimbus look and feel", ex);
    }

    new TableExample2(args[0], args[1], args[2], args[3], args[4]);
}
 
Example 5
Project: OpenJSharp   File: TableExample.java   View source code 6 votes vote down vote up
public static void main(String s[]) {
    // Trying to set Nimbus look and feel
    try {
        for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
            if ("Nimbus".equals(info.getName())) {
                UIManager.setLookAndFeel(info.getClassName());
                break;
            }
        }
    } catch (Exception ex) {
        Logger.getLogger(TableExample.class.getName()).log(Level.SEVERE,
                "Failed to apply Nimbus look and feel", ex);
    }

    new TableExample();
}
 
Example 6
Project: jdk8u-jdk   File: TableExample2.java   View source code 6 votes vote down vote up
public static void main(String[] args) {
    if (args.length != 5) {
        System.err.println("Needs database parameters eg. ...");
        System.err.println(
                "java TableExample2 \"jdbc:derby://localhost:1527/sample\" "
                + "org.apache.derby.jdbc.ClientDriver app app "
                + "\"select * from app.customer\"");
        return;
    }

    // Trying to set Nimbus look and feel
    try {
        for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
            if ("Nimbus".equals(info.getName())) {
                UIManager.setLookAndFeel(info.getClassName());
                break;
            }
        }
    } catch (Exception ex) {
        Logger.getLogger(TableExample2.class.getName()).log(Level.SEVERE,
                "Failed to apply Nimbus look and feel", ex);
    }

    new TableExample2(args[0], args[1], args[2], args[3], args[4]);
}
 
Example 7
Project: jdk8u-jdk   File: TableExample4.java   View source code 6 votes vote down vote up
public static void main(String[] args) {
    // Trying to set Nimbus look and feel
    try {
        for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
            if ("Nimbus".equals(info.getName())) {
                UIManager.setLookAndFeel(info.getClassName());
                break;
            }
        }
    } catch (Exception ex) {
        Logger.getLogger(TableExample4.class.getName()).log(Level.SEVERE,
                "Failed to apply Nimbus look and feel", ex);
    }

    new TableExample4();
}
 
Example 8
Project: jdk8u-jdk   File: bug8080628.java   View source code 6 votes vote down vote up
private static void runTest() {
    try {
        LookAndFeelInfo[] lafInfo = UIManager.getInstalledLookAndFeels();
        for (LookAndFeelInfo info : lafInfo) {
            UIManager.setLookAndFeel(info.getClassName());

            for (Locale locale : LOCALES) {
                for (String key : MNEMONIC_KEYS) {
                    int mnemonic = SwingUtilities2.getUIDefaultsInt(key, locale);
                    if (mnemonic != 0) {
                        throw new RuntimeException("No mnemonic expected (" + mnemonic + ") " +
                                "for '" + key + "' " +
                                "in locale '" + locale + "' " +
                                "in Look-and-Feel '"
                                    + UIManager.getLookAndFeel().getClass().getName() + "'");
                    }
                }
            }
        }
        System.out.println("Test passed");
    } catch (Exception e) {
        exception = e;
    }
}
 
Example 9
Project: openjdk-jdk10   File: TableExample2.java   View source code 6 votes vote down vote up
public static void main(String[] args) {
    if (args.length != 5) {
        System.err.println("Needs database parameters eg. ...");
        System.err.println(
                "java TableExample2 \"jdbc:derby://localhost:1527/sample\" "
                + "org.apache.derby.jdbc.ClientDriver app app "
                + "\"select * from app.customer\"");
        return;
    }

    // Trying to set Nimbus look and feel
    try {
        for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
            if ("Nimbus".equals(info.getName())) {
                UIManager.setLookAndFeel(info.getClassName());
                break;
            }
        }
    } catch (Exception ex) {
        Logger.getLogger(TableExample2.class.getName()).log(Level.SEVERE,
                "Failed to apply Nimbus look and feel", ex);
    }

    new TableExample2(args[0], args[1], args[2], args[3], args[4]);
}
 
Example 10
Project: openjdk-jdk10   File: TableExample4.java   View source code 6 votes vote down vote up
public static void main(String[] args) {
    // Trying to set Nimbus look and feel
    try {
        for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
            if ("Nimbus".equals(info.getName())) {
                UIManager.setLookAndFeel(info.getClassName());
                break;
            }
        }
    } catch (Exception ex) {
        Logger.getLogger(TableExample4.class.getName()).log(Level.SEVERE,
                "Failed to apply Nimbus look and feel", ex);
    }

    new TableExample4();
}
 
Example 11
Project: openjdk-jdk10   File: TableExample.java   View source code 6 votes vote down vote up
public static void main(String s[]) {
    // Trying to set Nimbus look and feel
    try {
        for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
            if ("Nimbus".equals(info.getName())) {
                UIManager.setLookAndFeel(info.getClassName());
                break;
            }
        }
    } catch (Exception ex) {
        Logger.getLogger(TableExample.class.getName()).log(Level.SEVERE,
                "Failed to apply Nimbus look and feel", ex);
    }

    new TableExample();
}
 
Example 12
Project: openjdk-jdk10   File: bug8080628.java   View source code 6 votes vote down vote up
private static void runTest() {
    try {
        LookAndFeelInfo[] lafInfo = UIManager.getInstalledLookAndFeels();
        for (LookAndFeelInfo info : lafInfo) {
            UIManager.setLookAndFeel(info.getClassName());

            for (Locale locale : LOCALES) {
                for (String key : MNEMONIC_KEYS) {
                    int mnemonic = SwingUtilities2.getUIDefaultsInt(key, locale);
                    if (mnemonic != 0) {
                        throw new RuntimeException("No mnemonic expected (" + mnemonic + ") " +
                                "for '" + key + "' " +
                                "in locale '" + locale + "' " +
                                "in Look-and-Feel '"
                                    + UIManager.getLookAndFeel().getClass().getName() + "'");
                    }
                }
            }
        }
        System.out.println("Test passed");
    } catch (Exception e) {
        exception = e;
    }
}
 
Example 13
Project: openjdk-jdk10   File: UnninstallUIMemoryLeaks.java   View source code 6 votes vote down vote up
public static void main(final String[] args) throws Exception {
    try {
        createGUI();
        for (final LookAndFeelInfo laf : getInstalledLookAndFeels()) {
            final String name = laf.getName();
            if (name.contains("OS X") || name.contains("Metal")) {
                SwingUtilities.invokeAndWait(() -> setLookAndFeel(laf));
                SwingUtilities.invokeAndWait(() -> {
                    for (int i = 0; i < 4000; ++i) {
                        SwingUtilities.updateComponentTreeUI(frame);
                    }
                });
            }
        }
    } finally {
        if (frame != null) { EventQueue.invokeAndWait(() -> frame.dispose()); }
    }
}
 
Example 14
Project: openjdk-jdk10   File: Test7024235.java   View source code 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    Test7024235 test = new Test7024235();
    for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
        UIManager.setLookAndFeel(info.getClassName());

        test.test();
        try {
            ExtendedRobot robot = new ExtendedRobot();
            robot.waitForIdle(1000);
        }catch(Exception ex) {
            ex.printStackTrace();
            throw new Error("Unexpected Failure");
        }
        test.test();
    }
}
 
Example 15
Project: openjdk9   File: TableExample2.java   View source code 6 votes vote down vote up
public static void main(String[] args) {
    if (args.length != 5) {
        System.err.println("Needs database parameters eg. ...");
        System.err.println(
                "java TableExample2 \"jdbc:derby://localhost:1527/sample\" "
                + "org.apache.derby.jdbc.ClientDriver app app "
                + "\"select * from app.customer\"");
        return;
    }

    // Trying to set Nimbus look and feel
    try {
        for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
            if ("Nimbus".equals(info.getName())) {
                UIManager.setLookAndFeel(info.getClassName());
                break;
            }
        }
    } catch (Exception ex) {
        Logger.getLogger(TableExample2.class.getName()).log(Level.SEVERE,
                "Failed to apply Nimbus look and feel", ex);
    }

    new TableExample2(args[0], args[1], args[2], args[3], args[4]);
}
 
Example 16
Project: openjdk9   File: TableExample4.java   View source code 6 votes vote down vote up
public static void main(String[] args) {
    // Trying to set Nimbus look and feel
    try {
        for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
            if ("Nimbus".equals(info.getName())) {
                UIManager.setLookAndFeel(info.getClassName());
                break;
            }
        }
    } catch (Exception ex) {
        Logger.getLogger(TableExample4.class.getName()).log(Level.SEVERE,
                "Failed to apply Nimbus look and feel", ex);
    }

    new TableExample4();
}
 
Example 17
Project: openjdk9   File: TableExample.java   View source code 6 votes vote down vote up
public static void main(String s[]) {
    // Trying to set Nimbus look and feel
    try {
        for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
            if ("Nimbus".equals(info.getName())) {
                UIManager.setLookAndFeel(info.getClassName());
                break;
            }
        }
    } catch (Exception ex) {
        Logger.getLogger(TableExample.class.getName()).log(Level.SEVERE,
                "Failed to apply Nimbus look and feel", ex);
    }

    new TableExample();
}
 
Example 18
Project: openjdk9   File: bug8080628.java   View source code 6 votes vote down vote up
private static void runTest() {
    try {
        LookAndFeelInfo[] lafInfo = UIManager.getInstalledLookAndFeels();
        for (LookAndFeelInfo info : lafInfo) {
            UIManager.setLookAndFeel(info.getClassName());

            for (Locale locale : LOCALES) {
                for (String key : MNEMONIC_KEYS) {
                    int mnemonic = SwingUtilities2.getUIDefaultsInt(key, locale);
                    if (mnemonic != 0) {
                        throw new RuntimeException("No mnemonic expected (" + mnemonic + ") " +
                                "for '" + key + "' " +
                                "in locale '" + locale + "' " +
                                "in Look-and-Feel '"
                                    + UIManager.getLookAndFeel().getClass().getName() + "'");
                    }
                }
            }
        }
        System.out.println("Test passed");
    } catch (Exception e) {
        exception = e;
    }
}
 
Example 19
Project: openjdk9   File: UnninstallUIMemoryLeaks.java   View source code 6 votes vote down vote up
public static void main(final String[] args) throws Exception {
    try {
        createGUI();
        for (final LookAndFeelInfo laf : getInstalledLookAndFeels()) {
            final String name = laf.getName();
            if (name.contains("OS X") || name.contains("Metal")) {
                SwingUtilities.invokeAndWait(() -> setLookAndFeel(laf));
                SwingUtilities.invokeAndWait(() -> {
                    for (int i = 0; i < 4000; ++i) {
                        SwingUtilities.updateComponentTreeUI(frame);
                    }
                });
            }
        }
    } finally {
        EventQueue.invokeAndWait(() -> frame.dispose());
    }
}
 
Example 20
Project: openjdk9   File: Test7024235.java   View source code 6 votes vote down vote up
public static void main(String[] args) throws Exception {
    Test7024235 test = new Test7024235();
    for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
        UIManager.setLookAndFeel(info.getClassName());

        test.test();
        try {
            ExtendedRobot robot = new ExtendedRobot();
            robot.waitForIdle(1000);
        }catch(Exception ex) {
            ex.printStackTrace();
            throw new Error("Unexpected Failure");
        }
        test.test();
    }
}
 
Example 21
Project: spasm   File: AnalyticsGUI.java   View source code 6 votes vote down vote up
public static void main(String[] args) {
    // Try to use the "Nimbus" Look and Feel for Java. This is purely aesthetic.
    try {
        for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
            if ("Nimbus".equals(info.getName())) {
                UIManager.setLookAndFeel(info.getClassName());
                break;
            }
        }
    } catch (Exception e) {
        // If the Nimbus styling is not available, we fall back to normal styling
    }
    JFrame frame = new JFrame("Twitch Chat Analytics");
    frame.setContentPane(new AnalyticsGUI(frame).analyticsPanel);
    frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
    frame.setLocationRelativeTo(null);
    frame.pack();
    frame.setVisible(true);
}
 
Example 22
Project: Library-of-Kaeon   File: IDE.java   View source code 6 votes vote down vote up
public static void initializeLookAndFeel() {

		try {

			for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {

				if ("Nimbus".equals(info.getName())) {
					UIManager.setLookAndFeel(info.getClassName());
					break;
				}
			}
		}

		catch (Exception exception) {

		}
	}
 
Example 23
Project: scelight   File: LGuiUtils.java   View source code 6 votes vote down vote up
/**
 * Sets the Look And Feel specified by its name.
 * 
 * <p>
 * This method does not log in case of errors, so can be called before the logger is initialized.
 * </p>
 * 
 * @param lafName name of the Look And Feel to be set
 * @return the exception if any was thrown while setting the specified Look and Feel
 */
public static Exception setLaf( final String lafName ) {
	final Holder< Exception > exception = new Holder< >();
	runInEDT( new Runnable() {
		@Override
		public void run() {
			for ( final LookAndFeelInfo lookAndFeelInfo : UIManager.getInstalledLookAndFeels() )
				if ( lafName.equals( lookAndFeelInfo.getName() ) ) {
					try {
						UIManager.setLookAndFeel( lookAndFeelInfo.getClassName() );
					} catch ( final Exception e ) {
						exception.value = e;
					}
					break;
				}
		}
	} );
	
	return exception.value;
}
 
Example 24
Project: jdk8u_jdk   File: TableExample2.java   View source code 6 votes vote down vote up
public static void main(String[] args) {
    if (args.length != 5) {
        System.err.println("Needs database parameters eg. ...");
        System.err.println(
                "java TableExample2 \"jdbc:derby://localhost:1527/sample\" "
                + "org.apache.derby.jdbc.ClientDriver app app "
                + "\"select * from app.customer\"");
        return;
    }

    // Trying to set Nimbus look and feel
    try {
        for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
            if ("Nimbus".equals(info.getName())) {
                UIManager.setLookAndFeel(info.getClassName());
                break;
            }
        }
    } catch (Exception ex) {
        Logger.getLogger(TableExample2.class.getName()).log(Level.SEVERE,
                "Failed to apply Nimbus look and feel", ex);
    }

    new TableExample2(args[0], args[1], args[2], args[3], args[4]);
}
 
Example 25
Project: jdk8u_jdk   File: TableExample4.java   View source code 6 votes vote down vote up
public static void main(String[] args) {
    // Trying to set Nimbus look and feel
    try {
        for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
            if ("Nimbus".equals(info.getName())) {
                UIManager.setLookAndFeel(info.getClassName());
                break;
            }
        }
    } catch (Exception ex) {
        Logger.getLogger(TableExample4.class.getName()).log(Level.SEVERE,
                "Failed to apply Nimbus look and feel", ex);
    }

    new TableExample4();
}
 
Example 26
Project: jdk8u_jdk   File: TableExample.java   View source code 6 votes vote down vote up
public static void main(String s[]) {
    // Trying to set Nimbus look and feel
    try {
        for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
            if ("Nimbus".equals(info.getName())) {
                UIManager.setLookAndFeel(info.getClassName());
                break;
            }
        }
    } catch (Exception ex) {
        Logger.getLogger(TableExample.class.getName()).log(Level.SEVERE,
                "Failed to apply Nimbus look and feel", ex);
    }

    new TableExample();
}
 
Example 27
Project: jdk8u_jdk   File: bug8080628.java   View source code 6 votes vote down vote up
private static void runTest() {
    try {
        LookAndFeelInfo[] lafInfo = UIManager.getInstalledLookAndFeels();
        for (LookAndFeelInfo info : lafInfo) {
            UIManager.setLookAndFeel(info.getClassName());

            for (Locale locale : LOCALES) {
                for (String key : MNEMONIC_KEYS) {
                    int mnemonic = SwingUtilities2.getUIDefaultsInt(key, locale);
                    if (mnemonic != 0) {
                        throw new RuntimeException("No mnemonic expected (" + mnemonic + ") " +
                                "for '" + key + "' " +
                                "in locale '" + locale + "' " +
                                "in Look-and-Feel '"
                                    + UIManager.getLookAndFeel().getClass().getName() + "'");
                    }
                }
            }
        }
        System.out.println("Test passed");
    } catch (Exception e) {
        exception = e;
    }
}
 
Example 28
Project: taxonaut   File: LookAndFeelMenuItem.java   View source code 6 votes vote down vote up
protected void updateLookAndFeels()
   {
clearButtons();
LookAndFeel currentLookAndFeel = UIManager.getLookAndFeel();
String current = currentLookAndFeel == null ? "" : currentLookAndFeel.getName();
LookAndFeelInfo[] infoArray = UIManager.getInstalledLookAndFeels();
if (infoArray == null || infoArray.length == 0) {
    return;
}

for (LookAndFeelInfo info : infoArray) {
    JRadioButtonMenuItem button = new JRadioButtonMenuItem(info.getName());
    button.setActionCommand(info.getClassName());
    if (info.getName().equals(current))
	button.setSelected(true);
    addButton(button);
}
   }
 
Example 29
Project: littleluck   File: SwingSet3.java   View source code 6 votes vote down vote up
protected JMenu createLookAndFeelMenu() {
        JMenu menu = new LuckMenu();
        menu.setOpaque(true);
//        menu.setBackground(Color.white);
        menu.setName("lookAndFeel");
        
        // Look for toolkit look and feels first
        UIManager.LookAndFeelInfo lookAndFeelInfos[] = UIManager.getInstalledLookAndFeels();
        lookAndFeel = UIManager.getLookAndFeel().getClass().getName();
        lookAndFeelRadioGroup = new ButtonGroup();
        for(UIManager.LookAndFeelInfo lafInfo: lookAndFeelInfos) {
            menu.add(createLookAndFeelItem(lafInfo.getName(), lafInfo.getClassName()));
        }  
        // Now load any look and feels defined externally as service via java.util.ServiceLoader
        LOOK_AND_FEEL_LOADER.iterator();
        for (LookAndFeel laf : LOOK_AND_FEEL_LOADER) {           
            menu.add(createLookAndFeelItem(laf.getName(), laf.getClass().getName()));
        }
         
        return menu;
    }
 
Example 30
Project: ublu   File: My5250.java   View source code 6 votes vote down vote up
/**
 * we only want to try and load the Nimbus look and feel if it is not
 * for the MAC operating system.
 */
private void loadLookAndFeel() {
	try  {
		for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
			if ("Nimbus".equals(info.getName())) {
				UIManager.setLookAndFeel(info.getClassName());
				break;
			}
		}
	}
	catch(Exception e) {
		try {
			UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
		} catch (Exception ex) {
			// we don't care. Cause this should always work.
		}
	}
}
 
Example 31
Project: lookaside_java-1.8.0-openjdk   File: TableExample2.java   View source code 6 votes vote down vote up
public static void main(String[] args) {
    if (args.length != 5) {
        System.err.println("Needs database parameters eg. ...");
        System.err.println(
                "java TableExample2 \"jdbc:derby://localhost:1527/sample\" "
                + "org.apache.derby.jdbc.ClientDriver app app "
                + "\"select * from app.customer\"");
        return;
    }

    // Trying to set Nimbus look and feel
    try {
        for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
            if ("Nimbus".equals(info.getName())) {
                UIManager.setLookAndFeel(info.getClassName());
                break;
            }
        }
    } catch (Exception ex) {
        Logger.getLogger(TableExample2.class.getName()).log(Level.SEVERE,
                "Failed to apply Nimbus look and feel", ex);
    }

    new TableExample2(args[0], args[1], args[2], args[3], args[4]);
}
 
Example 32
Project: lookaside_java-1.8.0-openjdk   File: TableExample4.java   View source code 6 votes vote down vote up
public static void main(String[] args) {
    // Trying to set Nimbus look and feel
    try {
        for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
            if ("Nimbus".equals(info.getName())) {
                UIManager.setLookAndFeel(info.getClassName());
                break;
            }
        }
    } catch (Exception ex) {
        Logger.getLogger(TableExample4.class.getName()).log(Level.SEVERE,
                "Failed to apply Nimbus look and feel", ex);
    }

    new TableExample4();
}
 
Example 33
Project: lookaside_java-1.8.0-openjdk   File: TableExample.java   View source code 6 votes vote down vote up
public static void main(String s[]) {
    // Trying to set Nimbus look and feel
    try {
        for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
            if ("Nimbus".equals(info.getName())) {
                UIManager.setLookAndFeel(info.getClassName());
                break;
            }
        }
    } catch (Exception ex) {
        Logger.getLogger(TableExample.class.getName()).log(Level.SEVERE,
                "Failed to apply Nimbus look and feel", ex);
    }

    new TableExample();
}
 
Example 34
Project: lookaside_java-1.8.0-openjdk   File: bug8080628.java   View source code 6 votes vote down vote up
private static void runTest() {
    try {
        LookAndFeelInfo[] lafInfo = UIManager.getInstalledLookAndFeels();
        for (LookAndFeelInfo info : lafInfo) {
            UIManager.setLookAndFeel(info.getClassName());

            for (Locale locale : LOCALES) {
                for (String key : MNEMONIC_KEYS) {
                    int mnemonic = SwingUtilities2.getUIDefaultsInt(key, locale);
                    if (mnemonic != 0) {
                        throw new RuntimeException("No mnemonic expected (" + mnemonic + ") " +
                                "for '" + key + "' " +
                                "in locale '" + locale + "' " +
                                "in Look-and-Feel '"
                                    + UIManager.getLookAndFeel().getClass().getName() + "'");
                    }
                }
            }
        }
        System.out.println("Test passed");
    } catch (Exception e) {
        exception = e;
    }
}
 
Example 35
Project: cmoct-sourcecode   File: EditableLAFControler.java   View source code 6 votes vote down vote up
public void createLAF()
{
	int num = 0;

	LookAndFeelInfo lafs[] = UIManager.getInstalledLookAndFeels();

	for (int i = 0; i < lafs.length; i++)
	{
		lafTitle.put(i, lafs[i].getName());
	}

	lafTitle.put(lafs.length + 0, "Nimrod");
	lafTitle.put(lafs.length + 1, "Nimrod - Burdeos");
	lafTitle.put(lafs.length + 2, "Nimrod - DarkGrey");
	lafTitle.put(lafs.length + 3, "Nimrod - DarkTabaco");
	lafTitle.put(lafs.length + 4, "Nimrod - LightTabaco");
	lafTitle.put(lafs.length + 5, "Nimrod - Night");
	lafTitle.put(lafs.length + 6, "Nimrod - Snow");

	lafOptions = new JComboBox(lafTitle.values().toArray(new String[0]));
}
 
Example 36
Project: Health   File: GUImain.java   View source code 6 votes vote down vote up
/**
 * Sets look and feel of the application.
 * @param name
 *            Name of the lookandfeel
 * @throws UnsupportedLookAndFeelException
 * @throws IllegalAccessException
 * @throws InstantiationException
 * @throws ClassNotFoundException
 */
protected void setLookAndFeel(final String name)
        throws ClassNotFoundException, InstantiationException,
        IllegalAccessException, UnsupportedLookAndFeelException {
    boolean lafFound = false;
    for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
        if (name.equals(info.getName())) {
            UIManager.setLookAndFeel(info.getClassName());
            lafFound = true;
            break;
        }
    }
    if (!lafFound) {
        UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
    }
}
 
Example 37
Project: swingx   File: GTKTest.java   View source code 6 votes vote down vote up
@BeforeClass
public static void beforeClass() {
    // This test will not work in a headless configuration.
    // need to check before trying to install GTK (any LAF?)
    if (GraphicsEnvironment.isHeadless()) {
        LOG.fine("cannot run ui test - headless environment");
        return;
    }
    
    LookAndFeelInfo info = new LookAndFeelInfo("GTK plain",
            "com.sun.java.swing.plaf.gtk.GTKLookAndFeel");
    try {
        UIManager.installLookAndFeel(info);
        InteractiveTestCase.setLookAndFeel("GTK");
        hasGTK = true;
        // force loading of addons
        new JXTable();
        new JXList();
        
    } catch (Exception e) {
        // nothing to do - tests will be ignored;
    }
}
 
Example 38
Project: JetUML   File: UMLEditor.java   View source code 6 votes vote down vote up
private static void setLookAndFeel()
{
	try
	{
		for(LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) 
		{
			if("Nimbus".equals(info.getName())) 
			{
	            UIManager.setLookAndFeel(info.getClassName());
	            break;
	        }
	    }
	} 
	catch(UnsupportedLookAndFeelException | IllegalAccessException | InstantiationException | ClassNotFoundException e) 
	{
	    // Nothing: We revert to the default LAF
	}
}
 
Example 39
Project: ATM-System   File: main.java   View source code 6 votes vote down vote up
public static void main(String[] args) {
		try {
		    for (LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) {
		        if ("Nimbus".equals(info.getName())) {
		            UIManager.setLookAndFeel(info.getClassName());
		            break;
		        }
		    }
		} catch (Exception e) {
		    // If Nimbus is not available, you can set the GUI to another look and feel.
		}
		Bank aBank = new Bank();
		LogIn login = new LogIn(aBank);
		ATM atm1 = new ATM(aBank);
//		aBank.addAccount(new Account("����","b00001","A10546","458712",
//				new BankAccount("123456",15000,5000)));
//		aBank.addAccount(new Account("�p�E","b00002","A12608","453354",
//				new BankAccount("231897",13534,1200)));
		LogInFrame loginFrame = new LogInFrame(login, atm1);
	}
 
Example 40
Project: sc2gears   File: GuiUtils.java   View source code 6 votes vote down vote up
/**
 * Tries to set the specified Look and Feel.
 * @param name name of the look and feel to be loaded
 * @return true if the LAF was set successfully, false otherwise
 */
public static boolean setLAF( final String lafName ) {
	for ( final LookAndFeelInfo lookAndFeelInfo : UIManager.getInstalledLookAndFeels() )
		if ( lookAndFeelInfo.getName().equals( lafName ) )
			try {
				UIManager.setLookAndFeel( lookAndFeelInfo.getClassName() );
				
				return true;
			} catch ( final Exception e ) {
				System.err.println( "Failed to set " + lookAndFeelInfo.getName() + " look and feel!" );
				e.printStackTrace( System.err );
				return false;
			}
	
	System.err.println( lafName + " look and feel was not found!" );
	
	return false;
}