List of usage examples for javax.swing.plaf.metal MetalLookAndFeel MetalLookAndFeel
MetalLookAndFeel
From source file:Main.java
public static void main(final String args[]) { JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setSize(300, 300);/* w ww .j av a 2s .c o m*/ f.setLocationRelativeTo(null); 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 main_helper(String args[]) { JFrame f = new JFrame(); f.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); f.setSize(300, 300);// w w w . j ava2 s .c om 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:lookandfeel.LookAndFeelDemo.java
private static void initLookAndFeel() { String lookAndFeel = null;//w w w. j ava 2 s. c o m if (LOOKANDFEEL != null) { if (LOOKANDFEEL.equals("Metal")) { lookAndFeel = UIManager.getCrossPlatformLookAndFeelClassName(); // an alternative way to set the Metal L&F is to replace the // previous line with: // lookAndFeel = "javax.swing.plaf.metal.MetalLookAndFeel"; } else if (LOOKANDFEEL.equals("System")) { lookAndFeel = UIManager.getSystemLookAndFeelClassName(); } else if (LOOKANDFEEL.equals("Motif")) { lookAndFeel = "com.sun.java.swing.plaf.motif.MotifLookAndFeel"; } else if (LOOKANDFEEL.equals("GTK")) { lookAndFeel = "com.sun.java.swing.plaf.gtk.GTKLookAndFeel"; } else { System.err.println("Unexpected value of LOOKANDFEEL specified: " + LOOKANDFEEL); lookAndFeel = UIManager.getCrossPlatformLookAndFeelClassName(); } try { UIManager.setLookAndFeel(lookAndFeel); // If L&F = "Metal", set the theme if (LOOKANDFEEL.equals("Metal")) { if (THEME.equals("DefaultMetal")) MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme()); else if (THEME.equals("Ocean")) MetalLookAndFeel.setCurrentTheme(new OceanTheme()); else MetalLookAndFeel.setCurrentTheme(new TestTheme()); UIManager.setLookAndFeel(new MetalLookAndFeel()); } } catch (ClassNotFoundException e) { System.err.println("Couldn't find class for specified look and feel:" + lookAndFeel); System.err.println("Did you include the L&F library in the class path?"); System.err.println("Using the default look and feel."); } catch (UnsupportedLookAndFeelException e) { System.err.println("Can't use the specified look and feel (" + lookAndFeel + ") on this platform."); System.err.println("Using the default look and feel."); } catch (Exception e) { System.err.println("Couldn't get specified look and feel (" + lookAndFeel + "), for some reason."); System.err.println("Using the default look and feel."); e.printStackTrace(); } } }
From source file:LookAndFeelDemo.java
private static void initLookAndFeel() { String lookAndFeel = null;//from w ww. java2s . c om if (LOOKANDFEEL != null) { if (LOOKANDFEEL.equals("Metal")) { lookAndFeel = UIManager.getCrossPlatformLookAndFeelClassName(); // an alternative way to set the Metal L&F is to replace the // previous line with: // lookAndFeel = "javax.swing.plaf.metal.MetalLookAndFeel"; } else if (LOOKANDFEEL.equals("System")) { lookAndFeel = UIManager.getSystemLookAndFeelClassName(); } else if (LOOKANDFEEL.equals("Motif")) { lookAndFeel = "com.sun.java.swing.plaf.motif.MotifLookAndFeel"; } else if (LOOKANDFEEL.equals("GTK")) { lookAndFeel = "com.sun.java.swing.plaf.gtk.GTKLookAndFeel"; } else { System.err.println("Unexpected value of LOOKANDFEEL specified: " + LOOKANDFEEL); lookAndFeel = UIManager.getCrossPlatformLookAndFeelClassName(); } try { UIManager.setLookAndFeel(lookAndFeel); // If L&F = "Metal", set the theme if (LOOKANDFEEL.equals("Metal")) { if (THEME.equals("DefaultMetal")) MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme()); else if (THEME.equals("Ocean")) MetalLookAndFeel.setCurrentTheme(new OceanTheme()); else MetalLookAndFeel.setCurrentTheme(new TestTheme()); UIManager.setLookAndFeel(new MetalLookAndFeel()); } } catch (ClassNotFoundException e) { System.err.println("Couldn't find class for specified look and feel:" + lookAndFeel); System.err.println("Did you include the L&F library in the class path?"); System.err.println("Using the default look and feel."); } catch (UnsupportedLookAndFeelException e) { System.err.println("Can't use the specified look and feel (" + lookAndFeel + ") on this platform."); System.err.println("Using the default look and feel."); } catch (Exception e) { System.err.println("Couldn't get specified look and feel (" + lookAndFeel + "), for some reason."); System.err.println("Using the default look and feel."); e.printStackTrace(); } } }
From source file:com.qspin.qtaste.ui.MainPanel.java
public void setQSpinTheme() { mTheme = new QSpinTheme(); MetalLookAndFeel.setCurrentTheme(mTheme); try {/*from w w w .j av a2s . co m*/ UIManager.setLookAndFeel(new MetalLookAndFeel()); ((WrappedToolTipUI) WrappedToolTipUI.createUI(null)).setMaxWidth(200); UIManager.put("ToolTipUI", "com.qspin.qtaste.ui.tools.WrappedToolTipUI"); } catch (UnsupportedLookAndFeelException ex) { } }
From source file:llc.rockford.webcast.EC2Driver.java
private void initLookAndFeel() { String lookAndFeel = null;/*from w ww .ja v a 2 s .c o m*/ if (LOOKANDFEEL != null) { if (LOOKANDFEEL.equals("Metal")) { lookAndFeel = UIManager.getCrossPlatformLookAndFeelClassName(); } else if (LOOKANDFEEL.equals("System")) { lookAndFeel = UIManager.getSystemLookAndFeelClassName(); } else if (LOOKANDFEEL.equals("Motif")) { lookAndFeel = "com.sun.java.swing.plaf.motif.MotifLookAndFeel"; } else if (LOOKANDFEEL.equals("GTK")) { lookAndFeel = "com.sun.java.swing.plaf.gtk.GTKLookAndFeel"; } else { System.err.println("Unexpected value of LOOKANDFEEL specified: " + LOOKANDFEEL); lookAndFeel = UIManager.getCrossPlatformLookAndFeelClassName(); } try { UIManager.setLookAndFeel(lookAndFeel); // If L&F = "Metal", set the theme if (LOOKANDFEEL.equals("Metal")) { if (THEME.equals("DefaultMetal")) MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme()); else if (THEME.equals("Ocean")) MetalLookAndFeel.setCurrentTheme(new OceanTheme()); UIManager.setLookAndFeel(new MetalLookAndFeel()); } } catch (ClassNotFoundException e) { System.err.println("Couldn't find class for specified look and feel:" + lookAndFeel); System.err.println("Did you include the L&F library in the class path?"); System.err.println("Using the default look and feel."); } catch (UnsupportedLookAndFeelException e) { System.err.println("Can't use the specified look and feel (" + lookAndFeel + ") on this platform."); System.err.println("Using the default look and feel."); } catch (Exception e) { System.err.println("Couldn't get specified look and feel (" + lookAndFeel + "), for some reason."); System.err.println("Using the default look and feel."); e.printStackTrace(); } } }
From source file:hermes.browser.HermesBrowser.java
private void initJIDE() throws UnsupportedLookAndFeelException, ClassNotFoundException, InstantiationException, IllegalAccessException {/*www.j a v a2s . co m*/ try { LookAndFeelFactory.installJideExtension(); } catch (IllegalArgumentException e) { log.error("l&f incompatible with JIDE, trying metal: " + e.getMessage(), e); UIManager.setLookAndFeel(new MetalLookAndFeel()); LookAndFeelFactory.installJideExtension(); } ObjectConverterManager.initDefaultConverter(); CellEditorManager.initDefaultEditor(); CellRendererManager.initDefaultRenderer(); ObjectComparatorManager.initDefaultComparator(); LookAndFeelFactory.UIDefaultsCustomizer uiDefaultsCustomizer = new LookAndFeelFactory.UIDefaultsCustomizer() { public void customize(UIDefaults defaults) { Map painter = (Map) defaults.get("Theme.painter"); // ThemePainter painter = (ThemePainter) // defaults.get("Theme.painter"); defaults.put("OptionPaneUI", "com.jidesoft.plaf.basic.BasicJideOptionPaneUI"); defaults.put("OptionPane.showBanner", Boolean.FALSE); // show // banner // or // not. // default // is // true defaults.put("OptionPane.bannerBackgroundDk", painter.get("OptionPane.bannerBackgroundDk")); defaults.put("OptionPane.bannerBackgroundLt", painter.get("OptionPane.bannerBackgroundLt")); defaults.put("OptionPane.bannerBackgroundDirection", Boolean.TRUE); // default // is // true // optionally, you can set a Paint object for BannerPanel. If // so, the three UIDefaults related to banner background above // will be ignored. defaults.put("OptionPane.bannerBackgroundPaint", null); defaults.put("OptionPane.buttonAreaBorder", BorderFactory.createEmptyBorder(6, 6, 6, 6)); defaults.put("OptionPane.buttonOrientation", new Integer(SwingConstants.RIGHT)); } }; uiDefaultsCustomizer.customize(UIManager.getDefaults()); }
From source file:hermes.browser.HermesBrowser.java
/** * Initialisation of GUI components, must be run on the Swing dispatch * thread.// w w w. j av a 2s . com * * @throws ClassNotFoundException * @throws InstantiationException * @throws IllegalAccessException * @throws UnsupportedLookAndFeelException * @throws HermesException */ private void initUI() throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException, HermesException { if (System.getProperty("swing.defaultlaf") == null) { try { UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); /** * http://hermesjms.com/jira/browse/HJMS-16 I've not implemented * this fully as the L&F class name is not all we need to * persist, JIDE seems to add in lots of extension stuff and I * don't see how to persist/restor them yet. if * (TextUtils.isEmpty(getConfig().getLookAndFeel())) { * UIManager. * setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); } * else { UIManager.setLookAndFeel(getConfig().getLookAndFeel()) * ; } */ } catch (Throwable e) { log.error("cannot load l&f, trying metal: " + e.getMessage(), e); UIManager.setLookAndFeel(new MetalLookAndFeel()); } } else { UIManager.setLookAndFeel(System.getProperty("swing.defaultlaf")); } if (getConfig().isEnableJython() && jythonFrame == null) { jythonFrame = new JythonDockableFrame(); getDockingManager().addFrame(jythonFrame); } if (!getConfig().isEnableJython() && jythonFrame != null) { getDockingManager().removeFrame(jythonFrame.getKey()); jythonFrame = null; } CellEditorManager.registerEditor(Domain.class, new DomainCellEditor()); CellEditorManager.registerEditor(SelectorImpl.class, new SelectorImplCellEditor()); CellEditorManager.registerEditor(File.class, new DirectoryCellEditor(), DirectoryCellEditor.CONTEXT); CellEditorManager.registerEditor(String.class, new ClasspathIdCellEdtitor(), ClasspathIdCellEdtitor.CONTEXT); CellEditorManager.registerEditor(Hermes.class, new HermesCellEditor()); ObjectComparatorManager.registerComparator(Date.class, new DateComparator()); ObjectComparatorManager.registerComparator(Integer.class, new IntegerComparator()); ObjectComparatorManager.registerComparator(Long.class, new LongComparator()); DefaultSyntaxKit.initKit(); browserPane = new MainDocumentPane(); // Shows us the memory usage and lets the user GC MemoryStatusBarItem memoryStatusBar = new MemoryStatusBarItem(); memoryStatusBar.setPreferredWidth(100); // General informative messages go here.. progressStatus = new ProgressStatusBarItem(); statusBar = new StatusBar(); statusBar.add(progressStatus, JideBoxLayout.VARY); statusBar.add(new TimeStatusBarItem(), JideBoxLayout.FLEXIBLE); statusBar.add(memoryStatusBar, JideBoxLayout.FLEXIBLE); // The tools panel includes the running tasks, Jython console and log // console. actionsPane = new ActionsPanel(); toolsPane = new DockableToolPanel(); toolsPane.addToolPanel("Tasks", new JideScrollPane(actionsPane)); toolsPane.addToolPanel("Log", new Log4JOutputViewer("")); browserTreePane = new BrowserTreeDockableFrame(); browserTreePane.setLoader(loader); // Get the menu bar initialised... setJMenuBar(new MenuBar(this)); setIconImage(IconCache.getIcon("hermes.icon").getImage()); // // Layout management initialisation getDockingManager().setUsePref(false); getDockingManager().setProfileKey(USER_PROFILE_NAME); getDockingManager().setInitSplitPriority(DefaultDockingManager.SPLIT_SOUTH_NORTH_EAST_WEST); getDockingManager().getWorkspace().add(browserPane, BorderLayout.CENTER); getDockingManager().addFrame(browserTreePane); getDockingManager().addFrame(toolsPane); getDockableBarManager().addDockableBar(new MainToolBar()); getDockableBarManager().addDockableBar(new MessageToolBar()); getDockableBarManager().addDockableBar(new ConfigurationToolBar()); getDockableBarManager().addDockableBar(new JNDIToolBar()); getContentPane().add(statusBar, BorderLayout.AFTER_LAST_LINE); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); toFront(); setStatusMessage("Ready"); SplashScreen.hide(); // // Raise the swing thread to max priority SwingUtilities.invokeLater(new Runnable() { public void run() { Thread.currentThread().setPriority(Thread.MAX_PRIORITY); } }); }
From source file:com.commander4j.util.JUtility.java
public static void SetLookAndFeel(String LOOKANDFEEL, String THEME) { try {//from w ww.j a v a 2s .com if (LOOKANDFEEL.equals("Metal")) { if (THEME.equals("DefaultMetal")) MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme()); else if (THEME.equals("Ocean")) MetalLookAndFeel.setCurrentTheme(new OceanTheme()); UIManager.setLookAndFeel(new MetalLookAndFeel()); } } catch (Exception e) { e.printStackTrace(); } }
From source file:org.executequery.util.LookAndFeelLoader.java
/** * Sets the default metal look and feel theme on Metal. */// w w w .j a v a2s.co m private void loadDefaultMetalLookAndFeelTheme() { try { MetalLookAndFeel.setCurrentTheme(new javax.swing.plaf.metal.DefaultMetalTheme()); UIManager.setLookAndFeel(new MetalLookAndFeel()); } catch (UnsupportedLookAndFeelException e) { throw new ApplicationException(e); } }