From: <ls...@us...> - 2008-08-06 20:41:00
|
Revision: 4404 http://jnode.svn.sourceforge.net/jnode/?rev=4404&view=rev Author: lsantha Date: 2008-08-06 20:40:57 +0000 (Wed, 06 Aug 2008) Log Message: ----------- Metal Ocean theme is now default for JNode desktop. Modified Paths: -------------- trunk/gui/src/awt/org/jnode/awt/swingpeers/SwingToolkit.java trunk/gui/src/desktop/org/jnode/desktop/classic/TaskBar.java Modified: trunk/gui/src/awt/org/jnode/awt/swingpeers/SwingToolkit.java =================================================================== --- trunk/gui/src/awt/org/jnode/awt/swingpeers/SwingToolkit.java 2008-08-06 20:28:42 UTC (rev 4403) +++ trunk/gui/src/awt/org/jnode/awt/swingpeers/SwingToolkit.java 2008-08-06 20:40:57 UTC (rev 4404) @@ -85,6 +85,8 @@ import javax.swing.RepaintManager; import javax.swing.SwingUtilities; import javax.swing.UIManager; +import javax.swing.plaf.metal.MetalLookAndFeel; +import javax.swing.plaf.metal.OceanTheme; import javax.swing.border.Border; import javax.swing.border.EmptyBorder; import org.jnode.awt.JNodeAwtContext; @@ -466,8 +468,8 @@ }); try { - UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel"); - //UIManager.setLookAndFeel("com.digitprop.tonic.TonicLookAndFeel"); + MetalLookAndFeel.setCurrentTheme(new OceanTheme()); + UIManager.setLookAndFeel(new MetalLookAndFeel()); } catch (Exception x) { log.warn("Look And Feel not found: ", x); } Modified: trunk/gui/src/desktop/org/jnode/desktop/classic/TaskBar.java =================================================================== --- trunk/gui/src/desktop/org/jnode/desktop/classic/TaskBar.java 2008-08-06 20:28:42 UTC (rev 4403) +++ trunk/gui/src/desktop/org/jnode/desktop/classic/TaskBar.java 2008-08-06 20:40:57 UTC (rev 4404) @@ -87,6 +87,7 @@ setLayout(layout); setBorder(new BevelBorder(BevelBorder.RAISED)); startButton = new JButton("JNode", new ImageIcon(Desktop.loadImage("jnode_icon.png"))); + startButton.setToolTipText("JNode Menu"); startButton.setBorder(new EmptyBorder(1, 3, 1, 3)); add(startButton, BorderLayout.WEST); @@ -149,17 +150,19 @@ lfMenu.add(item); } } + JMenuItem metal_theme = new JMenuItem("Metal Default"); lfMenu.add(metal_theme); - metal_theme.addActionListener(new SetLFAction(new MetalLookAndFeel()) { + metal_theme.addActionListener(new SetLFAction("javax.swing.plaf.metal.MetalLookAndFeel") { public void actionPerformed(ActionEvent e) { MetalLookAndFeel.setCurrentTheme(new DefaultMetalTheme()); super.actionPerformed(e); } }); + JMenuItem ocean_theme = new JMenuItem("Metal Ocean"); lfMenu.add(ocean_theme); - ocean_theme.addActionListener(new SetLFAction(new MetalLookAndFeel()) { + ocean_theme.addActionListener(new SetLFAction("javax.swing.plaf.metal.MetalLookAndFeel") { public void actionPerformed(ActionEvent e) { MetalLookAndFeel.setCurrentTheme(new OceanTheme()); super.actionPerformed(e); @@ -187,21 +190,27 @@ private class SetLFAction implements ActionListener { private LookAndFeel lf; + private final String lfName; public SetLFAction(UIManager.LookAndFeelInfo lfInfo) { - try { - Class c = Thread.currentThread().getContextClassLoader().loadClass(lfInfo.getClassName()); - this.lf = (LookAndFeel) c.newInstance(); - } catch (Exception e) { - log.error("Error crating look & feel " + lfInfo, e); - } + this.lfName = lfInfo.getClassName(); } - public SetLFAction(LookAndFeel lf) { - this.lf = lf; + public SetLFAction(String lfName) { + this.lfName = lfName; } public void actionPerformed(ActionEvent e) { + if (lf == null) { + try { + Class c = Thread.currentThread().getContextClassLoader().loadClass(lfName); + this.lf = (LookAndFeel) c.newInstance(); + } catch (Exception ex) { + log.error("Error crating look & feel " + lfName, ex); + return; + } + } + try { UIManager.setLookAndFeel(lf); } catch (UnsupportedLookAndFeelException ex) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |