示例#1
0
  @Override
  public void paint(Graphics2D g, IGizmo gizmo) {
    int orientation = gizmo.getOrientation();
    int x = gizmo.getX(), y = gizmo.getY();

    Flipper flipper = (Flipper) gizmo;

    Path2D.Double path = new Path2D.Double();
    path.moveTo(x, y + 0.25);
    path.lineTo(x, y + 1.75);
    path.curveTo(x, y + 2, x + 0.5, y + 2, x + 0.5, y + 1.75);
    path.lineTo(x + 0.5, y + 0.25);
    path.curveTo(x + 0.5, y, x, y, x, y + 0.25);

    if (flipper.getAngle() != 0)
      path.transform(AffineTransform.getRotateInstance(flipper.getAngle(), x + 0.25, y + 0.25));

    if (orientation != 0)
      path.transform(AffineTransform.getRotateInstance(Math.PI / 2 * orientation, x + 1, y + 1));

    g.setColor(Color.ORANGE);
    g.fill(path);

    g.setColor(Color.ORANGE.darker());
    g.draw(path);
  }
示例#2
0
  private void paintScaledTriangle(
      Graphics g, double x, double y, double size, int direction, boolean isEnabled) {
    size = Math.max(size, 2);
    Path2D.Double path = new Path2D.Double();
    path.moveTo(-size, size / 2);
    path.lineTo(size, size / 2);
    path.lineTo(0, -size / 2);
    path.closePath();
    AffineTransform affineTransform = new AffineTransform();
    affineTransform.rotate(Math.PI * (direction - 1) / 4);
    path.transform(affineTransform);

    Graphics2D g2d = (Graphics2D) g;
    double tx = x + size / 2;
    double ty = y + size / 2;
    g2d.translate(tx, ty);
    Color oldColor = g.getColor();
    if (!isEnabled) {
      g2d.translate(1, 0);
      g2d.setColor(highlight);
      g2d.fill(path);
      g2d.translate(-1, 0);
    }
    g2d.setColor(isEnabled ? darkShadow : shadow);
    g2d.fill(path);
    g2d.translate(-tx, -ty);
    g2d.setColor(oldColor);
  }
  public GamesListbox(List<GamesListbox.GameStruct> gamesArrayList) {
    listboxWidth = currTheme.getListboxWidth();
    listboxHeight = currTheme.getListboxHeight();

    shapedListbox = currTheme.getListboxPath();
    shapedListbox.transform(
        AffineTransform.getTranslateInstance(
            -currTheme.getListboxLeft(), -currTheme.getListboxTop()));

    this.setLocation(currTheme.getListboxLeft(), currTheme.getListboxTop());
    this.setSize(listboxWidth, listboxHeight);
    this.setOpaque(false);
    // No question of removing borders of around JList because it does not have any(!?)
    // unless present in a scroll pane.

    alGamesInfo = gamesArrayList;
    if (alGamesInfo.size() == 1) {
      bNoGameInstalled = true;
      alGamesInfo.add(new GameStruct("", "Install Hint", InstallHintMonogram()));
    }
    alGamesInfo.add(new GameStruct("", "Bottom Filler", alGamesInfo.get(0).getLogo()));
    noOfGames = alGamesInfo.size();
    setSelectedGameIndex(1); // Position is important!
  }