List of utility methods to do Swing Look and Feel
UIManager.LookAndFeelInfo[] | getInstalledLookAndFeels() get Installed Look And Feels UIManager.LookAndFeelInfo[] info = UIManager.getInstalledLookAndFeels();
return info;
|
String | getLAF(int lafNumber) get LAF String ThemeSelected; switch (lafNumber) { case 1: ThemeSelected = UIManager.getSystemLookAndFeelClassName(); break; case 2: ThemeSelected = "javax.swing.plaf.metal.MetalLookAndFeel"; break; ... |
String | getLafClassName(String lafName) Returns the class name of the LookAndFile class with the specified name, or null if no such class if found. if (lafName == null) return null; for (LookAndFeelInfo lafInfo : availableLookAndFeels) if (lafName.equalsIgnoreCase(lafInfo.getName())) return lafInfo.getClassName(); return null; |
String | getLookAndFeel(final String displayName) Returns the class name of the look and feel from its display name. if (displayName == null || displayName.isEmpty() || "Native".equals(displayName)) { return UIManager.getSystemLookAndFeelClassName(); final StringBuilder classNameBuilder = new StringBuilder(); for (LookAndFeelInfo laf : UIManager.getInstalledLookAndFeels()) { if (laf.getName().equals(displayName)) { classNameBuilder.append(laf.getClassName()); break; ... |
String | getLookAndFeel(String name) get Look And Feel if (!"native".equals(name)) for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) if (name.equals(info.getName().toLowerCase())) return info.getClassName(); return null; |
Map | getLookAndFeelInfo() Gets all accasseble look and feels. Map<String, String> lookAndFeelInfo = new HashMap<String, String>(20); try { UIManager.LookAndFeelInfo[] lfInfo = UIManager.getInstalledLookAndFeels(); for (int i = 0; (lfInfo != null) && (i < lfInfo.length); i++) { lookAndFeelInfo.put(lfInfo[i].getName(), lfInfo[i].getClassName()); lookAndFeelInfo.put("Kunststoff", "com.incors.plaf.kunststoff.KunststoffLookAndFeel"); lookAndFeelInfo.put("NEXT", "nextlf.plaf.NextLookAndFeel"); ... |
String | getLookAndFeelToSave() Returns the name of the LookAndFeel to load RText with the next time it starts up. String laf = currentLaF; if (laf == null) { laf = UIManager.getLookAndFeel().getClass().getName(); return laf; |
String | getNimbusLAF() Returns the Nimbus L&F, or null if not found. for (final UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if (info.getName().equalsIgnoreCase("Nimbus")) { return info.getClassName(); return null; |
LookAndFeelInfo[] | getSortedInstalledLAFInfos() Returns the installed LAF info array sorted by my preference. final LookAndFeelInfo[] installedLookAndFeels = UIManager.getInstalledLookAndFeels(); Arrays.sort(installedLookAndFeels, new Comparator<LookAndFeelInfo>() { final String[] lafNamesInOrder = new String[] { "Nimbus", "Metal", "Windows", "Squareness", "Office 2003", "Office XP", "Visual Studio 2005" }; @Override public int compare(final LookAndFeelInfo l1, final LookAndFeelInfo l2) { for (final String lafName : lafNamesInOrder) { if (lafName.equals(l1.getName())) ... |
void | getSysDefLookandFeel() get Sys Def Lookand Feel String lookandfeel = UIManager.getSystemLookAndFeelClassName(); try { UIManager.setLookAndFeel(lookandfeel); } catch (Exception e) { e.printStackTrace(); |