// Variablenboolean b1;boolean b2;boolean b3;JRadioButton button1;JRadioButton button2;JRadioButton button3;
// Button Objekte erzeugenJMenuItem button1 = new JRadioButtonMenuItem("Kryptomania", true);JMenuItem button2 = new JRadioButtonMenuItem("Substitution");JMenuItem button3 = new JRadioButtonMenuItem("Exklusiv Oder");// ButtonGroup anlegenButtonGroup group = new ButtonGroup();// Buttons intgrierengroup.add(button1);group.add(button2);group.add(button3);// Buttons ins Untermenü aufnehmenmenü3.add(button1);menü3.add(button2);menü3.add(button3);// Buttons beim ActionListener anmeldenbutton1.addActionListener(new MeinActionLauscher ());button2.addActionListener(new MeinActionLauscher ());button3.addActionListener(new MeinActionLauscher ());
if(button1.isSelected()) { b1 = true; b2 = false; b3 = false;}if(button2.isSelected()) { b1 = false; b2 = true; b3 = false;}if(button3.isSelected()) { b1 = false; b2 = false; b3 = true;}
class MeinActionLauscher implements ActionListener{ public void actionPerformed(ActionEvent e) { String Label; Label = e.getActionCommand(); if(Label.equals(">>>")) abfrage(); } }// Unterprogrammevoid abrage (boolean b1, boolean b2, boolean b3){ if (b1 == true) kryptomania(); if (b2 == true) substitution(); if (b3 == true) exklusivoder();}