📄 restart.java
字号:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Restart extends JFrame{
private Label laber;
private JRadioButton begin;
public Restart()
{
super("Restart Game");
laber=new Label("Would you like to play again?");
Container container=getContentPane();
container.setLayout(new FlowLayout());
container.add(laber);
begin=new JRadioButton("Restart",false);
container.add(begin);
begin.addItemListener(new RadioButtonHandle());
setSize(300,100);
setVisible(true);
setLocationRelativeTo(getParent());
setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
}
private class RadioButtonHandle implements ItemListener
{
public void itemStateChanged(ItemEvent event)
{
if((JRadioButton)event.getItem()==begin)
{
CheckBox box=new CheckBox();
}
else
dispose();
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -