コード例 #1
0
    @Override
    public void paint(Graphics g) {
      Graphics2D g2 = (Graphics2D) g;
      if (this.getModel().isPressed()) {
        g2.setColor(Colors.GRAY);
        g2.fillRect(0, 0, this.getWidth(), this.getHeight());
      } else {
        g2.setColor(Colors.GRAY.darker());
        g2.fillRect(0, 0, this.getWidth(), this.getHeight());
      }

      g2.setColor(Color.WHITE);
      int size;
      size = Math.min((this.getHeight() - 4) / 6, (this.getWidth() - 4) / 6);
      size = Math.max(size, 2);
      this.paintTriangle(
          g, (this.getWidth() - size) / 2, (this.getHeight() - size) / 2, 8, this.dir, true);
    }
コード例 #2
0
    @Override
    public void paint(Graphics g) {
      Graphics2D g2 = (Graphics2D) g;
      Antialias.on(g2);
      g2.setColor(Colors.GRAY.darker());
      g2.fillRect(0, 0, this.getWidth(), this.getHeight());
      g2.setFont(TheCube.FONT.deriveFont(12.0F));

      if (this.username != null && this.head != null) {
        int x = 5;
        int y = 5;
        g2.drawImage(this.head, x, y, 64, 64, null);
        g2.setColor(Color.WHITE);
        x += 69;
        y = (this.getHeight() - g2.getFontMetrics().getAscent()) / 2;
        g2.drawString(this.username, x, y + g2.getFontMetrics().getAscent());
      }
      Antialias.off(g2);
    }