Skip to content

Commit 6a6afd4

Browse files
author
Antonio Maulucci
authored
Add files via upload
1 parent 40b6024 commit 6a6afd4

File tree

1 file changed

+120
-0
lines changed

1 file changed

+120
-0
lines changed

HashSet/HashSet-1/com_antomau_HashSet/HashSetUserInterface/UserHashSet.java

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,126 @@ public void actionPerformed (ActionEvent e)
144144

145145

146146

147+
148+
149+
150+
151+
152+
153+
154+
155+
156+
157+
158+
159+
160+
class searchButtonListenerClass implements ActionListener
161+
{
162+
@Override
163+
public void actionPerformed (ActionEvent e)
164+
{
165+
contentPanel.removeAll();
166+
167+
JPanel mainInternalPanel = new JPanel();
168+
mainInternalPanel.setLayout(new GridLayout(2,1));
169+
170+
171+
172+
JPanel searchPanel = new JPanel();
173+
searchPanel.setLayout(new GridLayout(1,3));
174+
175+
JPanel dataPanel = new JPanel();
176+
dataPanel.setLayout(new GridLayout(3,2));
177+
178+
JLabel l1 = new JLabel("Author:");
179+
JLabel l2 = new JLabel ("Title:");
180+
JLabel l3 = new JLabel("Year:");
181+
JTextField jtf1 = new JTextField();
182+
JTextField jtf2 = new JTextField();
183+
JTextField jtf3 = new JTextField();
184+
185+
dataPanel.add(l1);
186+
dataPanel.add(l2);
187+
dataPanel.add(l3);
188+
dataPanel.add(jtf1);
189+
dataPanel.add(jtf2);
190+
dataPanel.add(jtf3);
191+
192+
193+
JPanel typePanel = new JPanel(); //this panel will be user to choose what data find
194+
typePanel.setLayout(new GridLayout(4,1));
195+
196+
JLabel typeLabel = new JLabel("What data do you want to find?");
197+
ButtonGroup typeGroup = new ButtonGroup();
198+
JRadioButton authorButton = new JRadioButton("Author");
199+
JRadioButton titleButton = new JRadioButton("Title");
200+
JRadioButton yearButton = new JRadioButton("Year");
201+
202+
typePanel.add(typeLabel); //1,1
203+
typePanel.add(authorButton); //2,1
204+
typePanel.add(titleButton); //3,1
205+
typePanel.add(yearButton); //4,1
206+
207+
208+
JButton button = new JButton("Find");
209+
210+
211+
searchPanel.add(dataPanel); //1,1
212+
searchPanel.add(typePanel); //1,2
213+
searchPanel.add(button); //1,3
214+
215+
216+
217+
mainInternalPanel.add(searchPanel); //1,1
218+
219+
contentPanel.add(mainInternalPanel);
220+
221+
class buttonListenerClass implements ActionListener
222+
{
223+
@Override
224+
public void actionPerformed(ActionEvent e)
225+
{
226+
JPanel resultsPanel = new JPanel();
227+
228+
JLabel resultsLabel = new JLabel();
229+
/*
230+
if (authorButton.isSelected()) resultsLabel.setText(mySet.findAuthor(jtf1.getText()));
231+
else if (titleButton.isSelected()) resultsLabel.setText(mySet.findTitle(jtf1.getText()));
232+
else if (yearButton.isSelected()) resultsLabel.setText(mySet.findYear(Integer.parseInt(jtf1.getText())));
233+
*/
234+
resultsPanel.add(resultsLabel);
235+
236+
mainInternalPanel.add(resultsPanel); //2,1
237+
f.pack();
238+
} //end of internal actionPerformed
239+
} //end of buttonListenerClass
240+
241+
button.addActionListener(new buttonListenerClass());
242+
243+
f.pack();
244+
} //end of actionPerformed
245+
} //end of exitButtonListenerClass
246+
247+
ActionListener searchButtonListener = new searchButtonListenerClass();
248+
searchButton.addActionListener(searchButtonListener);
249+
250+
251+
252+
253+
254+
255+
256+
257+
258+
259+
260+
261+
262+
263+
264+
265+
266+
147267
} //end of main
148268

149269

0 commit comments

Comments
 (0)