X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;ds=sidebyside;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsonitus%2Fgui%2FPipelinePanel.java;h=14c0b7753014c870335dac830026ab92833f3cf7;hb=c312becee5e66f399304efa8f56eb2bce79f99ab;hp=4b1527cc9798ee151106ca4e7708bc83f8db81b6;hpb=cb78e23372643d53b4cb731ae8c7c494b0752111;p=sonitus.git diff --git a/src/main/java/net/pterodactylus/sonitus/gui/PipelinePanel.java b/src/main/java/net/pterodactylus/sonitus/gui/PipelinePanel.java index 4b1527c..14c0b77 100644 --- a/src/main/java/net/pterodactylus/sonitus/gui/PipelinePanel.java +++ b/src/main/java/net/pterodactylus/sonitus/gui/PipelinePanel.java @@ -55,7 +55,7 @@ public class PipelinePanel extends JPanel { private final Pipeline pipeline; /** The component hover listeners. */ - private final EventListenerList componentHoverListeners = new EventListenerList(); + private final EventListenerList componentSelectionListeners = new EventListenerList(); /** * Creates a new pipeline panel displaying the given pipeline. @@ -74,13 +74,13 @@ public class PipelinePanel extends JPanel { // /** - * Adds the given component hover listener to this panel. + * Adds the given component selection listener to this panel. * - * @param componentHoverListener - * The component hover listener to add + * @param componentSelectionListener + * The component selection listener to add */ - public void addComponentHoverListener(ComponentHoverListener componentHoverListener) { - componentHoverListeners.add(ComponentHoverListener.class, componentHoverListener); + public void addComponentHoverListener(ComponentSelectionListener componentSelectionListener) { + componentSelectionListeners.add(ComponentSelectionListener.class, componentSelectionListener); } // @@ -131,14 +131,15 @@ public class PipelinePanel extends JPanel { */ private void addControlled(final ControlledComponent controlledComponent, int level, int position, int width, ControlledComponent parentComponent) { /* create a GUI component that displays the component. */ - JPanel componentPanel = createComponentPanel(controlledComponent, parentComponent); + final JPanel componentPanel = createComponentPanel(controlledComponent, parentComponent); componentPanel.addMouseListener(new MouseAdapter() { @Override - public void mouseEntered(MouseEvent mouseEvent) { - for (ComponentHoverListener componentHoverListener : componentHoverListeners.getListeners(ComponentHoverListener.class)) { - componentHoverListener.componentEntered(controlledComponent); + public void mouseClicked(MouseEvent e) { + for (ComponentSelectionListener componentSelectionListener : componentSelectionListeners.getListeners(ComponentSelectionListener.class)) { + componentSelectionListener.componentSelected(controlledComponent); } + selectedComponent = componentPanel; } }); @@ -198,7 +199,7 @@ public class PipelinePanel extends JPanel { * * @author David ‘Bombe’ Roden */ - public static interface ComponentHoverListener extends EventListener { + public static interface ComponentSelectionListener extends EventListener { /** * Notifies the listener that the mouse is now over the given controlled @@ -207,7 +208,7 @@ public class PipelinePanel extends JPanel { * @param controlledComponent * The controlled component now under the mouse */ - void componentEntered(ControlledComponent controlledComponent); + void componentSelected(ControlledComponent controlledComponent); }