posted 12 years ago
Hi,
I have a problem that made me to spend 20hrs with no luck. Here is the problem. I have a program with 3 classes. Main, ClassA, ClassB. Main Class is just a simple main method to load JFrame in class A. In class A I got a JList and a JButton. So whenever I press this button, it loads Class B. In class B I got another button that its job is to add items to the JList in ClassA. Let's say when ever I press that button, it does Button.addElement("Item");
I made the layout but the problem is because they are in separate classes they cant link well. I guess I could not pass the instance. Anyway here is the code for each class:
Main Window:
ClassA:
ClassB:
So when I press the add button in classB it gives lots of errors and basically doesn't work. Any idea?
Thanks in advance.