示例#1
0
 public Queen(ChessColor color, Integer x, Integer y) {
   this.pieceName = "Q";
   this.x = x;
   this.y = y;
   this.color = color;
   if (color.isWhite()) {
     BufferedImage bi;
     try {
       File img = new File(whiteQueenFile);
       bi = ImageIO.read(img);
       image = new BufferedImage(64, 64, BufferedImage.TYPE_INT_ARGB_PRE);
       Graphics g = image.getGraphics();
       g.drawImage(bi.getScaledInstance(64, 64, Image.SCALE_SMOOTH), 0, 0, null);
     } catch (IOException e) {
       e.printStackTrace();
     }
   } else {
     BufferedImage bi;
     try {
       File img = new File(blackQueenFile);
       bi = ImageIO.read(img);
       image = new BufferedImage(64, 64, BufferedImage.TYPE_INT_ARGB_PRE);
       Graphics g = image.getGraphics();
       g.drawImage(bi.getScaledInstance(64, 64, Image.SCALE_SMOOTH), 0, 0, null);
     } catch (IOException e) {
       e.printStackTrace();
     }
   }
 }