Java:
package testing;
import java.awt.BorderLayout;
import javax.swing.JPasswordField;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JRadioButton;
/**
*
* @author Jonas
*/
public class Testing {
static JPasswordField pwf = new JPasswordField();
static JFrame frame = new JFrame("RadioButton Test");
static JLabel label = new JLabel("Nicht unSelecten");
static JRadioButton radio = new JRadioButton();
public static void main(String[]args) {
createFrame();
}
public static void msg(Object ob) {
System.out.print(ob);
}
public static void createFrame() {
frame.add(radio, BorderLayout.NORTH);
frame.add(label, BorderLayout.CENTER);
radio.setSelected(true);
frame.setDefaultCloseOperation(frame.EXIT_ON_CLOSE);
frame.setVisible(true);
frame.setSize(400, 205);
frame.setResizable(false);
if (!radio.isSelected()) {
frame.setVisible(false);
}
}
}
Der Grundgedanke ist, dass wenn ich den Radiobutton unselecte, dass das Fenster unsichtbar wird.
Leider passiert rein gar nichts.
Wäre froh über einbisschen Hilfe