Package java.awt.font

Examples of java.awt.font.GlyphVector


    AmountablePrice amounable = getStoredAmount(ware, ship, office);
    int storedAmount =amounable.getAmount();
    int value = 0;
    if (storedAmount>0){
      value = amounable.getAVGPrice();
      GlyphVector gv = opPainter.createGlyphVector(g2d, String.valueOf(value), 18);
      int x = xRight-((int)gv.getVisualBounds().getWidth()+coinSpace+coindWidth);
      g2d.drawGlyphVector(gv, x, y);
      x = xRight-coindWidth;
      y -= (int) Math.ceil(gv.getVisualBounds().getHeight());
      g2d.drawImage(coin, x, y, null);
    }
  }
View Full Code Here


   */
  private void drawStoredAmount(Graphics2D g2d, IWare ware, IShip ship, ITradingOffice office, int y) throws FontFormatException, IOException{
    AmountablePrice amounable = getStoredAmount(ware, ship, office);
    int value = amounable.getAmount(); // differ between ship and convoi
    if (value>0){
      GlyphVector gv = opPainter.createGlyphVector(g2d, String.valueOf(value), 18);
      g2d.drawGlyphVector(gv, positions.xShip, y); // this value is dynamic
      // draw barrel or burden
    }
  }
View Full Code Here

      }
      break;
    default:
      value = ">";
    }
    GlyphVector gv = opPainter.createGlyphVector(g2d, value, 18);
    int xPadding = imageUtils.computeCenterAlignX(positions.xSell, waxSeal.getWidth(), (int)gv.getVisualBounds().getWidth());
    g2d.drawGlyphVector(gv, xPadding, y);
  }
View Full Code Here

      }
      break;
    default:
      value = "<";
    }
    GlyphVector gv = opPainter.createGlyphVector(g2d, value, 18);
    int xPadding = imageUtils.computeCenterAlignX(positions.xBuy, waxSeal.getWidth(), (int)gv.getVisualBounds().getWidth());
    g2d.drawGlyphVector(gv, xPadding, y);

  }
View Full Code Here

      break;
    }
    int availableAmount = available.getAmount();
    int value = availableAmount; // amount available
    if (value>0){
      GlyphVector gv = opPainter.createGlyphVector(g2d, String.valueOf(value), 18);
      g2d.drawGlyphVector(gv, positions.xCity, y);
      // draw barrel or burden
      if (ware.getSizeAsBarrels()==1){
        // barrel
        g2d.drawImage(barrel, (int)(positions.xCity+gv.getVisualBounds().getWidth())+5, y-positions.lineHeight*2/3, null);
      } else {
        g2d.drawImage(bale, (int)(positions.xCity+gv.getVisualBounds().getWidth())+5, y-positions.lineHeight*2/3, null);
      }
    }
    return availableAmount;

  }
View Full Code Here

      break;
    }
    default:
      throw new IllegalStateException("Dialog type "+type+" not handled");
    }
    GlyphVector gv = opPainter.createGlyphVector(g2d, name, 18);
    g2d.drawGlyphVector(gv, x, y);
   
    // Barrel icon
    x += (int)Math.rint(gv.getVisualBounds().getWidth())+50;
    g2d.drawImage(barrel, x, y-(int)Math.rint(positions.titleHeigth), null); // Is y correct ???
   
    // loaded on ship and ship capacity
    x += 50;
    StringBuilder sb = new StringBuilder();
View Full Code Here

   * @throws FontFormatException
   * @throws IOException
   */
  private void drawTableHeader(Graphics2D g2d,final int y) throws FontFormatException, IOException{
    Date date = Date.getInstance(0); // TODO very ugly solution
    GlyphVector gv = opPainter.createGlyphVector(g2d, date.getStartOfWeek()+" to "+date.getEndOfWeek(), 19); // TODO externalize
    int x = positions.lastWeek+50-(int)Math.rint(gv.getVisualBounds().getWidth());
    g2d.drawGlyphVector(gv, x, y);
    String columnTitle = "Forecast";
    gv = opPainter.createGlyphVector(g2d, columnTitle, 19);
    g2d.drawGlyphVector(gv, positions.forecast, y);
  }
View Full Code Here

   * @throws FontFormatException
   * @throws IOException
   */
  private int drawRow(Graphics2D g2d, int y,int leftBorder, String text) throws FontFormatException, IOException{
    y += positions.lineHeight;
    GlyphVector gv = opPainter.createGlyphVector(g2d, text, 18);
    int x = leftBorder-(int)Math.rint(gv.getVisualBounds().getWidth());
    g2d.drawGlyphVector(gv, x, y);
    return y;
  }
View Full Code Here

  protected BufferedImage initBackgroundImage(IImageLoader loader,Point topLeft) {
    BufferedImage bg = super.initBackgroundImage(loader,topLeft);
    Graphics2D g2d = bg.createGraphics();
    g2d.setColor(Color.BLACK);
    try {
      GlyphVector gv = opPainter.createGlyphVector(g2d, "Balance", 24); // TODO externalize
      double titleHeight = gv.getVisualBounds().getHeight();
      int length = (int) Math.rint(gv.getVisualBounds().getWidth());
      int x = ((bg.getWidth()-getInset().left-getInset().right)-length)/2;
      int y = getInset().top+10+(int)Math.rint(titleHeight*2/3);
      g2d.drawGlyphVector(gv, x, y);
      // Dynamic row
      y += titleHeight;
      y += (int)Math.rint(titleHeight*2/3);
     
      BufferedImage waxSeal = loader.getImage("waxseal");
      int leftBorderX = topLeft.x+getInset().left;
      int firstColumn = leftBorderX+120; // right aligned
      int lastWeek = leftBorderX+200;
      int forecast = leftBorderX+300;
      int secondcolumn = leftBorderX+150;
      int thirdColumn = leftBorderX+200;
      int forthColumn = leftBorderX+280;
      int fifthColumn = leftBorderX+330;
      int yLineDiff = waxSeal.getHeight();
      // Initialize the position relative to the frame
      positions = new DialogPositions(titleHeight, yLineDiff, lastWeek, forecast, secondcolumn, thirdColumn, forthColumn,fifthColumn);
     
      leftBorderX = getInset().left; // Use local coordinates
      firstColumn = leftBorderX+120; // right aligned
     
      // table header
      y += positions.lineHeight; // more space to the title
      y += positions.lineHeight;
      y += positions.lineHeight;
      y += positions.lineHeight;
     
      // Table
      // Rental income
      y = drawRow(g2d, y, firstColumn, "Rental income");
     
      // wages
      y = drawRow(g2d, y, firstColumn, "Wage costs");
     
      // tax
      y = drawRow(g2d, y, firstColumn, "Property tax");
     
      // office trading
      y = drawRow(g2d, y, firstColumn, "Office trading");
     
      // steward
      y = drawRow(g2d, y, firstColumn, "Steward");
     
      // other
      y = drawRow(g2d, y, firstColumn, "Other");
     
      // sum
      y += positions.lineHeight;
      y += positions.lineHeight;
      gv = opPainter.createGlyphVector(g2d, "Sum", 18);
      x = firstColumn-(int)Math.rint(gv.getVisualBounds().getWidth());
      g2d.drawGlyphVector(gv, x, y);

      y += positions.lineHeight;
      y += positions.lineHeight;

      // Buildings
      y = drawRow(g2d, y, firstColumn, "Buildings");
     
      // workshops
      y = drawRow(g2d, y, firstColumn, "Workshops");
     
      // Tenement
      y = drawRow(g2d, y, firstColumn, "Tenements");

      // Footer buttons
      y = bg.getHeight()-getInset().bottom-positions.lineHeight;
      x = getInset().left+30;
      int footerWidth = bg.getWidth()-getInset().left-getInset().right-2*30;
      x += 3*footerWidth/4;
      // close
      g2d.drawImage(waxSeal, x,y-(int)(positions.lineHeight*0.8), null);
      NamedPolygon polygon = new NamedPolygon("Close");
      polygon.addPoint(topLeft.x+x, topLeft.y+y-(int)(positions.lineHeight*0.8));
      polygon.addPoint(topLeft.x+x+waxSeal.getWidth(), topLeft.y+y-(int)(positions.lineHeight*0.8));
      polygon.addPoint(topLeft.x+x+waxSeal.getWidth(), topLeft.y+y-(int)(positions.lineHeight*0.8)+waxSeal.getHeight());
      polygon.addPoint(topLeft.x+x, topLeft.y+y-(int)(positions.lineHeight*0.8)+waxSeal.getHeight());
      footerPolygons.add(polygon, new CloseAction(this));
      g2d.setColor(new Color(0xEA,0xC1,0x17)); // Gold
      gv = opPainter.createGlyphVector(g2d, "X", 18);
      int xPadding = imageUtils.computeCenterAlignX(x, waxSeal.getWidth(), (int)gv.getVisualBounds().getWidth());
      g2d.drawGlyphVector(gv, xPadding, y); // centeralign


    } catch (FontFormatException e1) {
      e1.printStackTrace();
View Full Code Here

    gScr.setColor(oldColor);
  }
  private void drawBalanceRow(Graphics2D g2d, int y, int amount, int people,
      int maxPeople, String label) throws FontFormatException, IOException {
    int xPadding = positions.secondcolumn;
    GlyphVector gv = opPainter.createGlyphVector(g2d, String.valueOf(amount), 18);
    g2d.drawGlyphVector(gv, xPadding, y);
   
    xPadding = positions.thirdColumn;
    gv = opPainter.createGlyphVector(g2d, label, 18);
    g2d.drawGlyphVector(gv, xPadding, y);
View Full Code Here

TOP

Related Classes of java.awt.font.GlyphVector

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.