![]() |
Chat on IRC |
actionListener in java
Posted by ktf [send private reply] at September 29, 2002, 05:17:22 AM
I am having trouble trying to get a simple program to update the JPanel with a new figure using actionListeners. The program compiles but does absolutely nothing when the buttons are clicked. The logic I have used is;
public void actionPerformed(ActionEvent evt){ Object source = evt.getsource(); if(source == gaussianButton){ update(gaussianButton); } else { update(parabolicButton); } I have set up an update method, is the problem likely to be there?
Posted by taubz [send private reply] at September 29, 2002, 10:23:24 AM
Did you make the class that contains actionPerformed an action listener of the JPanel, or is the actionPerformed method within your JPanel class?
Test whether the actionPerformed function is being called by adding a System.err.println call and looking at the console. - taubz
Posted by Psion [send private reply] at September 29, 2002, 10:23:53 AM
Did you register the actionListeners with the appropriate objects? If so, the problem is probably with your update method.
Register as a new user | |||||