Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Swing ActionListener probelm

843807Apr 2 2003 — edited Apr 2 2003
I have create my own panel containing 4 buttons

addButton = new JButton("Add");
addButton.addActionListener(this);

This gets added into a mainPanel which is then called to make up part of the JFrame:
bp = new bottomPanel();

My problem is that I can't get the actionListener to work. If I put it in my own panel then it knows nothing of the overall panel that I want to be able to change on the press of the add button. And I can't figure out how to get it to work from the main JFrame. Is it possible to create the Listener as a separate class and create an instance of it inside the Panel/Frame to call the required operation???

I'd really appreciate any help at all!!
Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 30 2003
Added on Apr 2 2003
1 comment
60 views