示例#1
0
  /** {@inheritDoc} */
  @Override
  public void paintComponent(Graphics g) {
    super.paintComponent(g);
    Graphics2D g2d = (Graphics2D) g.create();
    g2d.setBackground(Color.white);
    int xDim = (int) (getWidth() / 56);
    int yDim = (int) (getHeight() / 66);
    g2d.drawLine(0, (agent[0].length) * yDim, Slope.getWidth() * xDim, (agent[0].length) * yDim);
    g2d.drawRect((Slope.getWidth() - 3) * xDim, 0, 15, Slope.getHeight() * yDim);

    for (int k = 0; k < Slope.getHeight(); k++)
      for (int l = 0; l < Slope.getWidth(); l++) {

        g2d.setColor(new Color(0, 0, 0, 1));
        g2d.drawRect(k * getWidth() / 56, l * getHeight() / 66, 30, 30);
      }

    for (int i = 0; i < agent.length; i++) {
      for (int j = 0; j < agent[0].length; j++) {
        g2d.setColor(Color.blue);
        if (agent[i][j]) {
          //					 g2d.drawString("*", i*getWidth()/56, j*getHeight()/66);
          g2d.drawImage(image, i * getWidth() / 56, j * getHeight() / 66, null);
        }
      }
    }
  }
示例#2
0
  @Override
  // TODO Auto-generated method stub
  public void paintComponent(Graphics g) {
    super.paintComponent(g);
    Graphics2D g2 = (Graphics2D) g;

    // Draws the two initial two YinYang symbols on the frame
    g2.setColor(color1);
    if (timeLeft < 6000) {
      g2.rotate(degrees, yin1X + (yin1Width / 2), yin1Y + (yin1Height / 2));
    }
    g2.fill(new MyYinYang(yin1X, yin1Y, yin1Width, yin1Height));
    if (timeLeft < 6000) {
      g2.rotate(-degrees, yin1X + (yin1Width / 2), yin1Y + (yin1Height / 2));
    }
    g2.setColor(color2);
    if (timeLeft < 6000) {
      g2.rotate(degrees, yin2X + (yin2Width / 2), yin2Y + (yin2Height / 2));
    }
    g2.fill(new MyYinYang(yin2X, yin2Y, yin2Width, yin2Height));
    if (timeLeft < 6000) {
      g2.rotate(-degrees, yin2X + (yin2Width / 2), yin2Y + (yin2Height / 2));
    }

    // Alters and prints the text on the screen
    g2.setColor(Color.BLACK);
    g2.setFont(font);
    g2.drawString("Score", 700, 25);
    g2.drawString(Integer.toString(points), 700, 75);
    g2.drawString("Misses", 800, 25);
    g2.drawString(Integer.toString(misses), 800, 75);
    g2.drawString("Time Left", 700, 110);
    timeDisplay = timeLeft / 100.0;
    g2.drawString(timeDisplay.toString(), 700, 160);
  }
示例#3
0
 public void paintComponent(
     Graphics e) { // only for test component area, will be deleted once the program is done
   super.paintComponent(e);
   g = (Graphics2D) e;
   g.setColor(Color.BLUE);
   // g.fill( label_8.getBounds());
 }
示例#4
0
 public void paintComponent(Graphics g) {
   super.paintComponent(g);
   g.setColor(kleur);
   g.fillRoundRect(5, 5, 70, 70, 10, 10);
   g.setColor(Color.black);
   if (waarde == 1) {
     g.fillOval(34, 34, 10, 10);
   } else if (waarde == 2) {
     g.fillOval(10, 10, 10, 10);
     g.fillOval(60, 60, 10, 10);
   } else if (waarde == 3) {
     g.fillOval(10, 10, 10, 10);
     g.fillOval(34, 34, 10, 10);
     g.fillOval(60, 60, 10, 10);
   } else if (waarde == 4) {
     g.fillOval(10, 10, 10, 10);
     g.fillOval(10, 60, 10, 10);
     g.fillOval(60, 10, 10, 10);
     g.fillOval(60, 60, 10, 10);
   } else if (waarde == 5) {
     g.fillOval(10, 10, 10, 10);
     g.fillOval(10, 60, 10, 10);
     g.fillOval(60, 10, 10, 10);
     g.fillOval(60, 60, 10, 10);
     g.fillOval(34, 34, 10, 10);
   } else if (waarde == 6) {
     g.fillOval(10, 10, 10, 10);
     g.fillOval(10, 60, 10, 10);
     g.fillOval(60, 10, 10, 10);
     g.fillOval(60, 60, 10, 10);
     g.fillOval(10, 34, 10, 10);
     g.fillOval(60, 34, 10, 10);
   } else ; // meer waarden zijn er niet
 }
示例#5
0
 public void paintComponent(Graphics g) {
   super.paintComponent(g);
   g.setColor(Color.GREEN);
   drawOneGraph(g, a);
   g.setColor(Color.BLUE);
   drawOneGraph(g, b);
 }
示例#6
0
  public void paintComponent(Graphics g) {
    super.paintComponent(g);

    int xCenter = getSize().width / 2;
    int yCenter = getSize().height / 2;
    int radius = (int) (Math.min(getSize().width, getSize().height) * 0.4);

    // Create a Polygon object
    Polygon polygon = new Polygon();

    // Add points to the polygon
    polygon.addPoint(xCenter + radius, yCenter);
    polygon.addPoint(
        (int) (xCenter + radius * Math.cos(2 * Math.PI / 6)),
        (int) (yCenter - radius * Math.sin(2 * Math.PI / 6)));
    polygon.addPoint(
        (int) (xCenter + radius * Math.cos(2 * 2 * Math.PI / 6)),
        (int) (yCenter - radius * Math.sin(2 * 2 * Math.PI / 6)));
    polygon.addPoint(
        (int) (xCenter + radius * Math.cos(3 * 2 * Math.PI / 6)),
        (int) (yCenter - radius * Math.sin(3 * 2 * Math.PI / 6)));
    polygon.addPoint(
        (int) (xCenter + radius * Math.cos(4 * 2 * Math.PI / 6)),
        (int) (yCenter - radius * Math.sin(4 * 2 * Math.PI / 6)));
    polygon.addPoint(
        (int) (xCenter + radius * Math.cos(5 * 2 * Math.PI / 6)),
        (int) (yCenter - radius * Math.sin(5 * 2 * Math.PI / 6)));

    // Draw the polygon
    g.drawPolygon(polygon);
  }
 public void paintComponent(Graphics g) {
   super.paintComponent(g);
   Graphics2D g2d = (Graphics2D) g;
   this.quadriller(g2d);
   this.placerPostes(g2d);
   this.tracerVisualisations(g2d);
 }
示例#8
0
 @Override
 protected void paintComponent(Graphics g) {
   super.paintComponent(g);
   Graphics2D g2 = (Graphics2D) g;
   if (moveThread != null) {
     if (moveThread.isRunning()) {
       Point2D p = moveThread.getCurrentPosition();
       currentDirection = moveThread.getDirection();
       this.setBounds((int) p.getX() - 32, (int) p.getY() - 32, 96, 64);
     } else {
       if (currentDirection == HeroDirection.MOVING_BACK) {
         currentDirection = HeroDirection.IDLE_BACK;
       } else if (currentDirection == HeroDirection.MOVING_FRONT) {
         currentDirection = HeroDirection.IDLE_FRONT;
       } else if (currentDirection == HeroDirection.MOVING_LEFT) {
         currentDirection = HeroDirection.IDLE_LEFT;
       } else if (currentDirection == HeroDirection.MOVING_RIGHT) {
         currentDirection = HeroDirection.IDLE_RIGHT;
       }
       moveThread = null;
       isMoveFinished = true;
     }
   }
   g2.drawImage(animation.getCurrentFrame(currentDirection), 0, 0, null);
 }
示例#9
0
  @Override
  public void paintComponent(Graphics g) {
    if (image == null) {
      super.paintComponent(g);
      return;
    }

    double imageRatio = fileImage.getWidth() / (double) fileImage.getHeight();

    int newWidth;
    int newHeight;

    if (fileImage.getWidth() > this.getWidth()) {
      newWidth = this.getWidth();
      newHeight = (int) (this.getWidth() / imageRatio);
    } else if (fileImage.getHeight() > this.getHeight()) {
      newWidth = (int) (this.getWidth() * imageRatio);
      newHeight = this.getHeight();
    } else {
      newWidth = fileImage.getWidth();
      newHeight = fileImage.getHeight();
    }

    if (cacheImage == null) {
      cacheImage = fileImage.getScaledInstance(newWidth, newHeight, 0);
    }

    int horizontalBorderSize = (this.getWidth() > newWidth) ? (this.getWidth() - newWidth) / 2 : 0;
    int verticalBorderSize =
        (this.getHeight() > newHeight) ? (this.getHeight() - newHeight) / 2 : 0;

    setBound(horizontalBorderSize, verticalBorderSize, newWidth, newHeight);

    g.drawImage(cacheImage, horizontalBorderSize, verticalBorderSize, null);
  }
示例#10
0
 public void paintComponent(Graphics g) {
   super.paintComponent(g);
   setBackground(Color.black);
   add(l);
   add(s);
   drawSpecialLines(g);
   g.setColor(Color.white);
   g.fillOval(30, 100, 75, 75);
   g.setColor(Color.blue);
   g.fillRect(getWidth() / 2, getHeight() / 2, (int) bl, 10);
   g.fillRect(getWidth() / 2, getHeight() / 2 + 40, (int) gl, 10);
   g.fillRect(getWidth() / 2, getHeight() / 2 + 80, (int) ll, 10);
   g.fillRect(getWidth() / 2, getHeight() / 2 + 120, (int) sl, 10);
   g.drawImage(bullet.getImage(), 30, getHeight() / 2 - 10, 20, 20, null);
   g.drawImage(grenade.getImage(), 30, getHeight() / 2 + 40 - 10, 20, 20, null);
   g.drawImage(laser.getImage(), 30, getHeight() / 2 + 80 - 10, 20, 20, null);
   g.drawImage(shotgun.getImage(), 30, getHeight() / 2 + 120 - 10, 20, 20, null);
   g.setColor(Color.yellow);
   if (gunTrack == 0) {
     g.drawRect(30, getHeight() / 2 - 10, 20, 20);
   } else if (gunTrack == 1) {
     g.drawRect(30, getHeight() / 2 + 40 - 10, 20, 20);
   } else if (gunTrack == 2) {
     g.drawRect(30, getHeight() / 2 + 80 - 10, 20, 20);
   } else {
     g.drawRect(30, getHeight() / 2 + 120 - 10, 20, 20);
   }
 }
示例#11
0
  public void paintComponent(Graphics g) {
    super.paintComponent(g);

    drawBorders(this.cellSize, this.gapSize, g);

    List<Cell> solution = maze.getSolution();
    for (List<Cell> row : this.maze.getCells()) {
      for (Cell cell : row) {
        Color color = Color.WHITE;
        if (cell.isVisited()) {
          color = Color.LIGHT_GRAY;
        }
        if (solution != null && solution.contains(cell)) {
          color = Color.YELLOW;
        }
        if (cell.equals(this.maze.getStart())) {
          color = Color.GREEN;
        }
        if (cell.equals(this.maze.getEnd())) {
          color = Color.RED;
        }
        drawCell(cell, this.cellSize, this.gapSize, g, color);
      }
    }

    for (Wall wall : this.maze.getWalls()) {
      drawWall(wall, this.cellSize, this.gapSize, g);
    }
  }
示例#12
0
    protected void paintComponent(Graphics g) {
      super.paintComponent(g);
      Graphics2D g2 = (Graphics2D) g;
      g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
      int w = getWidth();
      int h = getHeight();
      int pointSize = Math.max(Math.min(w, h) / 80, 4);

      double xInc = (double) (w - 2 * PAD) / (MAX_X - 1);
      double scale = (double) (h - 2 * PAD) / MAX_Y;
      // Draw abcissa.
      int tickInc = MAX_X / 10;
      for (int i = 0; i <= MAX_X; i += tickInc) {
        int x = PAD + (int) (i * xInc);
        int y = h - PAD;
        g.drawString(Integer.toString(i), x - 5, y + 20);
        g2.draw(new Line2D.Double(x, y - 5, x, y + 5));
      }
      g2.draw(new Line2D.Double(PAD, h - PAD, w - PAD / 2, h - PAD));
      AffineTransform orig = g2.getTransform();
      g2.rotate(-Math.PI / 2);
      g2.setColor(Color.black);
      g2.drawString("Number of comparisons", -((h + PAD) / 2), PAD / 3);
      g2.setTransform(orig);

      // Draw ordinate.
      tickInc = (h - PAD) / 10;

      for (int i = tickInc; i < h - PAD; i += tickInc) {
        int x = PAD;
        int closest_10 = ((int) (i / scale) / 10) * 10;

        int y = h - PAD - (int) (closest_10 * scale);
        if (y < PAD) break;
        String tickMark = Integer.toString(closest_10);
        int stringLen = (int) g2.getFontMetrics().getStringBounds(tickMark, g2).getWidth();
        g.drawString(tickMark, x - stringLen - 8, y + 5);
        g2.draw(new Line2D.Double(x - 5, y, x + 5, y));
      }
      g2.draw(new Line2D.Double(PAD, PAD / 2, PAD, h - PAD));
      g.drawString("Array Size", (w - PAD) / 2, h - PAD + 40);

      for (int index = 0; index < plot_data.size(); index++) {
        int[] data = plot_data.get(index);

        // Mark data points.
        g2.setPaint(plot_colors.get(index));

        for (int i = 0; i < data.length; i++) {
          double x = PAD + i * xInc;
          double y = h - PAD - scale * data[i];
          g2.fill(new Ellipse2D.Double(x - pointSize / 2, y - pointSize / 2, pointSize, pointSize));
        }

        g2.setFont(textFont);
        int stringHeight =
            (int) g2.getFontMetrics().getStringBounds(plot_names.get(index), g2).getHeight();
        g.drawString(plot_names.get(index), PAD + 20, PAD + (index + 1) * stringHeight);
      }
    }
示例#13
0
  @Override
  protected void paintComponent(Graphics g) {

    super.paintComponent(g);

    width = getWidth();
    height = getHeight();

    g2 = (Graphics2D) g;
    g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
    g2.translate(width / 2, getHeight() / 2);

    drawGrid(g2);

    drawAxes(g2);

    g2.setColor(EMERALD);
    g2.setStroke(new BasicStroke(3));

    System.out.println("REPAINTED " + countTest++ + " times by now...");

    try {
      drawPlot();
    } catch (ScriptException e) {
      e.printStackTrace();
    }
  }
  @Override
  protected void paintComponent(Graphics g) {
    super.paintComponent(g);
    Graphics2D gfx = (Graphics2D) g;
    gfx.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);

    // Clear screen
    gfx.setColor(Constants.BACKGROUND_COLOR);
    gfx.fillRect(0, 0, getWidth(), getHeight());
    // Render next frame
    grid.draw(gfx);
    // Trace path line
    if (tracing) {
      gfx.setColor(Constants.PATH_COLOR);
      gfx.setStroke(new BasicStroke(2));
      for (int i = 1; i < pathLine.size(); i++) {
        Coordinate p = pathLine.get(i - 1);
        Coordinate n = pathLine.get(i);
        gfx.drawLine(
            (Constants.TILESIZE + Constants.MARGIN) * p.x
                + (Constants.TILESIZE / 2)
                + Constants.MARGIN,
            (Constants.TILESIZE + Constants.MARGIN) * p.y
                + (Constants.TILESIZE / 2)
                + Constants.MARGIN,
            (Constants.TILESIZE + Constants.MARGIN) * n.x
                + (Constants.TILESIZE / 2)
                + Constants.MARGIN,
            (Constants.TILESIZE + Constants.MARGIN) * n.y
                + (Constants.TILESIZE / 2)
                + Constants.MARGIN);
      }
    }
  }
示例#15
0
  public void paintComponent(Graphics g) {
    super.paintComponent(g);
    Graphics2D g2 = (Graphics2D) g;

    currentX = leftMargin;
    currentY = topMargin;

    // Draw the links

    for (int i = 0; i < linkLines.length; i++) {
      if (weights[i].isActive()) {
        g2.setPaint(weights[i].getColor());
        g2.draw(linkLines[i]);
      }
    }

    g2.setPaint(Color.black);

    // Draw the input neurons
    g2.drawString("Inputs", (float) currentX, (float) currentY);
    currentY += titleSpace;

    for (int i = 0; i < genome.getInputs(); i++) {
      g2.drawImage(inputNeuron, (int) currentX, (int) currentY, null);
      currentY += space;
    }

    // Draw the hidden Neurons
    currentX += space;
    currentY = topMargin;
    g2.drawString("Hidden Layers", (float) currentX, (float) currentY);

    for (int i = 0; i < genome.getHiddenLayers(); i++) {
      currentY = topMargin + titleSpace;
      for (int j = 0; j < genome.getNeuronsInHiddenLayer(); j++) {
        g2.drawImage(hiddenNeuron, (int) currentX, (int) currentY, null);
        currentY += space;
      }
      currentX += space;
    }

    // Draw the output neurons
    currentY = topMargin;
    g2.drawString("Outputs", (float) currentX, (float) currentY);
    currentY += titleSpace;

    for (int i = 0; i < genome.getOutputs(); i++) {
      g2.drawImage(outputNeuron, (int) currentX, (int) currentY, null);
      currentY += space;
    }

    // Draw the links

    for (int i = 0; i < linkLines.length; i++) {
      if (weights[i].isActive()) {
        g2.setPaint(weights[i].getColor());
        g2.draw(linkLines[i]);
      }
    }
  }
示例#16
0
 @Override
 public void paintComponent(Graphics g) {
   super.paintComponent(g);
   setBackground(CANVAS_BACKGROUND);
   g.setColor(LINE_COLOR);
   g.fillOval(x, y, size, size); // draw the ball
 }
    @Override
    protected void paintComponent(Graphics g) {
      super.paintComponent(g);

      // Display root
      displayTree(g, tree.getRoot(), getWidth() / 2, 30, getWidth() / 4);
    }
示例#18
0
 public void paintComponent(Graphics g) {
   super.paintComponent(g);
   if (scene == OVERWORLD) g.drawImage(background, 0, 0, this);
   if (scene == BATTLE) {
     if (battleBG == 1) g.drawImage(background, 0, -130, this);
     else g.drawImage(background, 0, 0, this);
   }
   int loop;
   for (loop = 0; loop < enemies.size(); loop++) {
     if (scene == OVERWORLD) {
       enemies.get(loop).drawEnemy(g);
     }
     if (scene == BATTLE) {
       if (enemies.get(loop).getActivity()) {
         enemies.get(loop).drawEnemy(g);
       }
     }
   }
   for (loop = 0; loop < spellsThrown.size(); loop++) {
     spellsThrown.get(loop).drawSpell(g);
   }
   player.drawPlayer(g);
   for (loop = 0; loop < enemies.size(); loop++) {
     enemies.get(loop).drawSpells(g);
   }
   if (scene == BATTLE) {
     drawMenu(g);
     if (battleWon) drawVictory(g);
     else if (battleLost) drawDefeat(g);
   }
 }
示例#19
0
 /** RedŽfinition de la mŽthode paintComponent() de JComponent */
 public void paintComponent(Graphics g) {
   super.paintComponent(g);
   for (Shape s : shapes) {
     s.paint(g);
   }
   notifyObservers();
 }
示例#20
0
 @Override
 public void paintComponent(Graphics g) {
   super.paintComponent(g);
   g.setColor(color);
   g.drawLine(0, 0, getWidth(), getHeight());
   g.drawLine(getWidth(), 0, 0, getHeight());
 }
示例#21
0
  public void paintComponent(Graphics g) {
    super.paintComponent(g);

    if (getImage() != null) {
      Graphics2D g2d = (Graphics2D) g;

      int width = getPreferredSize().width;
      int height = getPreferredSize().height;
      int imageWidth = getImage().getWidth(this);
      int imageHeight = getImage().getHeight(this);
      int centerX = width / 2;
      int centerY = height / 2;
      double percent = 0;

      if (imageWidth > width || imageHeight > height) {
        if (imageHeight >= imageWidth) {
          percent = (double) height / imageHeight;
        } else {
          percent = (double) width / imageWidth;
        }
        imageWidth *= percent;
        imageHeight *= percent;
      }

      g2d.drawImage(
          getImage(),
          centerX - imageWidth / 2,
          centerY - imageHeight / 2,
          imageWidth,
          imageHeight,
          null);
    }
  }
 public void paintComponent(Graphics g) {
   super.paintComponent(g);
   if (uneHashtable.get(unEtat) != null) {
     g.setColor((Color) uneHashtable.get(unEtat));
     g.fillRect(100, 20, 40, 40);
   }
 }
示例#23
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);
 }
示例#24
0
  public void paintComponent(Graphics g) {
    super.paintComponent(g);
    this.setBackground(Color.black);

    // Nested for loop to draw all rows and columns
    for (int x = 0; x < num.tileRow; x++) {
      for (int y = 0; y < num.tileCol; y++) {

        if (land.xTile[x][y].isDiscovered) {
          g.setColor(land.xTile[x][y].locColor);
        } else {
          g.setColor(Color.black);
        }
        g.fillRect(
            (land.xTile[x][y].xPos + num.xOff) * num.zoom,
            (land.xTile[x][y].yPos + num.yOff) * num.zoom,
            num.tileSq * num.zoom,
            num.tileSq * num.zoom);
      }
    }

    // Code to draw and animate player
    g.setColor(Color.red);
    g.fillRect(
        num.tileSq * num.zoom * num.tileSq,
        num.tileSq * num.zoom * num.tileSq,
        num.tileSq * num.zoom,
        num.tileSq * num.zoom);
    g.setColor(Color.white);
    g.fillRect(num.tileCol * 5 - 50, 0, 150, num.tileRow * 5 + 15);
    g.setColor(Color.black);
    g.fillRect(num.tileCol * 5 - 50, 0, 10, num.tileRow * 5 + 15);
  }
  protected void paintComponent(Graphics g2) {
    super.paintComponent(g2);

    Graphics2D g = (Graphics2D) g2;
    test.draw(g2, 0, 0);
    // Shape triangle = new Polygon(new int[] {15, 20, 10}, new int[] {0, 10, 10}, 3);

    Shape square = new Rectangle2D.Double(0, 0, 30, 30);

    g.setColor(Color.white);

    g.translate(20, 20);
    // g.rotate(theta, 10, 10);
    // g.fill(star);

    // g.setColor(new Color(0, 86, 141));
    // g.fill(square);
    if (star2 != null) g.fill(star2);

    // Graphics2D g3 = (Graphics2D) g;
    // 3.fill(star);

    // g.setStroke(new BasicStroke(1));
    // g.translate(x, y);
    // g.draw(line);
    // g.draw(line2);

  }
示例#26
0
 public void paintComponent(Graphics g) {
   super.paintComponent(
       g); // do what paintComponent does, and i will tell you what to do from now on
   for (int i = list.size(); i > 0; i--) {
     g.fillOval(800 + list.get(i - 1).getX(), 800 + list.get(i - 1).getY(), 10, 10);
     System.out.println("X: " + list.get(i - 1).getX() + " Y: " + list.get(i - 1).getY());
   }
 }
示例#27
0
 /**
  * Paints this component.
  *
  * @param g The Graphics2D graphics content to paint this component in.
  */
 public void paintComponent(Graphics g) {
   super.paintComponent(g);
   Graphics2D g2D = (Graphics2D) g;
   if (orientation > 0)
     g2D.rotate(Math.PI * orientation / 2.0, imageWidth / 2.0, imageHeight / 2.0);
   g.drawImage(image, 0, 0, imageWidth, imageHeight, this);
   if (topImage != null) g2D.drawImage(topImage, 0, 0, imageWidth, imageHeight, this);
 }
 @Override
 public void paintComponent(Graphics g) {
   super.paintComponent(g);
   for (int x = 0; x < 255; x++) {
     g.setColor(new Color(x, 0, 255 - x));
     g.fillRect(x, 10, 1, 100);
   }
 }
示例#29
0
  /** Paint the node preview widget */
  public void paintComponent(Graphics g) {
    super.paintComponent(g);

    g.setColor(Color.gray);
    g.drawRect(0, 0, this.getBounds().width - 1, this.getBounds().height - 1);

    if (this.node != null) this.node.paint(g);
  }
 // paints the player, items, and rooms
 public void paintComponent(Graphics g) {
   super.paintComponent(g);
   Environment Layout = new Environment();
   Layout.drawRoom(mapX, mapY, g);
   Player PlayerSprite = new Player();
   PlayerSprite.drawPlayer(x, y, g);
   Layout.items(x, y, g, getItem);
 }