This is what I have so far, but I don't know how to set up a sequential search for the array numbers.
public class Assignment implements ActionListener{
private JPanel panel;
private JLabel label, label2;
private JTextField text, text2;
private JButton button, clear;
private String[] numbers = { "5658845, 4520125, 7895122, 8777541, 8451277, 1302850, 8080152, 4562555, 5552012, 5050552, 7825877, 1250255, 1005231, 6545231, 3852085, 7576651, 7881200, 4581002" };
public Assignment(){
JFrame gui = new JFrame();
gui.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
gui.setTitle("College Expenses");
gui.setSize(325, 150);
panel = new JPanel(new GridLayout(3, 2));
gui.add(panel);
gui.setVisible(true);
label = new JLabel("Charge Card Number");
label2 = new JLabel("Results");
text = new JTextField("" , 10);
text2 = new JTextField("" , 10);
text2.setEditable(false);
button = new JButton("Enter");
clear = new JButton("Clear");
panel.add(label);
panel.add(text);
panel.add(label2);
panel.add(text2);
panel.add(clear);
clear.addActionListener(this);
panel.add(button);
button.addActionListener(this);
}
public static void main(String[] args) {
new Assignment();
}
@Override
public void actionPerformed(ActionEvent e) {
String action = e.getActionCommand();
if (action.equals("Clear")) {
text.setText("");
text2.setText("");
}
else if (action.equals("Enter")) {
}
}
}