From 03cfaa711d3348d6446fd0b0a47ae4fb345853ec Mon Sep 17 00:00:00 2001 From: Denis Molony Date: Mon, 18 Jul 2016 15:02:04 +1000 Subject: [PATCH] tidying --- .../diskbrowser/dos/DosTSListSector.java | 4 +- .../bytezone/diskbrowser/gui/ScrollRuler.java | 40 +++++++++++-------- 2 files changed, 24 insertions(+), 20 deletions(-) diff --git a/src/com/bytezone/diskbrowser/dos/DosTSListSector.java b/src/com/bytezone/diskbrowser/dos/DosTSListSector.java index f8ca0a1..6c88bad 100755 --- a/src/com/bytezone/diskbrowser/dos/DosTSListSector.java +++ b/src/com/bytezone/diskbrowser/dos/DosTSListSector.java @@ -7,7 +7,7 @@ import com.bytezone.diskbrowser.utilities.HexFormatter; class DosTSListSector extends AbstractSector { - String name; + private final String name; public DosTSListSector (String name, Disk disk, byte[] buffer, DiskAddress diskAddress) { @@ -17,8 +17,6 @@ class DosTSListSector extends AbstractSector public boolean isValid (DosDisk dosDisk) { - System.out.println ("Validating TS List sector"); - // what is the count of blocks? does it match? this sector can't tell, there // might be more than one TS list diff --git a/src/com/bytezone/diskbrowser/gui/ScrollRuler.java b/src/com/bytezone/diskbrowser/gui/ScrollRuler.java index 09c6eec..4e7c4d6 100644 --- a/src/com/bytezone/diskbrowser/gui/ScrollRuler.java +++ b/src/com/bytezone/diskbrowser/gui/ScrollRuler.java @@ -1,6 +1,10 @@ package com.bytezone.diskbrowser.gui; -import java.awt.*; +import java.awt.Color; +import java.awt.Dimension; +import java.awt.Font; +import java.awt.Graphics; +import java.awt.Rectangle; import javax.swing.JComponent; @@ -17,13 +21,13 @@ class ScrollRuler extends JComponent public static final int HORIZONTAL = 0; public static final int VERTICAL = 1; - Font font = Platform.getFont (FontType.SANS_SERIF, FontSize.BASE); - int orientation; - boolean isHex = true; - boolean isTrackMode = true; - LayoutDetails layoutDetails; - JComponent image; + private Font font = Platform.getFont (FontType.SANS_SERIF, FontSize.BASE); + private final int orientation; + private boolean isHex = true; + private boolean isTrackMode = true; + private LayoutDetails layoutDetails; + private final JComponent image; public ScrollRuler (JComponent image, int orientation) { @@ -43,11 +47,19 @@ class ScrollRuler extends JComponent // Must match the preferred size of DiskLayoutImage if (orientation == HORIZONTAL) - setPreferredSize (new Dimension (layout.block.width * layout.grid.width + 1, HEIGHT)); // width/height + setPreferredSize (new Dimension (layout.block.width * layout.grid.width + 1, + HEIGHT)); // width/height else - setPreferredSize (new Dimension (WIDTH, layout.block.height * layout.grid.height + 1)); + setPreferredSize (new Dimension (WIDTH, + layout.block.height * layout.grid.height + 1)); - setTrackMode (layout.grid.width == 16 || layout.grid.width == 13); // will call repaint () + setTrackMode (layout.grid.width == 16 || layout.grid.width == 13); + } + + public void setTrackMode (boolean trackMode) + { + isTrackMode = trackMode; + repaint (); } public void changeFont (Font font) @@ -62,12 +74,6 @@ class ScrollRuler extends JComponent repaint (); } - public void setTrackMode (boolean trackMode) - { - isTrackMode = trackMode; - repaint (); - } - @Override protected void paintComponent (Graphics g) { @@ -79,7 +85,7 @@ class ScrollRuler extends JComponent if (layoutDetails == null) return; - g.setFont (font); // how do I do this in the constructor? + g.setFont (font); // how do I do this in the constructor? g.setColor (Color.black); if (orientation == HORIZONTAL)