コード例 #1
0
ファイル: Grid.java プロジェクト: jankotek/asterope
  /** Affichage du logo */
  protected void drawLogo(Graphics g) {

    int x = 5;
    int y = 2;

    g.setColor(getBackground());
    g.fillRect(0, 0, W, H);

    // Remplissage
    fillBG(g, x, y, Color.white);

    // Dessin
    drawGrid(
        g,
        x,
        y,
        !isAvailable()
            ? Aladin.MYGRAY
            : isActive() ? Aladin.GREEN : isMouseIn() ? Color.blue : Color.black);

    // Label
    g.setColor(isAvailable() ? Color.black : Aladin.MYGRAY);
    g.setFont(Aladin.SPLAIN);
    g.drawString(LABEL, W / 2 - g.getFontMetrics().stringWidth(LABEL) / 2, H - 2);
  }
コード例 #2
0
 // Show a message over frozen image in the display
 public void showMessage(String message) {
   Graphics g = getGraphics();
   g.setColor(Color.black);
   g.fillRect(30, (getHeight() / 2) - 16, message.length() * 10, 25);
   g.setColor(Color.white);
   g.drawString(message, 40, getHeight() / 2);
 }
コード例 #3
0
ファイル: DebugGraphics.java プロジェクト: GregBowyer/Hotspot
  /** Overrides <code>Graphics.drawLine</code>. */
  public void drawLine(int x1, int y1, int x2, int y2) {
    DebugGraphicsInfo info = info();

    if (debugLog()) {
      info()
          .log(
              toShortString()
                  + " Drawing line: from "
                  + pointToString(x1, y1)
                  + " to "
                  + pointToString(x2, y2));
    }

    if (isDrawingBuffer()) {
      if (debugBuffered()) {
        Graphics debugGraphics = debugGraphics();

        debugGraphics.drawLine(x1, y1, x2, y2);
        debugGraphics.dispose();
      }
    } else if (debugFlash()) {
      Color oldColor = getColor();
      int i, count = (info.flashCount * 2) - 1;

      for (i = 0; i < count; i++) {
        graphics.setColor((i % 2) == 0 ? info.flashColor : oldColor);
        graphics.drawLine(x1, y1, x2, y2);
        Toolkit.getDefaultToolkit().sync();
        sleep(info.flashTime);
      }
      graphics.setColor(oldColor);
    }
    graphics.drawLine(x1, y1, x2, y2);
  }
コード例 #4
0
  @Override
  public void paintDeterminate(Graphics g, JComponent c) {
    Insets b = progressBar.getInsets(); // area for border
    int barRectWidth = progressBar.getWidth() - b.right - b.left;
    int barRectHeight = progressBar.getHeight() - b.top - b.bottom;
    if (barRectWidth <= 0 || barRectHeight <= 0) {
      return;
    }
    // int cellLength = getCellLength();
    // int cellSpacing = getCellSpacing();
    // amount of progress to draw
    int amountFull = getAmountFull(b, barRectWidth, barRectHeight);

    // draw the cells
    if (progressBar.getOrientation() == SwingConstants.HORIZONTAL) {
      float x = amountFull / (float) barRectWidth;
      g.setColor(getColorFromPallet(pallet, x));
      g.fillRect(b.left, b.top, amountFull, barRectHeight);
    } else { // VERTICAL
      float y = amountFull / (float) barRectHeight;
      g.setColor(getColorFromPallet(pallet, y));
      g.fillRect(b.left, barRectHeight + b.bottom - amountFull, barRectWidth, amountFull);
    }
    // Deal with possible text painting
    if (progressBar.isStringPainted()) {
      paintString(g, b.left, b.top, barRectWidth, barRectHeight, amountFull, b);
    }
  }
コード例 #5
0
 /**
  * Draw character in minimap
  *
  * @param g Graphics
  * @param Dx X Displacement
  * @param Dy Y Displacement
  */
 public void MapDraw(Graphics g, int Dx, int Dy, double Scale, Color col) {
   // Color
   g.setColor(col.darker().darker().darker());
   g.drawOval((int) (X * Scale + Dx), (int) (Y * Scale + Dy), 7, 7);
   g.setColor(col);
   g.fillOval((int) (X * Scale + Dx), (int) (Y * Scale + Dy), 7, 7);
 }
コード例 #6
0
ファイル: DebugGraphics.java プロジェクト: GregBowyer/Hotspot
  /** Overrides <code>Graphics.fill3DRect</code>. */
  public void fill3DRect(int x, int y, int width, int height, boolean raised) {
    DebugGraphicsInfo info = info();

    if (debugLog()) {
      info()
          .log(
              toShortString()
                  + " Filling 3D rect: "
                  + new Rectangle(x, y, width, height)
                  + " Raised bezel: "
                  + raised);
    }
    if (isDrawingBuffer()) {
      if (debugBuffered()) {
        Graphics debugGraphics = debugGraphics();

        debugGraphics.fill3DRect(x, y, width, height, raised);
        debugGraphics.dispose();
      }
    } else if (debugFlash()) {
      Color oldColor = getColor();
      int i, count = (info.flashCount * 2) - 1;

      for (i = 0; i < count; i++) {
        graphics.setColor((i % 2) == 0 ? info.flashColor : oldColor);
        graphics.fill3DRect(x, y, width, height, raised);
        Toolkit.getDefaultToolkit().sync();
        sleep(info.flashTime);
      }
      graphics.setColor(oldColor);
    }
    graphics.fill3DRect(x, y, width, height, raised);
  }
コード例 #7
0
ファイル: DebugGraphics.java プロジェクト: GregBowyer/Hotspot
  /** Overrides <code>Graphics.fillArc</code>. */
  public void fillArc(int x, int y, int width, int height, int startAngle, int arcAngle) {
    DebugGraphicsInfo info = info();

    if (debugLog()) {
      info()
          .log(
              toShortString()
                  + " Filling arc: "
                  + new Rectangle(x, y, width, height)
                  + " startAngle: "
                  + startAngle
                  + " arcAngle: "
                  + arcAngle);
    }
    if (isDrawingBuffer()) {
      if (debugBuffered()) {
        Graphics debugGraphics = debugGraphics();

        debugGraphics.fillArc(x, y, width, height, startAngle, arcAngle);
        debugGraphics.dispose();
      }
    } else if (debugFlash()) {
      Color oldColor = getColor();
      int i, count = (info.flashCount * 2) - 1;

      for (i = 0; i < count; i++) {
        graphics.setColor((i % 2) == 0 ? info.flashColor : oldColor);
        graphics.fillArc(x, y, width, height, startAngle, arcAngle);
        Toolkit.getDefaultToolkit().sync();
        sleep(info.flashTime);
      }
      graphics.setColor(oldColor);
    }
    graphics.fillArc(x, y, width, height, startAngle, arcAngle);
  }
コード例 #8
0
ファイル: DebugGraphics.java プロジェクト: GregBowyer/Hotspot
  /** Overrides <code>Graphics.drawOval</code>. */
  public void drawOval(int x, int y, int width, int height) {
    DebugGraphicsInfo info = info();

    if (debugLog()) {
      info().log(toShortString() + " Drawing oval: " + new Rectangle(x, y, width, height));
    }
    if (isDrawingBuffer()) {
      if (debugBuffered()) {
        Graphics debugGraphics = debugGraphics();

        debugGraphics.drawOval(x, y, width, height);
        debugGraphics.dispose();
      }
    } else if (debugFlash()) {
      Color oldColor = getColor();
      int i, count = (info.flashCount * 2) - 1;

      for (i = 0; i < count; i++) {
        graphics.setColor((i % 2) == 0 ? info.flashColor : oldColor);
        graphics.drawOval(x, y, width, height);
        Toolkit.getDefaultToolkit().sync();
        sleep(info.flashTime);
      }
      graphics.setColor(oldColor);
    }
    graphics.drawOval(x, y, width, height);
  }
コード例 #9
0
ファイル: DebugGraphics.java プロジェクト: GregBowyer/Hotspot
  /** Overrides <code>Graphics.drawString</code>. */
  public void drawString(AttributedCharacterIterator iterator, int x, int y) {
    DebugGraphicsInfo info = info();

    if (debugLog()) {
      info().log(toShortString() + " Drawing text: \"" + iterator + "\" at: " + new Point(x, y));
    }

    if (isDrawingBuffer()) {
      if (debugBuffered()) {
        Graphics debugGraphics = debugGraphics();

        debugGraphics.drawString(iterator, x, y);
        debugGraphics.dispose();
      }
    } else if (debugFlash()) {
      Color oldColor = getColor();
      int i, count = (info.flashCount * 2) - 1;

      for (i = 0; i < count; i++) {
        graphics.setColor((i % 2) == 0 ? info.flashColor : oldColor);
        graphics.drawString(iterator, x, y);
        Toolkit.getDefaultToolkit().sync();
        sleep(info.flashTime);
      }
      graphics.setColor(oldColor);
    }
    graphics.drawString(iterator, x, y);
  }
コード例 #10
0
ファイル: DebugGraphics.java プロジェクト: GregBowyer/Hotspot
  /** Overrides <code>Graphics.drawChars</code>. */
  public void drawChars(char data[], int offset, int length, int x, int y) {
    DebugGraphicsInfo info = info();

    Font font = graphics.getFont();

    if (debugLog()) {
      info().log(toShortString() + " Drawing chars at " + new Point(x, y));
    }

    if (isDrawingBuffer()) {
      if (debugBuffered()) {
        Graphics debugGraphics = debugGraphics();

        debugGraphics.drawChars(data, offset, length, x, y);
        debugGraphics.dispose();
      }
    } else if (debugFlash()) {
      Color oldColor = getColor();
      int i, count = (info.flashCount * 2) - 1;

      for (i = 0; i < count; i++) {
        graphics.setColor((i % 2) == 0 ? info.flashColor : oldColor);
        graphics.drawChars(data, offset, length, x, y);
        Toolkit.getDefaultToolkit().sync();
        sleep(info.flashTime);
      }
      graphics.setColor(oldColor);
    }
    graphics.drawChars(data, offset, length, x, y);
  }
コード例 #11
0
ファイル: BufferView.java プロジェクト: light/Payback
  public void paintFPS(int x, int y, Graphics g) {

    // Skip if not needed:
    if (usingMenu) {
      return;
    }

    if (showFPS) {

      // Update FPS count:
      if (--fpsCounter <= 0) {

        long ct = nes.getGui().getTimer().currentMicros();
        long frameT = (ct - prevFrameTime) / 45;
        if (frameT == 0) {
          fps = "FPS: -";
        } else {
          fps = "FPS: " + (1000000 / frameT);
        }
        fpsCounter = 45;
        prevFrameTime = ct;
      }

      // Draw FPS.
      gfx.setColor(Color.black);
      gfx.fillRect(
          x,
          y - gfx.getFontMetrics().getAscent(),
          gfx.getFontMetrics().stringWidth(fps) + 3,
          gfx.getFontMetrics().getHeight());
      gfx.setColor(Color.cyan);
      gfx.drawString(fps, x, y);
    }
  }
コード例 #12
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);
        }
      }
    }
  }
コード例 #13
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);
 }
コード例 #14
0
ファイル: TicTac.java プロジェクト: Sykess/Eastwood
  /** PaintComponent to draw everything. */
  @Override
  public void paintComponent(Graphics g) {
    super.paintComponent(g);
    setBackground(Color.WHITE);
    // If using images, use cool dragon background
    if (useImages) g.drawImage(background, 0, 0, 310, 300, null);

    // Use light gray to not overpower the background image
    g.setColor(Color.LIGHT_GRAY);
    for (int y = 1; y < ROWS; ++y)
      g.fillRoundRect(0, cellSize * y - 4, (cellSize * COLS) - 1, 8, 8, 8);
    for (int x = 1; x < COLS; ++x)
      g.fillRoundRect(cellSize * x - 4, 0, 8, (cellSize * ROWS) - 1, 8, 8);

    // Use graphics2d for when not using the images
    Graphics2D g2d = (Graphics2D) g;
    g2d.setStroke(new BasicStroke(4, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND));
    for (int y = 0; y < ROWS; ++y) {
      for (int x = 0; x < COLS; ++x) {
        int x1 = x * cellSize + 16;
        int y1 = y * cellSize + 16;
        if (board[y][x] == Symbol.X) {
          // use image if set to true, otherwise use g2d
          // for thicker, better looking X's and O's
          if (useImages) g.drawImage(imageX, x1, y1, 75, 75, null);
          else {
            g2d.setColor(PURPLE);
            int x2 = (x + 1) * cellSize - 16;
            int y2 = (y + 1) * cellSize - 16;
            g2d.drawLine(x1, y1, x2, y2);
            g2d.drawLine(x2, y1, x1, y2);
          }
        } else if (board[y][x] == Symbol.O) {
          if (useImages) g.drawImage(imageO, x1, y1, 75, 75, null);
          else {
            g2d.setColor(Color.BLUE);
            g2d.drawOval(x1, y1, 70, 70);
          }
        }
      } // end for
    }

    // Set status bar based on gamestate.  If CONTINUE, show whose turn it is
    if (gameStatus == GameStatus.CONTINUE) {
      statusBar.setForeground(Color.BLACK);
      if (currentPlayer == Symbol.X) statusBar.setText("X's Turn");
      else statusBar.setText("O's Turn");
    } else if (gameStatus == GameStatus.DRAW) {
      statusBar.setForeground(Color.RED);
      statusBar.setText("Draw! Click to play again!");
    } else if (gameStatus == GameStatus.X_WIN) {
      statusBar.setForeground(Color.RED);
      statusBar.setText("X has won! Click to play again!");
    } else if (gameStatus == GameStatus.O_WIN) {
      statusBar.setForeground(Color.RED);
      statusBar.setText("O has won! Click to play again!");
    }
  }
コード例 #15
0
ファイル: test.java プロジェクト: dgg5503/Cards-In-Space
 /**
  * Paint method for applet.
  *
  * @param g the Graphics object for this applet
  */
 public void paint(Graphics g) {
   // simple text displayed on applet
   g.setColor(c);
   g.fillRect(0, 0, 200, 100);
   g.setColor(Color.black);
   g.drawString("Sample Applet", 20, 20);
   g.setColor(Color.blue);
   g.drawString("created by BlueJ", 20, 40);
 }
コード例 #16
0
 static void drawActiveButtonBorder(Graphics g, int x, int y, int w, int h) {
   drawFlush3DBorder(g, x, y, w, h);
   g.setColor(MetalLookAndFeel.getPrimaryControl());
   g.drawLine(x + 1, y + 1, x + 1, h - 3);
   g.drawLine(x + 1, y + 1, w - 3, x + 1);
   g.setColor(MetalLookAndFeel.getPrimaryControlDarkShadow());
   g.drawLine(x + 2, h - 2, w - 2, h - 2);
   g.drawLine(w - 2, y + 2, w - 2, h - 2);
 }
コード例 #17
0
 /** This draws the "Flush 3D Border" which is used throughout the Metal L&F */
 static void drawFlush3DBorder(Graphics g, int x, int y, int w, int h) {
   g.translate(x, y);
   g.setColor(MetalLookAndFeel.getControlDarkShadow());
   g.drawRect(0, 0, w - 2, h - 2);
   g.setColor(MetalLookAndFeel.getControlHighlight());
   g.drawRect(1, 1, w - 2, h - 2);
   g.setColor(MetalLookAndFeel.getControl());
   g.drawLine(0, h - 1, 1, h - 2);
   g.drawLine(w - 1, 0, w - 2, 1);
   g.translate(-x, -y);
 }
コード例 #18
0
ファイル: JackPanel.java プロジェクト: hustbill/bounce
 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()
コード例 #19
0
  @Override
  protected void paintContentBorderBottomEdge(
      Graphics g, int tabPlacement, int selectedIndex, int x, int y, int w, int h) {
    if (tabPane.getTabCount() < 1) return;

    g.setColor(shadow);
    g.drawLine(x + 1, y + h - 3, x + w - 2, y + h - 3);
    g.drawLine(x + 1, y + h - 2, x + w - 2, y + h - 2);
    g.setColor(shadow.brighter());
    g.drawLine(x + 2, y + h - 1, x + w - 1, y + h - 1);
  }
コード例 #20
0
 static void drawDefaultButtonPressedBorder(Graphics g, int x, int y, int w, int h) {
   drawPressed3DBorder(g, x + 1, y + 1, w - 1, h - 1);
   g.translate(x, y);
   g.setColor(MetalLookAndFeel.getControlDarkShadow());
   g.drawRect(0, 0, w - 3, h - 3);
   g.drawLine(w - 2, 0, w - 2, 0);
   g.drawLine(0, h - 2, 0, h - 2);
   g.setColor(MetalLookAndFeel.getControl());
   g.drawLine(w - 1, 0, w - 1, 0);
   g.drawLine(0, h - 1, 0, h - 1);
   g.translate(-x, -y);
 }
コード例 #21
0
 void showFrameRate(Graphics g) {
   frames++;
   if (System.currentTimeMillis() > firstFrame + 1000) {
     firstFrame = System.currentTimeMillis();
     fps = frames;
     frames = 0;
   }
   g.setColor(Color.white);
   g.fillRect(10, 12, 50, 15);
   g.setColor(Color.black);
   g.drawString((int) (fps + 0.5) + " fps", 10, 25);
 }
コード例 #22
0
  /**
   * This draws a variant "Flush 3D Border" It is used for things like active toggle buttons. This
   * is used rarely.
   */
  static void drawDark3DBorder(Graphics g, int x, int y, int w, int h) {
    g.translate(x, y);

    drawFlush3DBorder(g, 0, 0, w, h);

    g.setColor(MetalLookAndFeel.getControl());
    g.drawLine(1, 1, 1, h - 2);
    g.drawLine(1, 1, w - 2, 1);
    g.setColor(MetalLookAndFeel.getControlShadow());
    g.drawLine(1, h - 2, 1, h - 2);
    g.drawLine(w - 2, 1, w - 2, 1);
    g.translate(-x, -y);
  }
コード例 #23
0
  public void draw(Graphics window, int x, int y) {
    window.setColor(Color.CYAN);
    window.fillOval(x + 8, y + 11, 45 - 16, 45 - 16);
    window.setColor(Color.BLACK);
    window.fillOval(x + 14, y + 15, 5, 5); // eyes
    window.fillOval(x + 25, y + 15, 5, 5); // eyes
    imgFound = false;

    // health bar
    window.setColor(Color.RED);
    window.fillRect(x, y, 45, 9);
    window.setColor(Color.GREEN);
    window.fillRect(x, y, (int) ((double) currentHealth / (double) (maxHealth) * 45), 9);
  }
コード例 #24
0
ファイル: set.java プロジェクト: wcyuan/Set
  public void paint(Graphics g) {
    Message("Copyright Feb, 2000 Weicon Conan Yuan.", "All Rights Reserved", 7);
    for (int i = 0; i < NUM_LOCATIONS; i++) {
      locs[i].draw(g, this);
      g.setColor(txtcolor);
      if (locs[i].ToDraw()) {
        g.drawString("" + i, locs[i].GetX(), locs[i].GetY() + 10);
      }
    }

    g.setColor(Color.red);
    g.drawRect(400, 200, 30, 30);
    g.fillRect(400, 200, 30, 30);
    Message("Cheat", 4);
  }
コード例 #25
0
 public void clear() {
   Graphics g = this.image.getGraphics();
   g.setColor(Color.WHITE);
   g.fillRect(0, 0, this.image.getWidth(null), this.image.getHeight(null));
   g.dispose();
   repaint();
 }
コード例 #26
0
 public SimpleWhiteboardPanel(int width, int height) {
   this.image = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
   Graphics g = this.image.getGraphics();
   g.setColor(Color.WHITE);
   g.fillRect(0, 0, image.getWidth(), image.getHeight());
   this.setFocusable(true);
 }
コード例 #27
0
ファイル: JackPanel.java プロジェクト: hustbill/bounce
  private void gameRender() {
    if (dbImage == null) {
      dbImage = createImage(PWIDTH, PHEIGHT);
      if (dbImage == null) {
        System.out.println("dbImage is null");
        return;
      } else dbg = dbImage.getGraphics();
    }

    // draw a white background
    dbg.setColor(Color.white);
    dbg.fillRect(0, 0, PWIDTH, PHEIGHT);

    // draw the game elements: order is important
    ribsMan.display(dbg); // the background ribbons
    bricksMan.display(dbg); // the bricks
    jack.drawSprite(dbg); // the sprites
    fireball.drawSprite(dbg);

    if (showExplosion) // draw the explosion (in front of jack)
    dbg.drawImage(explosionPlayer.getCurrentImage(), xExpl, yExpl, null);

    reportStats(dbg);

    if (gameOver) gameOverMessage(dbg);

    if (showHelp) // draw the help at the very front (if switched on)
    dbg.drawImage(
          helpIm, (PWIDTH - helpIm.getWidth()) / 2, (PHEIGHT - helpIm.getHeight()) / 2, null);
  } // end of gameRender()
コード例 #28
0
 protected void computeGeometry() {
   pictHalfWidth = Width.getInt() / 2;
   pictWidth = pictHalfWidth + pictHalfWidth - 1;
   pictHeight = Height.getInt();
   xLoc = -pictHalfWidth;
   yLoc = -pictHeight / 2;
   setFramesPerCycle(pictWidth - 1);
   setFrameIncrement(FrameIncrement.getInt());
   // System.out.println("width = " + pictWidth);
   // System.out.println("    x = " + xLoc);
   // System.out.println("    y = " + yLoc);
   PxlColor[] ramp = AColor.getPxlColor().sinusoidalRampTo(BColor.getPxlColor(), pictHalfWidth);
   // System.out.println("w=" + (4*pictHalfWidth-1) + ", h=" + pictHeight);
   int ibWidth = 4 * pictHalfWidth - 1;
   if ((imageBuffer == null)
       || (imageBuffer.getWidth() != ibWidth)
       || (imageBuffer.getHeight() != pictHeight)) {
     imageBuffer = new BufferedImage(ibWidth, pictHeight, BufferedImage.TYPE_INT_RGB);
   }
   Graphics g = imageBuffer.getGraphics();
   for (int x = 0; x < pictHalfWidth; x++) {
     g.setColor(ramp[x].dev());
     g.drawLine(x, 0, x, pictHeight - 1);
     if (x < (pictHalfWidth - 1))
       g.drawLine(pictWidth - x - 1, 0, pictWidth - x - 1, pictHeight - 1);
     if (x > 0) g.drawLine(pictWidth + x - 1, 0, pictWidth + x - 1, pictHeight - 1);
     if ((x > 0) && (x < (pictHalfWidth - 1)))
       g.drawLine(4 * pictHalfWidth - 4 - x, 0, 4 * pictHalfWidth - 4 - x, pictHeight - 1);
   }
   g.dispose();
   BitMapElement p = (BitMapElement) getDisplayElement(pictElement);
   p.setImage(imageBuffer);
   p.setLocation(xLoc, yLoc);
   p.setClipRect(xLoc, yLoc, pictWidth, pictHeight);
 }
コード例 #29
0
ファイル: Grid.java プロジェクト: jankotek/asterope
 /** Dessine l'icone de la grille */
 protected static void drawGrid(Graphics g, int x, int y, Color c) {
   g.setColor(c);
   for (int i = 0; i < TX.length; i++)
     g.drawLine(TX[i][0] + x, TX[i][2] + y, TX[i][1] + x, TX[i][2] + y);
   for (int i = 0; i < TY.length; i++)
     g.drawLine(TY[i][2] + x, TY[i][0] + y, TY[i][2] + x, TY[i][1] + y);
 }
コード例 #30
0
ファイル: set.java プロジェクト: wcyuan/Set
  public void Message(String s, int i) {
    Graphics g = getGraphics();

    if (s == null) {
      g.setColor(bgcolor);
      g.drawRect(400, 50 * i - 10, 200, 10);
      g.fillRect(400, 50 * i - 10, 200, 10);
      return;
    }
    /*
      g.setColor(Color.blue);
      g.drawRect(400,50 * i - 10,200,10);
      g.fillRect(400,50 * i - 10,200,10);
    */
    g.setColor(txtcolor);
    g.drawString(s, 400, 50 * i);
  }