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:ffx.ui.MainPanel.java
/** * <p>/*from ww w .j a v a 2 s . com*/ * platformLookAndFeel</p> */ public void platformLookAndFeel() { try { if (SystemUtils.IS_OS_LINUX) { UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel"); } else { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } SwingUtilities.updateComponentTreeUI(SwingUtilities.getRoot(this)); } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException e) { logger.log(Level.WARNING, "Can''t set look and feel: {0}", e); } }
From source file:com.isti.traceview.common.TraceViewChartPanel.java
public void updateUI() { // here we need to update the UI for the popup menu, if the panel // has one... if (this.popup != null) { SwingUtilities.updateComponentTreeUI(this.popup); }// w ww. jav a2 s . c o m super.updateUI(); }
From source file:forms.frDados.java
/** * Aplica um tema s janelas da aplicao./*from w w w .ja v a2s. co m*/ * @param e Evento do menu de temas. */ @Override public void actionPerformed(ActionEvent e) { if (e.getSource() instanceof JMenuItem) { String name = ((JMenuItem) e.getSource()).getText(); try { for (UIManager.LookAndFeelInfo info : UIManager.getInstalledLookAndFeels()) { if (info.getName().equals(name)) UIManager.setLookAndFeel(info.getClassName()); SwingUtilities.updateComponentTreeUI(this); SwingUtilities.updateComponentTreeUI(jfcArquivo); SwingUtilities.updateComponentTreeUI(frCadastro); } } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { Logger.getLogger(frDados.class.getName()).log(Level.SEVERE, null, ex); } } }
From source file:jeplus.JEPlusFrameMain.java
private void jMenuItemDefaultLaFActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jMenuItemDefaultLaFActionPerformed try {/*w w w .j a v a 2 s . c om*/ switch (jMenuItemDefaultLaF.getActionCommand()) { case "default": UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); UIManager.put("swing.boldMetal", Boolean.FALSE); SwingUtilities.updateComponentTreeUI(this); jMenuItemDefaultLaF.setActionCommand("platform"); jMenuItemDefaultLaF.setText("Switch to system Look and Feel (OS)"); this.pack(); break; case "platform": UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); SwingUtilities.updateComponentTreeUI(this); jMenuItemDefaultLaF.setActionCommand("default"); jMenuItemDefaultLaF.setText("Switch to defaul Look and Feel (Metal)"); this.pack(); break; } } catch (ClassNotFoundException | InstantiationException | IllegalAccessException | UnsupportedLookAndFeelException ex) { logger.error("Error setting Look-and-Feel.", ex); } }
From source file:au.org.ala.delta.intkey.Intkey.java
/** * Prompt the user to select the font to use in the application *//*w w w .j a va 2 s .co m*/ @Action public void chooseFont() { Font f = UIManager.getFont("Label.font"); Font newFont = JFontChooser.showDialog(getMainFrame(), UIUtils.getResourceString("SelectFontPrompt.caption"), f); if (newFont != null) { FontUIResource fontResource = new FontUIResource(newFont); Enumeration<Object> keys = UIManager.getDefaults().keys(); while (keys.hasMoreElements()) { Object key = keys.nextElement(); Object value = UIManager.get(key); if (value instanceof javax.swing.plaf.FontUIResource) { UIManager.put(key, fontResource); } } SwingUtilities.updateComponentTreeUI(getMainFrame()); } }
From source file:com.peterbochs.PeterBochsDebugger.java
public void initGlobalFontSetting(Font fnt) { FontUIResource fontRes = new FontUIResource(fnt); for (Enumeration keys = UIManager.getDefaults().keys(); keys.hasMoreElements();) { Object key = keys.nextElement(); Object value = UIManager.get(key); if (value instanceof FontUIResource) { UIManager.put(key, fontRes); }// w w w . ja va 2 s .c o m } SwingUtilities.updateComponentTreeUI(this); }
From source file:src.gui.ItSIMPLE.java
/** * This method initializes windowsItem/*from w w w.ja va2 s.c o m*/ * * @return javax.swing.JMenuItem */ private JMenuItem getWindowsMenuItem() { if (windowsMenuItem == null) { windowsMenuItem = new JMenuItem(); windowsMenuItem.setText("Windows"); windowsMenuItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); SwingUtilities.updateComponentTreeUI(instance); itSettings.getChild("generalSettings").getChild("graphics").getChild("appearence") .setText("Windows"); XMLUtilities.writeToFile("resources/settings/itSettings.xml", itSettings.getDocument()); } catch (Exception e1) { e1.printStackTrace(); } } }); } return windowsMenuItem; }
From source file:src.gui.ItSIMPLE.java
/** * This method initializes metalItem// w w w .jav a2 s . co m * * @return javax.swing.JMenuItem */ private JMenuItem getMetalMenuItem() { if (metalMenuItem == null) { metalMenuItem = new JMenuItem(); metalMenuItem.setText("Metal"); metalMenuItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { try { UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel"); SwingUtilities.updateComponentTreeUI(instance); instance.pack(); itSettings.getChild("generalSettings").getChild("graphics").getChild("appearence") .setText("Metal"); XMLUtilities.writeToFile("resources/settings/itSettings.xml", itSettings.getDocument()); } catch (Exception e1) { e1.printStackTrace(); } } }); } return metalMenuItem; }
From source file:src.gui.ItSIMPLE.java
/** * This method initializes motifItem/*from ww w. j av a 2 s.c om*/ * * @return javax.swing.JMenuItem */ private JMenuItem getMotifMenuItem() { if (motifMenuItem == null) { motifMenuItem = new JMenuItem(); motifMenuItem.setText("CDE/Motif"); motifMenuItem.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent e) { try { UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel"); SwingUtilities.updateComponentTreeUI(instance); itSettings.getChild("generalSettings").getChild("graphics").getChild("appearence") .setText("Motif"); XMLUtilities.writeToFile("resources/settings/itSettings.xml", itSettings.getDocument()); } catch (Exception e1) { e1.printStackTrace(); } } }); } return motifMenuItem; }