From: <doc...@us...> - 2007-08-21 21:03:27
|
Revision: 159 http://openpcl.svn.sourceforge.net/openpcl/?rev=159&view=rev Author: documentsystems Date: 2007-08-21 14:03:25 -0700 (Tue, 21 Aug 2007) Log Message: ----------- Howard Hoagland. If System.getProperty("os.name") has "WIN" anywhere (could be any version of Windows), then at app startup time, set the LookAndFeel to com.sun.java.swing.plaf.windows.WindowsLookAndFeel" so that it doesn't default to the Metal Ocean Theme look and feel like it was doing before. Else, let the running JVM set it's default look and feel (for when this app is run on a non Windows platform like a Macintosh, Unix, Linux. Modified Paths: -------------- openpcl/src/com/openpcl/viewer/jframe/PosSimpleJFrame.java Modified: openpcl/src/com/openpcl/viewer/jframe/PosSimpleJFrame.java =================================================================== --- openpcl/src/com/openpcl/viewer/jframe/PosSimpleJFrame.java 2007-08-21 20:22:41 UTC (rev 158) +++ openpcl/src/com/openpcl/viewer/jframe/PosSimpleJFrame.java 2007-08-21 21:03:25 UTC (rev 159) @@ -27,12 +27,23 @@ import javax.swing.JTextField; import javax.swing.JToolBar; import javax.swing.KeyStroke; +import javax.swing.UIManager; +import javax.swing.UnsupportedLookAndFeelException; import javax.swing.WindowConstants; import com.openpcl.viewer.OpenPCLViewer; import com.openpcl.viewer.options.PosStartupOptions; import com.openpcl.viewer.util.PosReadImageIcon; +/** + * PosSimpleJFrame is a JFrame that puts the OpenPCLViewer (a JPanel) on the screen in the JFrame's layout. + * The OpenPCLViewer panel sends PCL bytes to the PclRenderImage class that is in the .jar file of that name. + * PclRenderImage and its related classes parse the PCL bytes and then draws/renders the PCL image on a + * BufferedImage which OpenPCLViewer puts on the screen along with the JTree that has tree nodes for the + * possibly multi page PCL bytes. + * + * @author DocMagic, Document Systems Inc, HowardH. 9/20/06 + */ public class PosSimpleJFrame extends JFrame { private static final long serialVersionUID = 1L; @@ -54,15 +65,6 @@ protected JPanel mPclViewerOuterJPanel = null; protected int mModeToRun = PosStartupOptions.sModeToRunNotSelected; - /** - * Constructor - * PosSimpleJFrame is a JFrame that puts the OpenPCLViewer (a JPanel) on the screen in the JFrame's layout. - * The OpenPCLViewer panel sends PCL bytes to the PclRenderImage class that is in the .jar file of that name. - * PclRenderImage and its related classes parse the PCL bytes and then draws/renders the PCL image on a - * BufferedImage which OpenPCLViewer puts on the screen along with the JTree that has tree nodes for the - * possibly multi page PCL bytes. - * @author howard 9/20/06 - */ public PosSimpleJFrame(int pModeToRun) { mModeToRun = pModeToRun; @@ -104,18 +106,17 @@ // The above WindowListener.windowClosing() will be called setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); - // Uncomment the below code if you want to specify a specific LookAndFeel at program startup time - // instead of let the client's JVM (could be Macintosh or Unix for example) set it's default LookAndFeel -// try { -// UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); -// OR -// UIManager.setLookAndFeel("/* Any other full package path and LookAndFeel subclass */"); -// } catch (ClassNotFoundException e) {e.printStackTrace(); -// } catch (InstantiationException e) {e.printStackTrace(); -// } catch (IllegalAccessException e) {e.printStackTrace(); -// } catch (UnsupportedLookAndFeelException e) {e.printStackTrace(); -// } - + // Specify a specific LookAndFeel at program startup time instead of let the client's JVM set it's default LookAndFeel + // (could be Windows or Macintosh or Unix for example) + if ((OpenPCLViewer.sOsNameString).toUpperCase().contains("WIN")) { + try { + UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel"); + } catch (ClassNotFoundException e) {e.printStackTrace(); + } catch (InstantiationException e) {e.printStackTrace(); + } catch (IllegalAccessException e) {e.printStackTrace(); + } catch (UnsupportedLookAndFeelException e) {e.printStackTrace(); + } + } // Build the UI elements buildSimpleUI(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |