ActionListener not responding (JRadioButton)
Hi all
I have a JMenuBar with a couple of JMenu's. One of them has a couple of JRadioButtons which, when clicked, do not trigger an event.
The situation ( simplified). I have 2 classes, MainClass.java and TheToolBar.java.
MainClass.java:publicclass MainClassextends JApplet{
protected TheMenuBar tmb;
.....
privatevoid jbInit()throws Exception{
tmb =new TheMenuBar(new ToolBarAction());
.......// other things that make the frame visible
}
publicclass ToolBarActionimplements ActionListener{
public ToolBarAction(){}
publicvoid actionPerformed(ActionEvent e)
{
System.out.println("action....") ;
}
}
}
TheToolBar: import........
publicclass TheMenuBarextends JMenuBar{
public TheMenuBar(ActionListener a){
JMenu jm =new JMenu();
RadioButton jmi =new JRadioButton();
jmi.setText("click me");
jmi.addActionListener(tba);
jm.add(jmi) ;
this.add(jm) ;
// and init other JMs
}
}
This is basically what happens, and the result is that I cannot select the radio button. I wonder if anyone can see what I do wrong here (I have the feeling it is something very basic)
Thnx a lot
LuCa

