示例#1
0
  public void draw(Graphics g) {
    Rectangle r = displayBox();

    g.setColor(Color.yellow);
    g.fillOval(r.x, r.y, r.width, r.height);

    g.setColor(Color.black);
    g.drawOval(r.x, r.y, r.width, r.height);
  }
  /** Prints the drawing. */
  public void print() {
    tool().deactivate();
    PrintJob printJob = getToolkit().getPrintJob(this, "Print Drawing", null);

    if (printJob != null) {
      Graphics pg = printJob.getGraphics();

      if (pg != null) {
        ((StandardDrawingView) view()).printAll(pg);
        pg.dispose(); // flush page
      }
      printJob.end();
    }
    tool().activate();
  }
 public void drawFrame(Graphics g) {
   Rectangle r = displayBox();
   g.drawRoundRect(r.x, r.y, r.width - 1, r.height - 1, fArcWidth, fArcHeight);
 }
 public void drawBackground(Graphics g) {
   Rectangle r = displayBox();
   g.fillRoundRect(r.x, r.y, r.width, r.height, fArcWidth, fArcHeight);
 }