File tree Expand file tree Collapse file tree
src/main/java/com/CDPrintable Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -111,12 +111,15 @@ public void mouseClicked(MouseEvent e) {
111111 // CD Search Panel set up
112112 cdSearchPanel .setBorder (BorderFactory .createTitledBorder ("Search" ));
113113
114+ // Make the input field
114115 JTextField searchField = new JTextField (15 );
115116
117+ // Search type combo box set up
116118 JComboBox <String > searchTypeComboBox = new JComboBox <>(new String [] {"CDStub" , "Artist" , "Release" });
117119
118120 // Search button and event listener setup
119121 JButton searchButton = new JButton ("Search" );
122+
120123 searchButton .addActionListener (_ -> {
121124 if (searchTypeComboBox .getSelectedItem () == null ) {
122125 return ;
@@ -175,6 +178,9 @@ public void mouseClicked(MouseEvent e) {
175178 });
176179 });
177180
181+ // Set up enter key and text box
182+ searchField .addActionListener (_ -> searchButton .doClick ());
183+
178184 cdSearchPanel .setLayout (new FlowLayout ());
179185 cdSearchPanel .add (searchTypeComboBox );
180186 cdSearchPanel .add (searchField );
You can’t perform that action at this time.
0 commit comments