From 59b22be2bdbad126386199623869f9490762fc80 Mon Sep 17 00:00:00 2001 From: Denis Molony Date: Thu, 16 Sep 2021 18:24:13 +1000 Subject: [PATCH] tidying --- .../applefile/SHRPictureFile1.java | 37 ++++++++++--------- .../bytezone/diskbrowser/gui/DiskBrowser.java | 22 +++++------ .../utilities/EnvironmentAction.java | 6 +++ 3 files changed, 36 insertions(+), 29 deletions(-) diff --git a/src/com/bytezone/diskbrowser/applefile/SHRPictureFile1.java b/src/com/bytezone/diskbrowser/applefile/SHRPictureFile1.java index 5fd784a..c3c9fc7 100644 --- a/src/com/bytezone/diskbrowser/applefile/SHRPictureFile1.java +++ b/src/com/bytezone/diskbrowser/applefile/SHRPictureFile1.java @@ -23,7 +23,6 @@ public class SHRPictureFile1 extends HiResImage // ---------------------------------------------------------------------------------// { super (name, buffer, fileType, auxType, eof); - System.out.println ("here"); int ptr = 0; while (ptr < buffer.length) @@ -142,7 +141,7 @@ public class SHRPictureFile1 extends HiResImage int lo = dirEntry.mode & 0x00FF; // mode bit if hi == 0 boolean fillMode = (dirEntry.mode & 0x20) != 0; - // assert fillMode == false; + // assert fillMode == false; if (hi != 0) System.out.println ("hi not zero"); @@ -243,7 +242,8 @@ public class SHRPictureFile1 extends HiResImage if (ptr < data.length - 32) colorTables[i] = new ColorTable (i, data, ptr); else - colorTables[i] = new ColorTable (i, 0x00); // default empty table !! not finished + colorTables[i] = new ColorTable (i, 0x00); // default empty table !! not + // finished ptr += 32; } } @@ -333,11 +333,11 @@ public class SHRPictureFile1 extends HiResImage ptr = 0; for (int line = 0; line < numScanLines; line++) { - // if (isOddAndEmpty (packedScanLines[line])) - // { - // System.out.println ("Odd number of bytes in empty buffer in " + name); - // break; - // } + // if (isOddAndEmpty (packedScanLines[line])) + // { + // System.out.println ("Odd number of bytes in empty buffer in " + name); + // break; + // } int bytesUnpacked = unpack (packedScanLines[line], 0, packedScanLines[line].length, unpackedBuffer, ptr); @@ -353,16 +353,17 @@ public class SHRPictureFile1 extends HiResImage } // -------------------------------------------------------------------------------// - // private boolean isOddAndEmpty (byte[] buffer) - // // -------------------------------------------------------------------------------// - // { - // if (buffer.length % 2 == 0) - // return false; - // for (byte b : buffer) - // if (b != 0) - // return false; - // return true; - // } + // private boolean isOddAndEmpty (byte[] buffer) + // // + // -------------------------------------------------------------------------------// + // { + // if (buffer.length % 2 == 0) + // return false; + // for (byte b : buffer) + // if (b != 0) + // return false; + // return true; + // } // -------------------------------------------------------------------------------// @Override diff --git a/src/com/bytezone/diskbrowser/gui/DiskBrowser.java b/src/com/bytezone/diskbrowser/gui/DiskBrowser.java index 2204c62..51ae434 100755 --- a/src/com/bytezone/diskbrowser/gui/DiskBrowser.java +++ b/src/com/bytezone/diskbrowser/gui/DiskBrowser.java @@ -52,7 +52,7 @@ public class DiskBrowser extends JFrame { super (windowTitle); - UIManager.put ("TabbedPane.foreground", Color.BLACK); // java bug fix +// UIManager.put ("TabbedPane.foreground", Color.BLACK); // java bug fix if (args.length > 0 && "-reset".equals (args[0])) new WindowState (prefs).clear (); @@ -85,14 +85,14 @@ public class DiskBrowser extends JFrame RootDirectoryAction rootDirectoryAction = new RootDirectoryAction (); RefreshTreeAction refreshTreeAction = new RefreshTreeAction (catalogPanel); - // PreferencesAction preferencesAction = new PreferencesAction (this, prefs); + // PreferencesAction preferencesAction = new PreferencesAction (this, prefs); AbstractAction print = new PrintAction (dataPanel); - // AboutAction aboutAction = new AboutAction (); - // HideLayoutAction hideLayoutAction = new HideLayoutAction (this, layoutBorderPanel); + // AboutAction aboutAction = new AboutAction (); + // HideLayoutAction hideLayoutAction = new HideLayoutAction (this, layoutBorderPanel); ShowFreeSectorsAction showFreeAction = new ShowFreeSectorsAction (); CloseTabAction closeTabAction = new CloseTabAction (catalogPanel); - // closeTabAction.addPropertyChangeListener (catalogPanel); + // closeTabAction.addPropertyChangeListener (catalogPanel); hideCatalogAction.addPropertyChangeListener (this); hideLayoutAction.addPropertyChangeListener (this); @@ -100,10 +100,10 @@ public class DiskBrowser extends JFrame // add action buttons to toolbar toolBar.add (rootDirectoryAction); toolBar.add (refreshTreeAction); - // toolBar.add (preferencesAction); + // toolBar.add (preferencesAction); toolBar.add (duplicateAction); toolBar.add (print); - // toolBar.add (aboutAction); + // toolBar.add (aboutAction); // set the listeners rootDirectoryAction.addPropertyChangeListener (rootFolderData); @@ -132,7 +132,7 @@ public class DiskBrowser extends JFrame menuHandler.fontAction.addFontChangeListener (dataPanel); menuHandler.fontAction.addFontChangeListener (catalogPanel); - // menuHandler.fontAction.addFontChangeListener (diskLayoutPanel); + // menuHandler.fontAction.addFontChangeListener (diskLayoutPanel); // set the MenuItem Actions menuHandler.printItem.setAction (print); @@ -166,7 +166,7 @@ public class DiskBrowser extends JFrame if (desktop.isSupported (Desktop.Action.APP_QUIT_HANDLER)) desktop.setQuitHandler ( (e, r) -> fireQuitEvent ()); // needed for cmd-Q - // else + // else setQuitHandler (); // needed for the close button } else @@ -290,11 +290,11 @@ public class DiskBrowser extends JFrame private static void setLookAndFeel () // ---------------------------------------------------------------------------------// { - // FlatLightLaf.install (); + // FlatLightLaf.install (); try { UIManager.setLookAndFeel (UIManager.getSystemLookAndFeelClassName ()); - // UIManager.setLookAndFeel (new FlatLightLaf ()); + // UIManager.setLookAndFeel (new FlatLightLaf ()); if (MAC) System.setProperty ("apple.laf.useScreenMenuBar", "true"); } diff --git a/src/com/bytezone/diskbrowser/utilities/EnvironmentAction.java b/src/com/bytezone/diskbrowser/utilities/EnvironmentAction.java index 87015ce..84dc78a 100755 --- a/src/com/bytezone/diskbrowser/utilities/EnvironmentAction.java +++ b/src/com/bytezone/diskbrowser/utilities/EnvironmentAction.java @@ -38,9 +38,15 @@ public class EnvironmentAction extends AbstractAction textFormatter.addLine ("Java version", System.getProperty ("java.runtime.version")); textFormatter.addLine (); + String userHome = System.getProperty ("user.home"); + String path = System.getProperty ("java.class.path"); for (String s : path.split (File.pathSeparator)) + { + if (s.startsWith (userHome)) + s = "~" + s.substring (userHome.length ()); textFormatter.addLine ("Classpath", s); + } JOptionPane.showMessageDialog (null, textFormatter.toLabel (), "Java Environment", JOptionPane.INFORMATION_MESSAGE);