// Paint the round background and label.
  protected void paintComponent(Graphics g) {
    if (getModel().isArmed()) {
      // You might want to make the highlight color
      // a property of the RoundButton class.
      g.setColor(Color.lightGray);
    } else {
      g.setColor(getBackground());
    }
    g.fillOval(0, 0, getSize().width - 1, getSize().height - 1);

    // This call will paint the label and the
    // focus rectangle.
    super.paintComponent(g);
  }
예제 #2
0
 void drawPoint(Graphics g, DrawObject p) {
   if (p == null) {
     return;
   }
   if ((sequencingOn) && (p.sequenceNum != currentSequenceNumDisplay)) {
     return;
   }
   int x = (int) ((p.x - minX) / (maxX - minX) * (D.width - 2 * inset));
   int y = (int) ((p.y - minY) / (maxY - minY) * (D.height - 2.0 * inset));
   if (p.diameter > 1) {
     int r = p.diameter / 2;
     g.fillOval(inset + x - r, D.height - y - inset - r, 2 * r, 2 * r);
   } else {
     g.fillRect(inset + x, D.height - y - inset, 1, 1);
   }
 }