public class MFrame extends JFrame {
public static void main(String[] args) {
new MFrame();
}
public MFrame() {
this.setTitle("五子棋小游戏");
this.setSize(500,500);
this.setLocationRelativeTo(null); //居中
this.setResizable(false); //不可调整大小
this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); //按×关闭
this.setLayout(null);
JLabel boardLabel = new JLabel(new ImageIcon("imgs/rp.png"));
boardLabel.setSize(300,300);
boardLabel.setLocation(50,50);
add(boardLabel);
setVisible(true); //是否可见
}
}
添加图片,总是有锯齿,如何设置抗锯齿