package test;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JButton;
import javax.swing.JCheckBox;
import javax.swing.JFrame;
public class Test {
private static class A extends JFrame {
{
JButton b = new JButton("click");
add(b);
pack();
b.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
B f = new B();
f.cb.setSelected(true);
}
});
setDefaultCloseOperation(EXIT_ON_CLOSE);
}
};
private static class B extends JFrame {
public JCheckBox cb = new JCheckBox("Hallo");
{
add(cb);
pack();
setVisible(true);
}
};
public static void main(String[] args) {
new A().setVisible(true);
}
}