So basically I have an array saved in class, I then have a separate class which brings up a form. I wish to use this form to search within the array, i later want to work with the array to edit it.
class to hold array
class to hold form
*any suggestions, I have tried placing the array in a method and calling it using EventData.Ent however this didn't work eitherpublic class Picker { public static void main(String[] args ) { final JTextField t = new JTextField(0); final JTextField t1 = new JTextField(40); JButton b = new JButton("Open Calendar"); JLabel l1 = new JLabel("Event"); JPanel p = new JPanel(); p.add(b); p.add(l1); p.add(t1); final JFrame f = new JFrame(); f.getContentPane().add(p); f.pack(); f.setVisible(true); b.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ae) { //*If the array is set here the code works fine, // outside of the actionListener and it doesn't work* /* String[] Event; Event = new String[2]; Event[0] = ""; Event[1] = "01-01-2013 -- Closed"; /* t.setText(new DatePicker(f).setPickedDate()); String input = t.getText(); for(String ent: Event) { if(ent.startsWith(input)){ t1.setText("" + ent); } else { t1.setText ("No Event"); } } } } ); } }