From 557066e0f462e3d464480d1231c23889608b3902 Mon Sep 17 00:00:00 2001 From: Denis Molony Date: Thu, 3 Mar 2016 18:04:47 +1100 Subject: [PATCH] enable cursor movement in catalog tree --- src/com/bytezone/diskbrowser/gui/AbstractTab.java | 1 + src/com/bytezone/diskbrowser/gui/DiskLayoutImage.java | 8 +++++--- src/com/bytezone/diskbrowser/gui/DiskLayoutPanel.java | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/com/bytezone/diskbrowser/gui/AbstractTab.java b/src/com/bytezone/diskbrowser/gui/AbstractTab.java index 1410dbd..28abc3e 100755 --- a/src/com/bytezone/diskbrowser/gui/AbstractTab.java +++ b/src/com/bytezone/diskbrowser/gui/AbstractTab.java @@ -137,6 +137,7 @@ abstract class AbstractTab extends JPanel implements Tab tree.setSelectionPath (tp); if (!tree.isVisible (tp)) tree.scrollPathToVisible (tp); + tree.requestFocusInWindow (); } protected TreePath getPathToNode (DefaultMutableTreeNode selectNode) diff --git a/src/com/bytezone/diskbrowser/gui/DiskLayoutImage.java b/src/com/bytezone/diskbrowser/gui/DiskLayoutImage.java index a308c1c..d723069 100644 --- a/src/com/bytezone/diskbrowser/gui/DiskLayoutImage.java +++ b/src/com/bytezone/diskbrowser/gui/DiskLayoutImage.java @@ -18,8 +18,9 @@ import com.bytezone.diskbrowser.disk.FormattedDisk; import com.bytezone.diskbrowser.disk.SectorType; import com.bytezone.diskbrowser.gui.DiskLayoutPanel.LayoutDetails; import com.bytezone.diskbrowser.gui.RedoHandler.RedoEvent; +import com.bytezone.diskbrowser.gui.RedoHandler.RedoListener; -class DiskLayoutImage extends JPanel implements Scrollable +class DiskLayoutImage extends JPanel implements Scrollable, RedoListener { static final Cursor crosshairCursor = new Cursor (Cursor.CROSSHAIR_CURSOR); @@ -43,7 +44,7 @@ class DiskLayoutImage extends JPanel implements Scrollable setOpaque (true); addKeyListener (new MyKeyListener ()); - setFocusable (true); + // setFocusable (true); } public void setDisk (FormattedDisk disk, LayoutDetails details) @@ -205,7 +206,8 @@ class DiskLayoutImage extends JPanel implements Scrollable return false; } - void redoEvent (RedoEvent redoEvent) + @Override + public void redo (RedoEvent redoEvent) { redo = true; SectorSelectedEvent event = (SectorSelectedEvent) redoEvent.value; diff --git a/src/com/bytezone/diskbrowser/gui/DiskLayoutPanel.java b/src/com/bytezone/diskbrowser/gui/DiskLayoutPanel.java index 5c0a848..c4ff49b 100644 --- a/src/com/bytezone/diskbrowser/gui/DiskLayoutPanel.java +++ b/src/com/bytezone/diskbrowser/gui/DiskLayoutPanel.java @@ -224,7 +224,7 @@ class DiskLayoutPanel extends JPanel implements DiskSelectionListener, // This can happen if sectors are selected from a dual-dos disk checkCorrectDisk (((SectorSelectedEvent) event.value).getFormattedDisk ()); - image.redoEvent (event); + image.redo (event); } private void checkCorrectDisk (FormattedDisk newDisk)