// 设置item3的鼠标点击事件,设置黑方先行
item3.addMouseListener(new MouseListener() {
@Override
public void mouseReleased(MouseEvent e) {
// TODO Auto-generated method stub
}
@Override
public void mousePressed(MouseEvent e) {
// TODO Auto-generated method stub
Icon icon = new Icon() {
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
// TODO Auto-generated method stub
}
@Override
public int getIconWidth() {
// TODO Auto-generated method stub
return 0;
}
@Override
public int getIconHeight() {
// TODO Auto-generated method stub
return 0;
}
};
Object[] options = { "保存并重新开始游戏", "不,谢谢" };
int n = JOptionPane.showOptionDialog(null, "是否保存设置并重新开始", "人机博弈设置", 0, 1, icon, options, "保存并重新开始游戏");
if (n == 0) {
panel.setIsBlack(true);
panel.Start();
item3.setSelected(true);
}
}
@Override
public void mouseExited(MouseEvent e) {
// TODO Auto-generated method stub
}
@Override
public void mouseEntered(MouseEvent e) {
// TODO Auto-generated method stub
}
@Override
public void mouseClicked(MouseEvent e) {
// TODO Auto-generated method stub
}
});
// 设置item4的鼠标点击事件
item4.addMouseListener(new MouseListener() {
@Override
public void mouseReleased(MouseEvent e) {
// TODO Auto-generated method stub
}
@Override
public void mousePressed(MouseEvent e) {
// TODO Auto-generated method stub
Icon icon = new Icon() {
@Override
public void paintIcon(Component c, Graphics g, int x, int y) {
// TODO Auto-generated method stub
}
@Override