From c0db239fdc95b5be6ff9ecddeab7fdbd92e9e0f4 Mon Sep 17 00:00:00 2001 From: David <67387813+DavidColetta@users.noreply.github.com> Date: Fri, 10 Feb 2023 17:38:44 -0500 Subject: [PATCH] Pressing ENTER is the same as pressing Go putton in rule search --- .../rpi/legup/ui/proofeditorui/rulesview/RulePanel.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/main/java/edu/rpi/legup/ui/proofeditorui/rulesview/RulePanel.java b/src/main/java/edu/rpi/legup/ui/proofeditorui/rulesview/RulePanel.java index f0deab1d6..5db7beeb4 100644 --- a/src/main/java/edu/rpi/legup/ui/proofeditorui/rulesview/RulePanel.java +++ b/src/main/java/edu/rpi/legup/ui/proofeditorui/rulesview/RulePanel.java @@ -8,6 +8,7 @@ import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; +import java.awt.event.KeyEvent; import java.util.ArrayList; import java.util.List; @@ -204,7 +205,7 @@ public void setSearchBar(Puzzle allPuzzle){ searchBarPanel.add(textField); searchBarPanel.add(Box.createRigidArea(new Dimension(1, 0))); JButton findButton = new JButton("Go"); - findButton.addActionListener(new ActionListener() { + ActionListener action = new ActionListener() { @Override public void actionPerformed(ActionEvent event) { if (ruleButtons != null) { @@ -234,7 +235,9 @@ public void actionPerformed(ActionEvent event) { } } - }); + }; + textField.addActionListener(action); + findButton.addActionListener(action); searchBarPanel.add(findButton); }