示例#1
0
 void drawRoiLabel(Graphics g, int index, Roi roi) {
   Rectangle r = roi.getBounds();
   int x = screenX(r.x);
   int y = screenY(r.y);
   double mag = getMagnification();
   int width = (int) (r.width * mag);
   int height = (int) (r.height * mag);
   int size = width > 40 && height > 40 ? 12 : 9;
   if (font != null) {
     g.setFont(font);
     size = font.getSize();
   } else if (size == 12) g.setFont(largeFont);
   else g.setFont(smallFont);
   boolean drawingList = index >= LIST_OFFSET;
   if (drawingList) index -= LIST_OFFSET;
   String label = "" + (index + 1);
   if (drawNames && roi.getName() != null) label = roi.getName();
   FontMetrics metrics = g.getFontMetrics();
   int w = metrics.stringWidth(label);
   x = x + width / 2 - w / 2;
   y = y + height / 2 + Math.max(size / 2, 6);
   int h = metrics.getAscent() + metrics.getDescent();
   if (bgColor != null) {
     g.setColor(bgColor);
     g.fillRoundRect(x - 1, y - h + 2, w + 1, h - 3, 5, 5);
   }
   if (!drawingList && labelRects != null && index < labelRects.length)
     labelRects[index] = new Rectangle(x - 1, y - h + 2, w + 1, h);
   g.setColor(labelColor);
   g.drawString(label, x, y - 2);
   g.setColor(defaultColor);
 }
  public void paintComponent(Graphics g) { // paintComponent

    super.paintComponent(g); // refresh screen (paint background)

    Font f = new Font("Helvetica", Font.BOLD, 40);
    g.setFont(f);
    g.drawString("DON'T ABUSE", 40, 130);
    g.drawString("SUBSTANCES", 40, 180);
    f = new Font("Helvetica", Font.BOLD, 50);
    g.setFont(f);
    g.drawString("KIDS", 120, 240);
  }
  public void drawVictory(Graphics g) {
    g.setColor(new Color(0, 0, 0, 200));
    g.fillRect(195, 220, 410, 110);
    g.setColor(new Color(255, 255, 255, 200));
    g.fillRect(200, 225, 400, 100);
    g.setColor(new Color(0, 0, 0, 200));
    g.setFont(new Font("Bell MT", Font.BOLD, 20));
    FontMetrics metrics = g.getFontMetrics(new Font("Bell MT", Font.BOLD, 20));
    int hgt = metrics.getHeight();

    String initialMessage;
    String followupMessage;

    if (nextWindow) {
      initialMessage = "You have gotten stronger.";
      followupMessage = player.getName() + " is now level " + player.getLevel() + "!";
    } else {
      initialMessage = "You survived!";
      followupMessage = "You and your allies gain " + totalExperience + " experience!";
    }

    // Hgt = 26
    int adv = metrics.stringWidth(initialMessage);
    g.drawString(initialMessage, getWidth() / 2 - adv / 2, 234 + hgt);
    adv = metrics.stringWidth(followupMessage);
    g.drawString(followupMessage, getWidth() / 2 - adv / 2, 269 + hgt);
  }
示例#4
0
  /**
   * Function: drawNode Pre: Takes a graphics object g to draw on. Also takes two ints (x_size,
   * y_size) defining the screen size Also takes a node radius r Post: Prints out this node to the
   * screen appropriately
   */
  public void drawNode(Graphics g, int x_size, int y_size, int r) {
    // Don't print nodes that aren't activated
    if (!activated) return;

    // First, get some stats based on the Graphics area size
    // In particular, the size of the Node
    int px = (int) (x_size * x) - r; // X & Y positions
    int py = (int) (y_size * y) - r;

    // Set the font to appropriate no matter what
    // int sizor;    //The size for the text, based on radius
    g.setFont(new Font("Serif", Font.BOLD, r));

    // Find the color for the text, it's used often... we'll do this later now
    // String textcol = getOtherTextColor(color);  MOOF!  UPDATE THIS LATER!
    // Make sure the color is correct no matter what... adjust also later!

    // Node insides... get this color correct later, moof!
    g.setColor(getMyJavaColor());
    // g.setColor(Color.white);
    g.fillOval(px, py, r * 2, r * 2);

    // Node border
    g.setColor(getJavaColor(getOtherNodeColor(color)));
    g.drawOval(px, py, r * 2, r * 2);

    // Text inside... set up to be centered
    py = py + r + (int) (g.getFontMetrics().getAscent() / 2.2);
    px = px + r - (g.getFontMetrics().stringWidth("" + cindex) / 2);
    g.drawString("" + cindex, px, py);
  }
示例#5
0
 // färger, se sid 43 i boken
 // grafiska metoder, sid 248 i boken
 public void paintComponent(Graphics g) { // för att vara säker på att
   // "super"-klassen gör sitt
   // anropar vi den metoden, innan
   // vi skriver eller ritar
   super.paintComponent(g);
   g.drawLine(185, 10, 195, 40); // x1,y1 till x2,y2
   g.drawLine(200, 10, 200, 40);
   g.drawLine(215, 10, 205, 40);
   g.setColor(Color.white);
   g.fillOval(50, 30, 300, 150); // x,y,b,h (x,y för ö v h)
   g.setColor(Color.red);
   g.drawArc(100, 100, 200, 50, 180, 180); // x,y,b,h,s,l
   g.setColor(Color.yellow);
   g.fillRect(200, 100, 30, 30);
   g.fill3DRect(150, 50, 30, 50, true); // true upphöjd figur
   g.fill3DRect(250, 50, 30, 50, true);
   // skriv ut en textsträng, samt ange läget i avståndet från
   // övre vänstra hörnet i x-led åt höger och i y-led neråt
   g.drawString("** Tjenare kompis !! **", 20, 20);
   f = new Font("Arial", Font.BOLD, 30);
   setBackground(Color.cyan);
   g.setFont(f);
   g.setColor(new Color(255, 175, 175));
   g.drawString("YEEEEEEEES!!", 100, 250);
 }
 public void paint(Graphics g) {
   Font f = new Font("TimesRoman", Font.BOLD, 14);
   g.setFont(f);
   g.setColor(Color.red);
   setBackground(Color.blue);
   g.drawString("Hello Java", 30, 100);
 }
示例#7
0
  public void keyPressed(KeyEvent e) {
    if (e.getKeyCode() == KeyEvent.VK_ESCAPE && gamerunner.running) {

      Graphics gr = this.getGraphics();
      gr.setFont(new Font("TimesRoman", Font.PLAIN, 40));
      gr.drawString("PAUSE", (int) this.getWidth() / 2, this.getHeight() / 2);
      if (!online) {
        gamerunner.running = false;
      }
      if (soundan) {} // end of if
      Menu menu = new Menu(this);
      // volume.setValue(vol);
    } else if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
      gamerunner.running = true;
      if (soundan) {} // end of if
    } // end of if-else
    else if (e.getKeyCode() == KeyEvent.VK_R && !online) {
      restartGame();
    } else if (e.getKeyCode() == KeyEvent.VK_F11) {
      dispose();
      setUndecorated(true);
      String[] arguments = {"fullscreen"};
      new JavaGame(arguments);
    } else if (e.getKeyCode() == KeyEvent.VK_ENTER && online) {
      String message =
          JOptionPane.showInputDialog(null, "Chat", "Nachricht", JOptionPane.PLAIN_MESSAGE);
      try {
        if (!message.isEmpty()) {
          client.sendNewChatMessage(player[client.id].name, message);
        }
      } catch (IOException e1) {
        e1.printStackTrace();
      }
    }
  }
示例#8
0
  // draws the button, based on the type of button (ImageIcon, Image, or String)
  public void draw(Graphics g) {
    if (visible) {
      // if its image/imageicon, draw it
      g.setColor(new Color(50, 200, 50));
      g.fillRect(x - 1, y - 1, width + 2, height + 2);
      if (mode.equals("Image") || mode.equals("ImageIcon")) {
        if (enabled) {
          g.drawImage(image, x, y, null);
        } else {
          g.drawImage(BWimage, x, y, null);
        }
        // if its string, draw the string
      } else {

        g.setFont(new Font("Arial", Font.PLAIN, 20));
        if (enabled) {
          g.setColor(Color.black);
          g.drawString(message, x + 20, y + 20);
        } else {
          g.setColor(new Color(255, 255, 255));
          g.fillRect(x - 1, y - 1, width + 2, height + 2);
          g.setColor(Color.black);
          g.drawString(message, x + 20, y + 20);
        }
      }
    }
  }
  public void draw(Graphics page) // draws letter on screen
      {

    page.setColor(color);
    page.setFont(new Font("TimesRoman", Font.PLAIN, 24));
    page.drawString(testString, x, y);
  }
示例#10
0
 public void paintComponent(Graphics g) {
   super.paintComponent(g);
   myTime = new MyTime();
   g.setFont(font);
   g.setColor(fontColor);
   g.drawString(myTime.time, drawPointX, drawPointY);
 }
示例#11
0
  public void paint(Graphics g) {
    m_fm = g.getFontMetrics();

    g.setColor(getBackground());
    g.fillRect(0, 0, getWidth(), getHeight());
    getBorder().paintBorder(this, g, 0, 0, getWidth(), getHeight());

    g.setColor(getForeground());
    g.setFont(getFont());
    m_insets = getInsets();
    int x = m_insets.left;
    int y = m_insets.top + m_fm.getAscent();

    StringTokenizer st = new StringTokenizer(getText(), "\t");
    while (st.hasMoreTokens()) {
      String sNext = st.nextToken();
      g.drawString(sNext, x, y);
      x += m_fm.stringWidth(sNext);

      if (!st.hasMoreTokens()) break;
      int index = 0;
      while (x >= getTab(index)) index++;
      x = getTab(index);
    }
  }
示例#12
0
 public void paint(Graphics g) {
   g.setColor(this.getBackground());
   g.fillRect(0, 0, this.width, this.height);
   g.setColor(this.getForeground());
   g.drawImage(this.imLogo, 10, 40, this);
   g.setFont(this.fontTitle);
   g.drawString(this.appName, 70, 65);
   g.setFont(this.fontText);
   int startY = 130;
   int l = 6;
   for (int i = 0; i < textLines.length; ++i) {
     g.drawString(this.textLines[i], 10, startY);
     startY += 20;
   }
   if (str != null) g.drawString(str, 10, startY);
   g.drawImage(this.imHelp, 50, startY + 30, this);
 }
示例#13
0
 public void displayScore2(
     Graphics g, int cx, int cy, int sx1, int sy1, int sx2, int sy2, int sx3, int sy3) {
   g.setFont(scoreFont);
   g.setColor(Color.WHITE);
   g.drawImage(new ImageIcon("InGameMenu/coin.png").getImage(), cx, cy, this);
   g.drawString("" + coins, sx1, sy1);
   g.drawString("Score:  " + score, sx2, sy2);
   g.drawString("Height:  " + height + " m", sx3, sy3);
 }
示例#14
0
  public void paint(Graphics g) {
    super.paint(g);
    g.setFont(fotn);
    Random generator1 = new Random();
    height = bird.getBirdy();

    g.drawImage(Backgroundtop, 0, 0, 450, 644, null);
    g.drawImage(Bird, 100, height, 40, 30, null);

    if (firstrun == true) { // intiate threads
      pipethread[currentthreads].start();
      birdthread.start();
      firstrun = false;
    }

    for (int index = 0; index <= currentthreads; index++) {
      g.drawImage(Pipes, pipeob[index].getpipex(), pipeob[index].getpipey(), null);
    }

    g.drawImage(Backgroundbottom, 0, 644, 450, 156, null);

    g.setColor(Color.black);

    if (pipeob[currentthreads].getpipex() <= 550) {
      currentthreads++;
      pipethread[currentthreads].start();
      score++;
    }
    g.drawString("Score: " + score + "", 50, 50);

    for (int index = 0; index < currentthreads; index++) {
      if (((height < pipeob[index].getpipey() + 730) || (height > pipeob[index].getpipey() + 870))
              && ((pipeob[index].getpipex() < 100) && (pipeob[index].getpipex() + 72 > 100))
          || ((height < pipeob[index].getpipey() + 730)
                  || (height > pipeob[index].getpipey() + 870))
              && ((pipeob[index].getpipex() < 140) && (pipeob[index].getpipex() + 72 > 140))
          || ((height + 30 < pipeob[index].getpipey() + 730)
                  || (height + 30 > pipeob[index].getpipey() + 870))
              && ((pipeob[index].getpipex() < 100) && (pipeob[index].getpipex() + 72 > 100))
          || ((height + 30 < pipeob[index].getpipey() + 730)
                  || (height + 30 > pipeob[index].getpipey() + 870))
              && ((pipeob[index].getpipex() < 140) && (pipeob[index].getpipex() + 72 > 140))
          || ((height + 30 >= 644))) {
        g.drawImage(gameover, 125, 200, null);
        JOptionPane.showMessageDialog(
            null, "You Dead. \n you scored " + score, "Oh no!", JOptionPane.INFORMATION_MESSAGE);
      }
    }
    for (int counter = 0; counter <= 50000000; counter++) {
      counter++;
      counter--;
    }
    do {
      repaint();
    } while (replay = true);
  }
  public void Text(Graphics g) {
    g.setColor(Color.black);
    g.fillRoundRect(49, 69, 502, 512, 30, 30);
    g.setColor(Color.white);
    g.fillRoundRect(50, 70, 500, 510, 30, 30);
    g.setColor(Color.black);

    g.setFont(Ueberschrift);
    g.drawString("Nicht invertierender Verstärker", 180, 100);
  }
  //  Repaint the message at the new location
  public void paintComponent(Graphics page) {
    // use paintComponent method of its parent class
    // to have all graphics properties
    super.paintComponent(page);

    // change the page color and font
    page.setColor(Color.cyan);
    page.setFont(new Font("TimesRoman", Font.PLAIN, 24));

    page.drawString(message.getText(), (int) (location.getX()), (int) (location.getY()));
  }
示例#17
0
 private void reportStats(Graphics g)
       // Report the number of hits, and time spent playing
     {
   if (!gameOver) // stop incrementing the timer once the game is over
   timeSpentInGame = (int) ((System.nanoTime() - gameStartTime) / 1000000000L); // ns --> secs
   g.setColor(Color.red);
   g.setFont(msgsFont);
   g.drawString("Hits: " + numHits + "/" + MAX_HITS, 15, 25);
   g.drawString("Time: " + timeSpentInGame + " secs", 15, 50);
   g.setColor(Color.black);
 } // end of reportStats()
示例#18
0
  private void gameOverMessage(Graphics g)
        // Center the game-over message in the panel.
      {
    String msg = "Game Over. Your score: " + score;

    int x = (PWIDTH - metrics.stringWidth(msg)) / 2;
    int y = (PHEIGHT - metrics.getHeight()) / 2;
    g.setColor(Color.black);
    g.setFont(msgsFont);
    g.drawString(msg, x, y);
  } // end of gameOverMessage()
示例#19
0
  // Draws the Battle Menu
  public void drawMenu(Graphics g) {
    if (scene == BATTLE) {
      // Background
      g.setColor(new Color(0, 100, 0));
      g.fillRect(0, 450, 800, 150);
      g.setColor(Color.BLACK);
      g.fillRect(10, 460, 780, 130);

      // Player
      // Health
      g.setColor(Color.WHITE);
      g.setFont(new Font("Bell MT", Font.BOLD, 20));
      FontMetrics metrics = g.getFontMetrics(new Font("Bell MT", Font.BOLD, 20));
      int hgt = metrics.getHeight();
      // Hgt = 26
      int adv = metrics.stringWidth(player.getHealth() + "/" + player.getMaxHealth(0));
      g.setColor(Color.DARK_GRAY);
      g.fillRect(getWidth() - 170, 470, 150, hgt - 6);
      if ((double) player.getHealth() / player.getMaxHealth(0) > .25) g.setColor(Color.RED);
      else g.setColor(player.getLowHealth());
      g.drawString(
          player.getHealth() + "/" + player.getMaxHealth(0), getWidth() - adv - 180, 461 + hgt);
      g.fillRect(
          getWidth() - 167,
          473,
          (int) (144 * player.getHealth() / player.getMaxHealth(0)),
          hgt - 12);

      // Stamina
      g.setColor(Color.DARK_GRAY);
      g.fillRect(getWidth() - 170, 500, 150, hgt - 6);
      adv = metrics.stringWidth((int) player.getStamina() + "%");
      if (player.getStamina() < 33.3) g.setColor(Color.WHITE);
      else if (player.getStamina() == 100) g.setColor(Color.GREEN);
      else g.setColor(Color.CYAN);

      g.drawString((int) player.getStamina() + "%", getWidth() - adv - 180, 491 + hgt);
      g.fillRect(getWidth() - 167, 503, (int) (144 * player.getStamina() / 100), hgt - 12);

      // Basic Attack
      adv = metrics.stringWidth("Kick Dirt");
      g.setColor(Color.DARK_GRAY);
      g.fillRect(20, 470, adv + 10, 30);
      g.setColor(Color.WHITE);
      g.drawString("Kick Dirt", 25, 492);

      // Spell 1
      adv = metrics.stringWidth("Hurl Pebble");
      g.setColor(Color.DARK_GRAY);
      g.fillRect(20, 510, adv + 10, 30);
      g.setColor(Color.WHITE);
      g.drawString("Hurl Pebble", 25, 532);
    }
  }
示例#20
0
  /** This internal method begins a new page and prints the header. */
  protected void newpage() {
    page = job.getGraphics(); // Begin the new page
    linenum = 0;
    charnum = 0; // Reset line and char number
    pagenum++; // Increment page number
    page.setFont(headerfont); // Set the header font.
    page.drawString(jobname, x0, headery); // Print job name left justified

    String s = "- " + pagenum + " -"; // Print the page number centered.
    int w = headermetrics.stringWidth(s);
    page.drawString(s, x0 + (this.width - w) / 2, headery);
    w = headermetrics.stringWidth(time); // Print date right justified
    page.drawString(time, x0 + width - w, headery);

    // Draw a line beneath the header
    int y = headery + headermetrics.getDescent() + 1;
    page.drawLine(x0, y, x0 + width, y);

    // Set the basic monospaced font for the rest of the page.
    page.setFont(font);
  }
示例#21
0
 /**
  * Display the message using data stored in instance variables.
  *
  * @param g the Graphics context.
  */
 public void paint(Graphics g) {
   if (messageStrings == null) makeStringList();
   int y = (getSize().height - messageHeight) / 2 + fontAscent;
   if (y < fontAscent) y = fontAscent;
   int x = (getSize().width - messageWidth) / 2;
   if (x < 0) x = 0;
   g.setFont(font);
   for (int i = 0; i < messageStrings.size(); i++) {
     g.drawString((String) messageStrings.elementAt(i), x, y);
     y += lineHeight;
   }
 }
示例#22
0
 // 重画时清除屏幕
 public void paint(Graphics g) {
   g.setColor(new Color(0, 0, 0));
   g.fillRect(0, 0, getWidth(), getHeight());
   Graphics2D g2d = (Graphics2D) g;
   g2d.setRenderingHint(
       RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
   g.setColor(Color.WHITE);
   g.setFont(new Font("Default", 40, 40));
   g.drawString(m_prompt, 220, 250);
   g2d.setRenderingHint(
       RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_OFF);
 }
示例#23
0
 public void paint(Graphics g) {
   if (comp != null) {
     width = comp.getWidth() / 6;
     height = comp.getHeight() * 2 / 3;
   }
   g.setColor(bgColor);
   g.fillRect(x, y, width, height);
   g.setColor(fgColor);
   g.setFont(font);
   g.drawString(strTray, x / 2 + width / 2, y + height + 10);
   super.paint(g);
 }
示例#24
0
 public Graphics startPaint(Graphics sysgraph) {
   mSystemGraphics = sysgraph;
   Dimension d = getSize();
   if ((mActiveOffscreenImage == null)
       || (d.width != mOffscreenSize.width)
       || (d.height != mOffscreenSize.height)) {
     mActiveOffscreenImage = createImage(d.width, d.height);
     mActiveOffscreenGraphics = mActiveOffscreenImage.getGraphics();
     mOffscreenSize = d;
     mActiveOffscreenGraphics.setFont(getFont());
   }
   return mActiveOffscreenGraphics;
 }
示例#25
0
 public void paint(Graphics g) {
   double beatWidth = sp.beatWidth;
   g.setFont(font);
   for (int i = 0; i < (sp.score.getEndTime()); i++) {
     int xLoc = (int) Math.round(i * beatWidth);
     if (i % timeSig == 0) {
       g.drawLine(xLoc, 0, xLoc, height);
       if (beatWidth > 15) g.drawString("" + i, xLoc + 2, height - 2);
     } else {
       g.drawLine(xLoc, height / 2, xLoc, height);
     }
   }
 }
示例#26
0
 public void gameOverMenu(
     Graphics g) { // CHANGE THIS TO INCLUDE HIGHSCORES AND STUFF AFTER TEXTFILES ARE MADE
   // Menu that shows up when user gets Game Over
   if (pause == true && die == true) {
     g.drawImage(
         new ImageIcon("InGameMenu/pauseBckgrnd.png").getImage(), 0, 0, this); // Graphics stuff
     g.setFont(scoreFont);
     g.setColor(Color.BLACK);
     g.drawImage(new ImageIcon("InGameMenu/GameOver.png").getImage(), 10, 200, this);
     displayScore2(g, 115, 350, 185, 385, 110, 440, 110, 490); // Shows stats
     g.drawImage(menuB.getPic(mx, my), menuB.getX(), menuB.getY(), this); // Draws menu button
   }
 }
示例#27
0
 /**
  * Set the font style. The argument should be one of the font style constants defined by the
  * java.awt.Font class. All subsequent output will be in that style. This method relies on all
  * styles of the Monospaced font having the same metrics.
  */
 public void setFontStyle(int style) {
   synchronized (this.lock) {
     // Try to set a new font, but restore current one if it fails
     Font current = font;
     try {
       font = new Font("Monospaced", style, fontsize);
     } catch (Exception e) {
       font = current;
     }
     // If a page is pending, set the new font.  Otherwise newpage() will.
     if (page != null) page.setFont(font);
   }
 }
示例#28
0
 /**
  * Repaint the drawing panel
  *
  * @param g The Graphics context
  */
 public void paintComponent(Graphics g) {
   super.paintComponent(g);
   // Draw the background that will be beside the board
   g.drawImage(background, 0, 0, this);
   for (int row = 0; row < 16; row++) {
     for (int col = 0; col < 16; col++) {
       board[row][col].draw(g);
     }
   }
   int seconds = (time / 10);
   g.setColor(Color.WHITE);
   g.setFont(new Font("Century Gothic", Font.BOLD, 65));
   g.drawString("" + seconds, 1075, 205);
 } // paint component method
示例#29
0
 public void drawDefeat(Graphics g) {
   g.setColor(new Color(0, 0, 0, 200));
   g.fillRect(195, 220, 410, 110);
   g.setColor(new Color(255, 255, 255, 200));
   g.fillRect(200, 225, 400, 100);
   g.setColor(new Color(0, 0, 0, 200));
   g.setFont(new Font("Bell MT", Font.BOLD, 20));
   FontMetrics metrics = g.getFontMetrics(new Font("Bell MT", Font.BOLD, 20));
   int hgt = metrics.getHeight();
   // Hgt = 26
   int adv = metrics.stringWidth("You all fainted.");
   g.drawString("You all fainted.", getWidth() / 2 - adv / 2, 234 + hgt);
   adv = metrics.stringWidth("Defenseless, you are all eaten.");
   g.drawString("Defenseless, you are all eaten.", getWidth() / 2 - adv / 2, 269 + hgt);
 }
示例#30
0
  public void paintComponent(Graphics g) {
    super.paintComponent(g);
    ((Graphics2D) g)
        .setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    Dimension theSize = getSize();

    if (mColorListMode == VisualizationColor.cColorListModeCategories) {
      int categories = mCategoryColorList.length;
      if (categories <= cMaxEditableColors) {
        int fieldWidth = (theSize.width - 2 * cBorder + cSpacing) / categories - cSpacing;
        mRect = new Rectangle[categories];
        for (int i = 0; i < categories; i++) {
          mRect[i] =
              new Rectangle(
                  cBorder + i * (fieldWidth + cSpacing),
                  cBorder,
                  fieldWidth,
                  theSize.height - 2 * cBorder);
          drawColorButton(g, i);
        }
      } else {
        final String message = "<too many colors to edit>";
        g.setColor(Color.GRAY);
        g.setFont(new Font("Arial", Font.BOLD, 13));
        FontMetrics m = g.getFontMetrics();
        g.drawString(
            message,
            (theSize.width - m.stringWidth(message)) / 2,
            (theSize.height + m.getHeight()) / 2 - m.getDescent());
      }
    } else {
      int size = theSize.height - 2 * cBorder;
      int x1 = 2 * cBorder + size;
      int x2 = theSize.width - 2 * cBorder - size;
      mRect = new Rectangle[3];
      mRect[0] = new Rectangle(cBorder, cBorder, size, size);
      mRect[1] =
          new Rectangle(
              theSize.width - size - cBorder, theSize.height - size - cBorder, size, size);
      mRect[cColorWedgeButton] = new Rectangle(x1, cBorder, x2 - x1, size);
      drawColorButton(g, 0);
      drawColorButton(g, 1);
      drawColorButton(g, cColorWedgeButton);
    }
  }