List of usage examples for javax.swing UIManager setLookAndFeel
@SuppressWarnings("deprecation") public static void setLookAndFeel(String className) throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException
From source file:Main.java
/** * Sets look and feel to Nimbus./*from w w w .j a v a2 s.c o m*/ * * @return */ public static boolean setNimbusLF() { try { for (LookAndFeelInfo laf : UIManager.getInstalledLookAndFeels()) { if ("Nimbus".equals(laf.getName())) { UIManager.setLookAndFeel(laf.getClassName()); break; } } } catch (Exception e) { // If Nimbus is not available, you can set the GUI to another look and feel. return false; } return true; }
From source file:Main.java
public static void lookWindows(Component comp) { UIManager.LookAndFeelInfo[] looks = UIManager.getInstalledLookAndFeels(); for (UIManager.LookAndFeelInfo look : looks) { if (look.getClassName().matches("(?i).*windows.*")) { try { UIManager.setLookAndFeel(look.getClassName()); // UIManager.put("ProgressBar.background", Color.DARK_GRAY); // UIManager.put("ProgressBar.foreground", Color.DARK_GRAY); // UIManager.put("ProgressBar.selectionBackground",Color.DARK_GRAY); // UIManager.put("ProgressBar.selectionForeground",Color.DARK_GRAY); // UIManager.setLookAndFeel("de.javasoft.plaf.synthetica.SyntheticaBlackEyeLookAndFeel"); // UIManager.put("Synthetica.window.opaque", false); // UIManager.put("Synthetica.window.shape", ""); // UIManager.put("Panel.background", Color.decode("#a5ddfb")); // UIManager.put("RadioButton.background", Color.decode("#a5ddfb")); // UIManager.put("CheckBox.background", Color.decode("#a5ddfb")); // UIManager.put("MenuBar.background", Color.decode("#a5ddfb")); SwingUtilities.updateComponentTreeUI(comp); return; } catch (Exception e) { e.printStackTrace();//from w w w . j a va 2s .c om } } } }
From source file:com.clank.launcher.Launcher.java
/** * Bootstrap.// w w w.j a v a 2s.c o m * * @param args args */ public static void main(String[] args) { SimpleLogFormatter.configureGlobalLogger(); LauncherArguments options = new LauncherArguments(); try { new JCommander(options, args); } catch (ParameterException e) { System.err.print(e.getMessage()); System.exit(1); return; } Integer bsVersion = options.getBootstrapVersion(); log.info(bsVersion != null ? "Bootstrap version " + bsVersion + " detected" : "Not bootstrapped"); File dir = options.getDir(); if (dir != null) { log.info("Using given base directory " + dir.getAbsolutePath()); } else { dir = new File("."); log.info("Using current directory " + dir.getAbsolutePath()); } final File baseDir = dir; SwingUtilities.invokeLater(new Runnable() { @Override public void run() { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); UIManager.getDefaults().put("SplitPane.border", BorderFactory.createEmptyBorder()); Launcher launcher = new Launcher(baseDir); new LauncherFrame(launcher).setVisible(true); } catch (Throwable t) { log.log(Level.WARNING, "Load failure", t); SwingHelper.showErrorDialog(null, "Uh oh! The updater couldn't be opened because a " + "problem was encountered.", "Launcher error", t); } } }); }
From source file:Main.java
/** * Set the specified window to the style of Windows<sup>TM</sup> system. * /*from ww w. j ava 2 s . c o m*/ * @param window * the specified window * @deprecated Please use {@link SwingUtils#setSystemLookAndFeel(Component)} * instead. */ public static void setWindowsLookLike(Window window) { try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");//$NON-NLS-1$ SwingUtilities.updateComponentTreeUI(window); window.validate(); } catch (Exception e) { e.printStackTrace(); } }
From source file:Main.java
/** * Should be called before initComponents() * * @param lafName/*from w ww . j a v a 2s.c o m*/ */ public static void setLaf(String lafName) { for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if (info.getName().equals(lafName)) { try { UIManager.setLookAndFeel(info.getClassName()); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) { } break; } } }
From source file:Main.java
public static void lookNimbus(Component comp) { UIManager.LookAndFeelInfo[] looks = UIManager.getInstalledLookAndFeels(); for (UIManager.LookAndFeelInfo look : looks) { if (look.getClassName().matches("(?i).*nimbus.*")) { try { UIManager.setLookAndFeel(look.getClassName()); // UIManager.put("control", Color.decode("#cccccc")); UIManager.put("info", Color.decode("#ff9900")); // UIManager.put("nimbusAlertYellow", Color.decode("#ff0000")); // UIManager.put("nimbusBase", Color.decode("#4e5a66")); // UIManager.put("nimbusDisabledText", Color.decode("#9900ff")); UIManager.put("nimbusFocus", Color.decode("#ff9933")); // UIManager.put("nimbusGreen", new Color(130, 133, 37)); // UIManager.put("nimbusInfoBlue", Color.decode("#9900ff")); // UIManager.put("nimbusLightBackground", Color.decode("#9900ff")); // UIManager.put("nimbusOrange", new Color(191, 98, 4)); // UIManager.put("nimbusRed", new Color(169, 46, 34)); // UIManager.put("nimbusSelectedText", Color.decode("#ff00ff")); UIManager.put("nimbusSelectionBackground", Color.decode("#465059")); // UIManager.put("text", new Color(0, 0, 0)); UIManager.put("nimbusSelection", Color.decode("#465059")); // UIManager.put("Menu.background", Color.decode("#0066ff")); // UIManager.put("Menu[Enabled+Selected].backgroundPainter", Color.BLUE); SwingUtilities.updateComponentTreeUI(comp); return; } catch (Exception e) { e.printStackTrace();/* ww w . jav a2 s.com*/ } } } }
From source file:Main.java
public static void setLookAndFeel() { if (UIManager.getLookAndFeel().getID().equals("Aqua")) { //$NON-NLS-1$ SPINNERHEIGHT = 20;// w ww . j av a 2s. c o m } else { // try to use Nimbus unless on Mac Os try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); //$NON-NLS-1$ } catch (Exception e) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } catch (ClassNotFoundException e1) { e1.printStackTrace(); } catch (InstantiationException e1) { e1.printStackTrace(); } catch (IllegalAccessException e1) { e1.printStackTrace(); } catch (UnsupportedLookAndFeelException e1) { e1.printStackTrace(); } } } }
From source file:Main.java
static void setSwingLAF(java.awt.Component comp, String targetTheme) { try {/* ww w. j a v a2 s.c o m*/ if (targetTheme.equalsIgnoreCase(Native)) { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } else if (targetTheme.equalsIgnoreCase(Java)) { UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); } else if (targetTheme.equalsIgnoreCase(Motif)) { UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel"); } // if (targetTheme.equalsIgnoreCase(plaf)){ // UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); // } // // if (targetTheme.equalsIgnoreCase(GTK)){ // UIManager.setLookAndFeel("com.sun.java.swing.plaf.gtk.GTKLookAndFeel"); // } SwingUtilities.updateComponentTreeUI(comp); if (comp instanceof java.awt.Frame) { ((java.awt.Frame) comp).pack(); } } catch (Exception e) { errorMessage(e); } }
From source file:Main.java
/** * Tries to set the NimbusLookAndFeel//from ww w.j av a 2 s .c om * * @return if the NimbusLookAndFeel could bet set */ public static boolean setNimbusLookAndFeel() { boolean isNumbusSet = true; try { // Nimbus Loyout UIManager.setLookAndFeel("com.sun.java.swing.plaf.nimbus.NimbusLookAndFeel"); } catch (ClassNotFoundException e) { isNumbusSet = false; } catch (InstantiationException e) { isNumbusSet = false; } catch (IllegalAccessException e) { isNumbusSet = false; } catch (UnsupportedLookAndFeelException e) { isNumbusSet = false; } return isNumbusSet; }
From source file:dnd.LocationSensitiveDemo.java
public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { public void run() { try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); increaseFont("Tree.font"); increaseFont("Label.font"); increaseFont("ComboBox.font"); increaseFont("List.font"); } catch (Exception e) { }//w w w . j ava2s.co m //Turn off metal's use of bold fonts UIManager.put("swing.boldMetal", Boolean.FALSE); createAndShowGUI(); } }); }