Hallo,
ich komme mit diesem Problem irgendwie nicht weiter:
Ich habe 10 JRadioButton's, wenn einer aktiviert wird, sollen die anderen deaktiviert werden.
Wird der Aktivierte deaktiviert, sind wieder alle anwählbar.
Hab dies schon ausprobiert:
Die Exception kam erst, nachdem ich "myRadioA[0]=(myJRadioButton)pinkieR;" usw. hinzugefügt hatte.
Habt Ihr einen Tipp für mich?
Vielen Dank.
ich komme mit diesem Problem irgendwie nicht weiter:
Ich habe 10 JRadioButton's, wenn einer aktiviert wird, sollen die anderen deaktiviert werden.
Wird der Aktivierte deaktiviert, sind wieder alle anwählbar.
Hab dies schon ausprobiert:
Code:
...
private myJRadioButton pinkieR, ringFingerR, middleFingerR, indexFingerR, thumbR;
private myJRadioButton[] myRadioA;
...
pinkieR = new myJRadioButton("pinkie");
pinkieR.addItemListener(this);
pinkieR.setRadioName("pinkieR");
ringFingerR = new myJRadioButton("ring finger");
ringFingerR.addItemListener(this);
ringFingerR.setRadioName("ringFingerR");
...
myRadioA[0]=(myJRadioButton)pinkieR; //Hier bekomme ich die Exception: *1 (ConfigDialogMain.java:250)
myRadioA[1]=ringFingerR;
myRadioA[2]=middleFingerR;
myRadioA[3]=indexFingerR;
myRadioA[4]=thumbR;
...
//ItemListener:
...
if (state == ItemEvent.SELECTED) {
//Selected
for(int i=0;i==myRadioA.length;i++){ //hier bin ich auch noch nicht Sicher, wie's umzusetzen geht
if(myRadioA[i].getRadioName()!=radiolabel){
myRadioA[i].setEnabled(false);
}
else{
myRadioA[i].setEnabled(true);
}
}
else {
//Radio DESELECTED
}
/*//EXEPTION *1:
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at View.config.ConfigDialogMain.<init>(ConfigDialogMain.java:250)
at View.main.LegoFprViews.createConfigView(LegoFprViews.java:300)
at Controller.main.FprController.showConfig(FprController.java:63)
at View.main.LegoFprViews.actionPerformed(LegoFprViews.java:456)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.AbstractButton.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
*/
Die Exception kam erst, nachdem ich "myRadioA[0]=(myJRadioButton)pinkieR;" usw. hinzugefügt hatte.
Habt Ihr einen Tipp für mich?
Vielen Dank.