diff --git a/src/gui/DTNSimGUI.java b/src/gui/DTNSimGUI.java index 61a418d068e68031911da3d0be8436d2abb7dd24..59cb0395e9d2f184ab7cc8e612cb4bd0a4be34e6 100644 --- a/src/gui/DTNSimGUI.java +++ b/src/gui/DTNSimGUI.java @@ -257,6 +257,10 @@ public class DTNSimGUI extends DTNSimUI { infoPanel.showInfo(host); } + public void highlightHost(DTNHost host) { + field.highlightHost(host); + } + /** * Shows a path on the playfield * @param path The path to show diff --git a/src/gui/EventLogPanel.java b/src/gui/EventLogPanel.java index c851d9495cd4abe77bb7672f4e7420f3dc03104b..d1b75ee7a8d94f121a9efc0dcdd48ab8b146dbab 100644 --- a/src/gui/EventLogPanel.java +++ b/src/gui/EventLogPanel.java @@ -252,6 +252,7 @@ public class EventLogPanel extends JPanel gui.setPaused(true); if (host1 != null) { gui.setFocus(host1); + gui.highlightHost(host1); } } @@ -316,6 +317,7 @@ public class EventLogPanel extends JPanel if (source.getClientProperty(HOST_PROP) != null) { // button was a host button -> focus it on GUI gui.setFocus((DTNHost)source.getClientProperty(HOST_PROP)); + gui.highlightHost((DTNHost)source.getClientProperty(HOST_PROP)); } else if (source.getClientProperty(MSG_PROP) != null) { // was a message button -> show information about the message diff --git a/src/gui/MainWindow.java b/src/gui/MainWindow.java index d03cd9f53141a6ce4278319e0ae3375ea46fd852..30cf2ef1b3b56ddd1cced37ee1d1bcc1fcf76c78 100644 --- a/src/gui/MainWindow.java +++ b/src/gui/MainWindow.java @@ -73,6 +73,7 @@ public class MainWindow extends JFrame { hostListScroll = new JScrollPane(chooser); hostListScroll.setHorizontalScrollBarPolicy( JScrollPane.HORIZONTAL_SCROLLBAR_NEVER); + hostListScroll.getVerticalScrollBar().setUnitIncrement(20); logControlSplit = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, new JScrollPane(elp.getControls()),new JScrollPane(elp)); diff --git a/src/gui/NodeChooser.java b/src/gui/NodeChooser.java index 2af26327b03dd604c887236f796391844dd56773..d76e7e769dfc646708f6d42f3ce6b17d6684ae9d 100644 --- a/src/gui/NodeChooser.java +++ b/src/gui/NodeChooser.java @@ -200,6 +200,7 @@ public class NodeChooser extends JPanel implements ActionListener { JButton source = (JButton)e.getSource(); DTNHost host = (DTNHost)source.getClientProperty(HOST_KEY); gui.setFocus(host); + gui.highlightHost(host); } else if (e.getSource() == this.groupChooser) { setNodes(groupChooser.getSelectedIndex() * MAX_NODE_COUNT); diff --git a/src/gui/SimMenuBar.java b/src/gui/SimMenuBar.java index a4e89911bf646bba9258bdb738596eb73eba0f6c..396db893a540bbd723a3e66bfddf71a7bea1a37a 100644 --- a/src/gui/SimMenuBar.java +++ b/src/gui/SimMenuBar.java @@ -121,7 +121,7 @@ public class SimMenuBar extends JMenuBar implements ActionListener { showBuffer = createCheckItem(pfMenu, "Show message buffer", true, SHOW_BUFFER_S); focusOnClick = createCheckItem(pfMenu, - "Focus to closest node on mouse click", false,FOCUS_ON_CLICK_S); + "Focus to closest node on mouse click", true,FOCUS_ON_CLICK_S); enableMapGraphic = createCheckItem(pfMenu,"Show map graphic", true, null); diff --git a/src/gui/playfield/PlayField.java b/src/gui/playfield/PlayField.java index 743c2a131a58107d9dcf52b9947b028aa91461f3..858895810056b591c7791cff97411757b164c7cd 100644 --- a/src/gui/playfield/PlayField.java +++ b/src/gui/playfield/PlayField.java @@ -341,12 +341,16 @@ public class PlayField extends JPanel implements VhmListener { closestDist = dist; } } - highlightedHosts.clear(); - highlightedHosts.add(closest); - NodeGraphic.setHighlightedNodes(highlightedHosts); gui.setFocus(closest); + highlightHost(closest); + } + + public void highlightHost(DTNHost host) { + highlightedHosts.clear(); + highlightedHosts.add(host); + NodeGraphic.setHighlightedNodes(highlightedHosts); this.updateField(); }