62,612
社区成员
发帖
与我相关
我的任务
分享
public class TestFrame extends JFrame implements ActionListener{
private JButton jbutton = new JButton("打开选题窗口");
private ChoiceFrame choiceFrame;
public TestFrame(){
jbutton.addActionListener(this);
this.add(jbutton);
this.setBounds(200,200,500,400);
this.setVisible(true);
}
public static void main(String[] args){
new TestFrame();
}
public void actionPerformed(ActionEvent e){
choiceFrame = new ChoiceFrame();
this.dispose();
}
}
class ChoiceFrame extends JFrame {
public ChoiceFrame(){
this.setTitle("选题");
this.setBounds(400,400,400,400);
this.setVisible(true);
}
}