List of utility methods to do Swing Look and Feel
LookAndFeel | getSystemLAF() get System LAF if (SYSTEM_LAF == null) { try { SYSTEM_LAF = (LookAndFeel) Class.forName(UIManager.getSystemLookAndFeelClassName(), true, Thread.currentThread().getContextClassLoader()).newInstance(); SYSTEM_LAF.initialize(); } catch (Exception e) { throw new IllegalStateException("could not initialize " + UIManager.getSystemLookAndFeelClassName(), e); ... |
void | initLookAndFeel() init Look And Feel String key; Object okey; for (Enumeration e = UIManager.getLookAndFeelDefaults().keys(); e.hasMoreElements();) { okey = e.nextElement(); key = okey.toString(); if (key.endsWith(".font") || key.endsWith("Font")) { UIManager.put(okey, smallFont); UIManager.put("ProgressBar.foreground", pastelBlue); UIManager.put("ProgressBar.background", java.awt.Color.lightGray); UIManager.put("Label.foreground", java.awt.Color.black); |
void | initLookAndFeel() init Look And Feel String key; for (Enumeration e = UIManager.getLookAndFeelDefaults().keys(); e.hasMoreElements();) { key = (String) e.nextElement(); if (key.endsWith(".font") || key.endsWith("Font")) { UIManager.put(key, smallFont); UIManager.put("ProgressBar.foreground", pastelBlue); ... |
void | initLookAndFeel(final String className) Initializes the look and feel and wraps exceptions into a runtime exception. if (SwingUtilities.isEventDispatchThread()) { initLookAndFeelIntern(className); } else { try { SwingUtilities.invokeAndWait(new Runnable() { public void run() { initLookAndFeelIntern(className); }); } catch (final Exception ex) { throw new RuntimeException(ex); |
void | initLookAndFeelIntern(final String className) Initializes the look and feel and wraps exceptions into a runtime exception. try { UIManager.setLookAndFeel(className); } catch (final Exception e) { throw new RuntimeException("Error initializing the Look And Feel!", e); |
void | installLookAndFeel() Look and feel, helper for Schedule#start() and HospitalityMembers#start() . UIManager.LookAndFeelInfo[] lafInfo = UIManager.getInstalledLookAndFeels(); for (int i = 0; i < lafInfo.length; i++) { if (lafInfo[i].getName().equals("Windows")) { try { UIManager.setLookAndFeel(lafInfo[i].getClassName()); } catch (ClassNotFoundException e) { e.printStackTrace(); } catch (InstantiationException e) { ... |
boolean | isAqua() Tests if the look and feel is Aqua or a derivative (e.g. if (isQuaqua()) { return true; Class<?> lafClass = UIManager.getLookAndFeel().getClass(); while (lafClass != null) { if ("com.apple.laf.AquaLookAndFeel".equals(lafClass.getName())) { return true; lafClass = lafClass.getSuperclass(); return false; |
boolean | isAquaLookAndFeel() is Aqua Look And Feel return UIManager.getLookAndFeel().getID().equals("Aqua"); |
boolean | isAquaLookAndFeel() MacOS Look and feel test return System.getProperty("mrj.version") != null && UIManager.getSystemLookAndFeelClassName() .equals(UIManager.getLookAndFeel().getClass().getName()); |
boolean | isAquaLookAndFeel() Determines if current L&F is AquaLookAndFeel return UIManager.getLookAndFeel().getID().equals("Aqua"); |