List of usage examples for javax.swing SwingUtilities updateComponentTreeUI
public static void updateComponentTreeUI(Component c)
updateUI()
-- that is, to initialize its UI property with the current look and feel. From source file:Main.java
public static void updateUILookAndFeel(Component c) { try {//from w w w. j a v a2 s .com String plafName = UIManager.getInstalledLookAndFeels()[1].getClassName(); UIManager.setLookAndFeel(plafName); SwingUtilities.updateComponentTreeUI(c); } catch (Exception e) { e.printStackTrace(); } }
From source file:Main.java
/** * Set the look and feel of the specified component to the style of the * current system./*from w w w . j a v a 2s. com*/ * * @param c * the specified component */ public static void setSystemLookAndFeel(Component c) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); SwingUtilities.updateComponentTreeUI(c); c.validate(); } catch (Exception e) { e.printStackTrace(); } }
From source file:Main.java
public static void updateUI() { SwingUtilities.invokeLater(new Runnable() { @Override/*from ww w.j av a 2 s .c o m*/ public void run() { // TODO Auto-generated method stub Window windows[] = Window.getWindows(); for (int i = 0; i < windows.length; i++) { if (windows[i].isDisplayable()) { SwingUtilities.updateComponentTreeUI(windows[i]); } } } }); }
From source file:Main.java
public static void lookLinux(Component comp) { UIManager.LookAndFeelInfo[] looks = UIManager.getInstalledLookAndFeels(); for (UIManager.LookAndFeelInfo look : looks) { if (look.getClassName().matches("(?i).*linux.*")) { try { UIManager.setLookAndFeel(look.getClassName()); SwingUtilities.updateComponentTreeUI(comp); return; } catch (Exception e) { e.printStackTrace();/*w w w. j a v a 2 s .c o m*/ } } } }
From source file:es.darkhogg.hazelnutt.Hazelnutt.java
/** * Runs the application//from w w w. j av a2 s . c om * * @param args * @throws Exception */ public static void main(String[] args) throws Exception { // Print some version information LOGGER.log(Level.OFF, "----------------"); LOGGER.info("Hazelnutt " + VERSION); LOGGER.trace("Selecting Look&Feel..."); // Select the L&F from configuration or the default if not present String slaf = CONFIG.getString("Hazelnutt.gui.lookAndFeel"); if (slaf == null) { LOGGER.info("Configuration entry for L&F missing, creating default"); slaf = UIManager.getSystemLookAndFeelClassName(); } // Set it or print an error try { UIManager.setLookAndFeel(slaf); } catch (Exception e) { LOGGER.warn("Error while selecting the L&F \"" + slaf + "\", leaving default"); } // Update the configuration with the currently selected L&F LookAndFeel laf = UIManager.getLookAndFeel(); LOGGER.debug("L&F selected: " + laf.getName() + " (" + laf.getClass().getName() + ")"); CONFIG.setProperty("Hazelnutt.gui.lookAndFeel", laf.getClass().getName()); // Load the frame LOGGER.trace("Launching main frame..."); SwingUtilities.invokeLater(new Runnable() { @Override public void run() { SwingUtilities.updateComponentTreeUI(FRAME); FRAME.setVisible(true); } }); }
From source file:Main.java
/** * Set the specified window to the style of Windows<sup>TM</sup> system. * /*from www. ja va 2s . c om*/ * @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
public static void main_helper(String args[]) { JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); f.setSize(300, 300);// w ww .j a va 2s . c o m f.setUndecorated(true); f.getRootPane().setWindowDecorationStyle(JRootPane.FRAME); JPanel panel = new JPanel(); panel.setBackground(java.awt.Color.white); f.setContentPane(panel); MetalLookAndFeel.setCurrentTheme(new MyDefaultMetalTheme()); try { UIManager.setLookAndFeel(new MetalLookAndFeel()); } catch (Exception e) { e.printStackTrace(); } SwingUtilities.updateComponentTreeUI(f); f.setVisible(true); }
From source file:Main.java
public static void updateComponentTreeUI(JComponent c) { if (c != null) { SwingUtilities.updateComponentTreeUI(c); } }
From source file:Main.java
/** * Refresh the specified component.// w w w . j a v a 2 s . com * * @param component The component to refresh. */ public static void refresh(final Component component) { inEdt(new Runnable() { @Override public void run() { SwingUtilities.updateComponentTreeUI(component); } }); }
From source file:Main.java
public static void setLookAndFeel(LookAndFeel laf, JFrame frame) { try {/*from w w w . j a va2 s . co m*/ UIManager.setLookAndFeel(laf); if (frame != null) { SwingUtilities.updateComponentTreeUI(frame); frame.pack(); } } catch (UnsupportedLookAndFeelException e) { System.err.println("This Look and Feel is not supported!"); e.printStackTrace(); } }