public void paint(Graphics g) { super.paint(g); if (mouseIn) { g.setColor(Color.blue); g.drawRect(0, 0, getWidth() - 1, getHeight() - 1); } }
public void paint(Graphics g) { super.paint(g); drawAxis( Axis.X_AXIS, 10, 5, curLowVal, curHighVal, 50, getWidth() - 50, 50, logScale, getHeight(), g); drawAxis( Axis.Y_AXIS, 10, 5, curLowVal, curHighVal, 50, getHeight() - 50, 50, logScale, getHeight(), g); g.drawString("Current Slider Range: " + curLowVal + " --> " + curHighVal, 10, 20); }
@Override public void paint(Graphics g) { super.paint(g); connectUsers("Select * from users"); CustomButton.setGraphics(g); ScaledPoint.setWindowDimensions(getWidth(), getHeight()); if (help) // display help message { showHelp(g); return; } // Draw main GUI components drawStoreBG(g); drawStoreName(g); drawStoreImage(g); drawStoreMessage(g); drawInventory(g); drawBalance(g); drawPageIndicator(g); deactivateButtons(); CustomButton.draw(); }
@Override public void paint(Graphics g) { if (!myLookup.isFocused() && myLookup.isCompletion()) { ((Graphics2D) g).setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.6f)); } super.paint(g); }
@Override public void paint(Graphics g) { super.paint(g); if (g instanceof Graphics2D) { Graphics2D g2d = (Graphics2D) g; if (blackOutEnabled) { // background g2d.setColor(Color.BLACK); g2d.fillRect(0, 0, this.getWidth(), this.getHeight()); } else if (whiteOutEnabled) { // background g2d.setColor(Color.WHITE); g2d.fillRect(0, 0, this.getWidth(), this.getHeight()); } else { // background g2d.setColor(backgroundColor); g2d.fillRect(0, 0, this.getWidth(), this.getHeight()); // text if (font == null) font = GuiHelper.maxFontSize(frame.getWidth(), frame.getHeight(), fontName, timeFormat); if (textY == -1) textY = GuiHelper.getTextYForCenter(timeFormat, font, frame.getHeight()); g2d.setRenderingHint( RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); g2d.setFont(font); g2d.setColor(textColor); g2d.drawString(timeToString(time), 0, textY); } } }
public void paint(Graphics g) { super.paint(g); Graphics2D g2d = (Graphics2D) g; g2d.drawImage(img, 0, 0, null); g2d.drawImage(p.getImage(), p.getX(), p.getY(), null); }
public void paint(Graphics g) { super.paint(g); int squareWidth = (int) getSize().getWidth() / model.getWidth(); int squareHeight = (int) getSize().getHeight() / model.getHeight(); int boardTop = (int) getHeight() - model.getHeight() * squareHeight; for (int i = 0; i < model.getHeight(); ++i) { for (int j = 0; j < model.getWidth(); ++j) { Tetrominoes shape = model.shapeAt(j, model.getHeight() - i - 1); if (shape != Tetrominoes.NoShape) drawSquare(g, 0 + j * squareWidth, boardTop + i * squareHeight, shape); } } if (model.currPieceShape() != Tetrominoes.NoShape) { for (int i = 0; i < 4; ++i) { int x = model.getCurrX() + model.curPiece.x(i); int y = model.getCurrY() - model.curPiece.y(i); drawSquare( g, 0 + x * squareWidth, boardTop + (model.getHeight() - y - 1) * squareHeight, model.currPieceShape()); } } }
/** paint class for drawing rectangles */ public void paint(Graphics g) { // call superclass super.paint(g); // draw Fractal drawFractal(g, point, level, width, height); }
public void paint(Graphics g) { Graphics2D g2d = (Graphics2D) g; Composite oldComp = g2d.getComposite(); Composite alphaComp = AlphaComposite.getInstance(AlphaComposite.SRC_OVER, alpha); g2d.setComposite(alphaComp); super.paint(g2d); g2d.setComposite(oldComp); }
public void paint(Graphics g) { super.paint(g); Dimension size = getSize(); double w = size.getWidth() - 50; double h = size.getHeight() + 20; try { readFile(); } catch (IOException e) { System.err.println("IO issue"); } barWidth = ((int) (w / numBars)) - 20; pos = 5; int xPos[] = {pos, pos, pos, pos}; int yPos[] = {pos, pos, pos, pos}; maxVal = maxValue(values); double barH, ratio; for (int i = 0; i < numBars - 1; i++) { Color col[] = new Color[numBars]; for (int j = 0; j < numBars - 1; j++) { col[j] = new Color((int) (Math.random() * 0x1000000)); } ratio = (double) values[i] / (double) maxVal; barH = ((h) * ratio) - 10; xPos[0] = pos; xPos[2] = pos + barWidth; xPos[1] = xPos[0]; xPos[3] = xPos[2]; yPos[0] = (int) h; yPos[1] = (int) barH; yPos[2] = yPos[1]; yPos[3] = yPos[0]; System.out.println( "xPos:" + xPos[1] + " yPos:" + yPos[0] + " h:" + h + " barH:" + barH + " ratio:" + ratio + " pos:" + pos); int stringPtsY[] = { ((i + 1) * 20) + 180, ((i + 1) * 20) + 200, ((i + 1) * 20) + 200, ((i + 1) * 20) + 180 }; int stringPtsX[] = {600, 600, 580, 580}; g.setColor(col[i]); g.fillPolygon(xPos, yPos, xPos.length); g.fillPolygon(stringPtsX, stringPtsY, 4); g.setColor(Color.black); g.drawString(labels[i], 610, ((i + 1) * 20) + 195); pos = pos + barWidth + 10; } }
@Override public void paint(Graphics g) { super.paint(g); for (Ball b : ballsList) { g.setColor(b.getColor()); g.fillOval(b.getX(), b.getY(), b.getSize(), b.getSize()); b.move(getWidth(), getHeight()); } }
public void paint(Graphics g) { super.paint(g); Graphics2D g2 = (Graphics2D) g; int size = Math.min( MAX_SIZE, Math.min( getWidth() - imagePadding.left - imagePadding.right, getHeight() - imagePadding.top - imagePadding.bottom)); g2.translate(getWidth() / 2 - size / 2, getHeight() / 2 - size / 2); g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); Shape shape; if (mode == ColorPicker.SAT || mode == ColorPicker.BRI) { shape = new Ellipse2D.Float(0, 0, size, size); } else { Rectangle r = new Rectangle(0, 0, size, size); shape = r; } if (hasFocus()) { PaintUtils.paintFocus(g2, shape, 5); } if (!(shape instanceof Rectangle)) { // paint a circular shadow g2.translate(2, 2); g2.setColor(new Color(0, 0, 0, 20)); g2.fill(new Ellipse2D.Float(-2, -2, size + 4, size + 4)); g2.setColor(new Color(0, 0, 0, 40)); g2.fill(new Ellipse2D.Float(-1, -1, size + 2, size + 2)); g2.setColor(new Color(0, 0, 0, 80)); g2.fill(new Ellipse2D.Float(0, 0, size, size)); g2.translate(-2, -2); } g2.drawImage(image, 0, 0, size, size, 0, 0, size, size, null); if (shape instanceof Rectangle) { Rectangle r = (Rectangle) shape; PaintUtils.drawBevel(g2, r); } else { g2.setColor(new Color(0, 0, 0, 120)); g2.draw(shape); } g2.setColor(Color.white); g2.setStroke(new BasicStroke(1)); g2.draw(new Ellipse2D.Float(point.x - 3, point.y - 3, 6, 6)); g2.setColor(Color.black); g2.draw(new Ellipse2D.Float(point.x - 4, point.y - 4, 8, 8)); g.translate(-imagePadding.left, -imagePadding.top); }
@Override public void paint(Graphics g) { super.paint(g); if (myTextField.isFocusOwner() || (getPopup() != null && getPopup().isPopupVisible())) { if (isUsingDarculaUIFlavor()) { DarculaUIUtil.paintFocusRing(g, 3, 3, getWidth() - 4, getHeight() - 4); } } }
@Override public void paint(Graphics g) { super.paint(g); g.setColor(BG_COLOR); g.fillRect(0, 0, this.getSize().width, this.getSize().height); for (int y = 0; y < 4; y++) { for (int x = 0; x < 4; x++) { drawTile(g, myTiles[x + y * 4], x, y); } } }
public void paint(Graphics g) { super.paint(g); getBounds(_rect); getInsets(_insets); g.setColor(_color); g.fillRect( _insets.left, _insets.top, _rect.width - _insets.left - _insets.right, _rect.height - _insets.top - _insets.bottom); }
public void paint(Graphics g) { super.paint(g); if (myResizable && myDrawMacCorner) { g.drawImage( ourMacCorner, getX() + getWidth() - ourMacCorner.getWidth(this), getY() + getHeight() - ourMacCorner.getHeight(this), this); } }
public void paintLogo(Graphics g, Color color, int size, int posX, int posY) { if (g == null) return; super.paint(g); g.setColor(color); g.fillRect(posX, posY, size, size); if (color == Color.WHITE) g.setColor(Color.LIGHT_GRAY); else g.setColor(Color.WHITE); g.fillOval(posX + 5, posY + 5, size - 10, size - 10); g.setColor(Color.BLACK); g.fillRect(posX + (size / 2) - 5, posY + (size / 2) - 5, 10, 10); }
public void paint(Graphics g) { super.paint(g); Graphics2D g2 = (Graphics2D) g; if (this.m_isBegin) { g2.drawString("press any key to start", 120, 190); g2.drawString("press any key to stop / resume", 100, 210); } this.paintMap(g2); }
public void paint(Graphics g) { super.paint(g); if (Game.gameState == GameState.LOADING) { if (highlightedString == 0) { g.setColor(Color.RED); g.drawString("Start Game", 100, 80); g.setColor(Color.GREEN); g.drawString("Continue Game", 100, 100); g.drawString("Options", 100, 120); } else if (highlightedString == 1) { g.setColor(Color.GREEN); g.drawString("Start Game", 100, 80); g.setColor(Color.RED); g.drawString("Continue Game", 100, 100); g.setColor(Color.GREEN); g.drawString("Options", 100, 120); } else if (highlightedString == 2) { g.setColor(Color.GREEN); g.drawString("Start Game", 100, 80); g.setColor(Color.GREEN); g.drawString("Continue Game", 100, 100); g.setColor(Color.RED); g.drawString("Options", 100, 120); } } if (Game.gameState == GameState.PLAYING) { Graphics2D g2d = (Graphics2D) g; g2d.drawImage(player.getImage(), player.getX(), player.getY(), this); ArrayList ms = player.getMissiles(); g.drawString("Bug Count: " + Bug.bugArrayList.size(), 270, 30); g.drawString("Player Score: " + Mech.mechHashMap.get(0).getScore(), 270, 60); g.drawString("Player Lives: " + Mech.mechHashMap.get(0).getLives(), 270, 90); g.drawString("Weapon Selected: " + Mech.mechHashMap.get(0).weaponSelected, 270, 120); for (int i = 0; i < ms.size(); i++) { Missile m = (Missile) ms.get(i); g2d.drawImage(m.getImage(), m.getX(), m.getY(), this); } for (Bug bug : Bug.bugArrayList) { g2d.drawImage(bug.image, bug.x, bug.y, this); System.out.println("draw bug"); System.out.println("Bug Count;" + Bug.bugArrayList.size()); bug.move(); } } else if (Game.gameState == GameState.GAMEOVER) { g.drawString("GAME OVER!", 100, 100); } Toolkit.getDefaultToolkit().sync(); g.dispose(); }
public void paint(Graphics g) { super.paint(g); g.fillRect(0, 0, 400, 300); if (times % 2 == 0) { // 提示信息 g.setColor(Color.blue); Font myFont; myFont = new Font("娃娃體-繁", Font.BOLD, 30); g.setFont(myFont); g.drawString("stage:1", 130, 140); } }
public void paint(Graphics g) { super.paint(g); // 画出我的坦克 g.fillRect(0, 0, 400, 300); // 确定区域为400 300 背景为黑色值 // 使用画坦克方法画出坦克 this.drawTank(hero.getX(), hero.getY(), g, hero.getDirect(), 0); // 画出敌人的坦克 for (int i = 0; i < ets.size(); i++) { this.drawTank(ets.get(i).getX(), ets.get(i).getY(), g, ets.get(i).getDirect(), 1); } }
// 重写paint方法 public void paint(Graphics g) { super.paint(g); // float lineWidth = 3.0f; // ((Graphics2D)g).setStroke(new BasicStroke(lineWidth)); // 将坦克的活动区域填充为默认黑色 g.fillRect(0, 0, 800, 600); this.drawTank(hero.getX(), hero.getY(), g, hero.getDirection(), 1); for (int i = 0; i < hero.bombs.size(); i++) { Bomb myBomb = hero.bombs.get(i); // 画出一颗子弹 if (myBomb != null && myBomb.isLive == true) { // float lineWidth = 2.0f; // ((Graphics2D) g).setStroke(new BasicStroke(lineWidth));//设置线条为粗线 g.draw3DRect(myBomb.x, myBomb.y, 2, 2, true); } if (myBomb.isLive == false) { hero.bombs.remove(myBomb); } } // 画出爆炸 for (int i = 0; i < baozhas.size(); i++) { BaoZha bz = baozhas.get(i); System.out.println("baozhas.size()= " + baozhas.size()); if (bz.life > 5) { g.drawImage(image3, bz.x, bz.y, 30, 30, this); } else if (bz.life > 3) { g.drawImage(image2, bz.x, bz.y, 30, 30, this); } else { g.drawImage(image1, bz.x, bz.y, 30, 30, this); } bz.liftDown(); if (bz.life == 0) { baozhas.remove(bz); } } // 画出敌人的坦克 for (int i = 0; i < ets.size(); i++) { EnemyTank et = ets.get(i); if (et.isLive) { this.drawTank(et.getX(), et.getY(), g, et.getDirection(), 0); } } }
@Override public void paint(Graphics g) { super.paint(g); Graphics2D g2d = (Graphics2D) g; displayNames(g); displayWinner(g); g2d.drawImage(board.getImage(), board.getX(), board.getY(), null, null); for (int i = 0; i < 16; i++) { g2d.drawImage(pegs[i].getImage(), pegs[i].getX(), pegs[i].getY(), null, null); for (int j = 0; j < pegs[i].amountOfBeads2(); j++) { g2d.drawImage( pegs[i].beadAt(j).getImage(), pegs[i].beadAt(j).getX(), pegs[i].beadAt(j).getY(), null, null); } } if (availableBeads[currentBead].getImage() == null) { availableBeads[currentBead].loadImage(); } g2d.drawImage( availableBeads[currentBead].getImage(), availableBeads[currentBead].getX(), availableBeads[currentBead].getY(), null, null); if (beadMustAnimate) { animationTimer = new Timer(ANIMATION_REFRESH_RATE, this); // every // REFRESH_RATE // ms animationTimer.setActionCommand("animation"); animationTimer.start(); beadMustAnimate = false; currentBead++; // creates next new bead availableBeads[currentBead] = new Bead(BEAD_INITIAL_X, BEAD_INITIAL_Y, 'b'); availableBeads[currentBead].setImage(board.getBlackBeadImage()); } }
@Override public void paint(Graphics g) { super.paint(g); // menu on game over if (c.getLifes() < 1) { showMenu = true; } this.paintBackground((Graphics2D) g); this.paintItems((Graphics2D) g); this.paintLifes((Graphics2D) g); this.paintScore((Graphics2D) g); this.paintMenu((Graphics2D) g); Toolkit.getDefaultToolkit().sync(); g.dispose(); }
private void doPaint(final Graphics g) { doTranslate( new PairConsumer<Integer, Integer>() { @Override public void consume(Integer x, Integer y) { g.translate(x, y); } }); super.paint(g); doTranslate( new PairConsumer<Integer, Integer>() { @Override public void consume(Integer x, Integer y) { g.translate(-x, -y); } }); }
public void paint(Graphics g) { Graphics2D g2D = (Graphics2D) g; // g2D.addRenderingHints( new RenderingHints( RenderingHints.KEY_ANTIALIASING , // RenderingHints.VALUE_ANTIALIAS_ON )); super.paint(g); super.paintChildren(g); // Paint Gradiant if (gradiantColor != null) { Color c1 = new Color(255, 255, 255, 0); int offset = (int) (getWidth() * gradiantOffsetRatio); GradientPaint gp = new GradientPaint(getWidth() - offset, 0, c1, getWidth(), 0, gradiantColor); g2D.setPaint(gp); g2D.fillRect(0, 0, getWidth(), getHeight()); } }
/** * Draw the icon at the specified location. Paints this component as an icon. * * @param c the component which can be used as observer * @param g the <tt>Graphics</tt> object used for painting * @param x the position on the X coordinate * @param y the position on the Y coordinate */ public void paintIcon(Component c, Graphics g, int x, int y) { g = g.create(); try { Graphics2D g2 = (Graphics2D) g; AntialiasingManager.activateAntialiasing(g2); g2.setColor(Color.WHITE); g2.setComposite(AlphaComposite.getInstance(AlphaComposite.SRC_OVER, 0.8f)); g2.fillRoundRect(x, y, getIconWidth() - 1, getIconHeight() - 1, 10, 10); g2.setColor(Color.DARK_GRAY); g2.drawRoundRect(x, y, getIconWidth() - 1, getIconHeight() - 1, 10, 10); // Indent component content from the border. g2.translate(x + 5, y + 5); super.paint(g2); g2.translate(x, y); } finally { g.dispose(); } }
/** * Permet de dessiner la gui active par rapport à la perspective de celle-ci * * @param g l'element graphic qui permet de dessiner les images. */ public void paint(Graphics g) { super.paint(g); g.drawImage( imageVueActive.getTheImage(), perspective.getCornerImageX(), perspective.getCornerImageY(), imageVueActive.getTheImage().getWidth(null) * perspective.getEchelle() + perspective.getCornerImageX(), imageVueActive.getTheImage().getHeight(null) * perspective.getEchelle() + perspective.getCornerImageY(), 0, 0, imageVueActive.getTheImage().getWidth(null), imageVueActive.getTheImage().getHeight(null), null); g.drawImage( VueOriginale.getVueOriginale().getImageOriginale().getTheImage(), this.getWidth() - 90, 15, 75, 75, null); g.drawRect(this.getWidth() - 90, 15, 75, 75); }
@Override public void paint(Graphics g) { super.paint(g); // To change body of overridden methods use File | Settings | File Templates. }
/* * We override paint() instead of paintComponent() as if we do the latter, * sometimes child panels will be painted over our size grip, rendering it * invisible. */ @Override public void paint(Graphics g) { super.paint(g); gripIcon.paintIcon(this, g, this.getX(), this.getY()); }