diff options
| author | 2019-05-11 08:50:01 +0200 | |
|---|---|---|
| committer | 2019-05-11 08:50:01 +0200 | |
| commit | 6f1648c99408d000792a23d41a6d0ba3aee008f0 (patch) | |
| tree | a1745746e26307843777099c5be546ac4c77e963 /src/main/java/cuchaz/enigma/gui/panels | |
| parent | Fix tests by properly declaring test input classes (#130) (diff) | |
| download | enigma-fork-6f1648c99408d000792a23d41a6d0ba3aee008f0.tar.gz enigma-fork-6f1648c99408d000792a23d41a6d0ba3aee008f0.tar.xz enigma-fork-6f1648c99408d000792a23d41a6d0ba3aee008f0.zip | |
Support navigation to declaration on ctrl+click
Diffstat (limited to 'src/main/java/cuchaz/enigma/gui/panels')
| -rw-r--r-- | src/main/java/cuchaz/enigma/gui/panels/PanelEditor.java | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/main/java/cuchaz/enigma/gui/panels/PanelEditor.java b/src/main/java/cuchaz/enigma/gui/panels/PanelEditor.java index 9b01631..f766743 100644 --- a/src/main/java/cuchaz/enigma/gui/panels/PanelEditor.java +++ b/src/main/java/cuchaz/enigma/gui/panels/PanelEditor.java | |||
| @@ -12,11 +12,7 @@ import java.awt.event.MouseAdapter; | |||
| 12 | import java.awt.event.MouseEvent; | 12 | import java.awt.event.MouseEvent; |
| 13 | 13 | ||
| 14 | public class PanelEditor extends JEditorPane { | 14 | public class PanelEditor extends JEditorPane { |
| 15 | private final Gui gui; | ||
| 16 | |||
| 17 | public PanelEditor(Gui gui) { | 15 | public PanelEditor(Gui gui) { |
| 18 | this.gui = gui; | ||
| 19 | |||
| 20 | this.setEditable(false); | 16 | this.setEditable(false); |
| 21 | this.setSelectionColor(new Color(31, 46, 90)); | 17 | this.setSelectionColor(new Color(31, 46, 90)); |
| 22 | this.setCaret(new BrowserCaret()); | 18 | this.setCaret(new BrowserCaret()); |
| @@ -66,6 +62,14 @@ public class PanelEditor extends JEditorPane { | |||
| 66 | default: | 62 | default: |
| 67 | break; | 63 | break; |
| 68 | } | 64 | } |
| 65 | |||
| 66 | gui.setShouldNavigateOnClick(event.isControlDown()); | ||
| 67 | } | ||
| 68 | |||
| 69 | @Override | ||
| 70 | public void keyReleased(KeyEvent event) { | ||
| 71 | super.keyReleased(event); | ||
| 72 | gui.setShouldNavigateOnClick(event.isControlDown()); | ||
| 69 | } | 73 | } |
| 70 | }); | 74 | }); |
| 71 | } | 75 | } |