enable cursor movement in catalog tree

This commit is contained in:
Denis Molony 2016-03-03 18:04:47 +11:00
parent 0658fa4e7c
commit 557066e0f4
3 changed files with 7 additions and 4 deletions

View File

@ -137,6 +137,7 @@ abstract class AbstractTab extends JPanel implements Tab
tree.setSelectionPath (tp); tree.setSelectionPath (tp);
if (!tree.isVisible (tp)) if (!tree.isVisible (tp))
tree.scrollPathToVisible (tp); tree.scrollPathToVisible (tp);
tree.requestFocusInWindow ();
} }
protected TreePath getPathToNode (DefaultMutableTreeNode selectNode) protected TreePath getPathToNode (DefaultMutableTreeNode selectNode)

View File

@ -18,8 +18,9 @@ import com.bytezone.diskbrowser.disk.FormattedDisk;
import com.bytezone.diskbrowser.disk.SectorType; import com.bytezone.diskbrowser.disk.SectorType;
import com.bytezone.diskbrowser.gui.DiskLayoutPanel.LayoutDetails; import com.bytezone.diskbrowser.gui.DiskLayoutPanel.LayoutDetails;
import com.bytezone.diskbrowser.gui.RedoHandler.RedoEvent; 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); static final Cursor crosshairCursor = new Cursor (Cursor.CROSSHAIR_CURSOR);
@ -43,7 +44,7 @@ class DiskLayoutImage extends JPanel implements Scrollable
setOpaque (true); setOpaque (true);
addKeyListener (new MyKeyListener ()); addKeyListener (new MyKeyListener ());
setFocusable (true); // setFocusable (true);
} }
public void setDisk (FormattedDisk disk, LayoutDetails details) public void setDisk (FormattedDisk disk, LayoutDetails details)
@ -205,7 +206,8 @@ class DiskLayoutImage extends JPanel implements Scrollable
return false; return false;
} }
void redoEvent (RedoEvent redoEvent) @Override
public void redo (RedoEvent redoEvent)
{ {
redo = true; redo = true;
SectorSelectedEvent event = (SectorSelectedEvent) redoEvent.value; SectorSelectedEvent event = (SectorSelectedEvent) redoEvent.value;

View File

@ -224,7 +224,7 @@ class DiskLayoutPanel extends JPanel implements DiskSelectionListener,
// This can happen if sectors are selected from a dual-dos disk // This can happen if sectors are selected from a dual-dos disk
checkCorrectDisk (((SectorSelectedEvent) event.value).getFormattedDisk ()); checkCorrectDisk (((SectorSelectedEvent) event.value).getFormattedDisk ());
image.redoEvent (event); image.redo (event);
} }
private void checkCorrectDisk (FormattedDisk newDisk) private void checkCorrectDisk (FormattedDisk newDisk)