📄 simplechess.java
字号:
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.Container;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JApplet;
import javax.swing.JButton;
import javax.swing.JColorChooser;
public class simplechess extends JApplet{
mychess chessboard;
JButton change;
public void init(){
Container cont =getContentPane();
cont.setLayout(new BorderLayout());
chessboard =new mychess();
cont.add("Center",chessboard);
change=new JButton("change");
cont.add("South",change);
change.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e){
Color board=JColorChooser.showDialog(simplechess.this, "棋盘颜色", chessboard.getBackground());
chessboard.setBackground(board);
}
});
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -