コード例 #1
0
 /*     */ @Deprecated
 /*     */ protected FontMetrics getFontMetrics() /*     */ {
   /* 169 */ sync();
   /* 170 */ Container localContainer = getContainer();
   /* 171 */ return localContainer != null
       ? localContainer.getFontMetrics(this.font)
       : Toolkit.getDefaultToolkit().getFontMetrics(this.font);
   /*     */ }
コード例 #2
0
ファイル: GUIConstants.java プロジェクト: JohnLeM/basex
  /**
   * Initializes colors.
   *
   * @param prop gui properties
   */
  public static void init(final GUIProp prop) {
    final int r = prop.num(GUIProp.COLORRED);
    final int g = prop.num(GUIProp.COLORGREEN);
    final int b = prop.num(GUIProp.COLORBLUE);

    // calculate color c:
    // c = (255 - expectedColor) * 10 / factor (= GUIRED/BLUE/GREEN)
    color1 = new Color(col(r, 24), col(g, 25), col(b, 40));
    color2 = new Color(col(r, 32), col(g, 32), col(b, 44));
    color3 = new Color(col(r, 48), col(g, 50), col(b, 40));
    color4 = new Color(col(r, 140), col(g, 100), col(b, 70));
    color1A = new Color(col(r, 110), col(g, 150), col(b, 160), 100);

    colormark1A = new Color(col(r, 32), col(g, 160), col(b, 320), 100);
    colormark2A = new Color(col(r, 16), col(g, 80), col(b, 160), 100);
    colormark1 = new Color(col(r, 16), col(g, 120), col(b, 240));
    colormark2 = new Color(col(r, 16), col(g, 80), col(b, 160));
    colormark3 = new Color(col(r, 32), col(g, 160), col(b, 320));
    colormark4 = new Color(col(r, 1), col(g, 40), col(b, 80));

    // create color array
    for (int l = 1; l < COLORS.length + 1; ++l) {
      COLORS[l - 1] =
          new Color(Math.max(255 - l * r, 0), Math.max(255 - l * g, 0), Math.max(255 - l * b, 0));
    }
    final Color c = COLORS[16];
    color2A = new Color(c.getRed(), c.getGreen(), c.getBlue(), 40);
    color3A = new Color(c.getRed(), c.getGreen(), c.getBlue(), 100);

    final String f = prop.get(GUIProp.FONT);
    final int type = prop.num(GUIProp.FONTTYPE);
    fontSize = prop.num(GUIProp.FONTSIZE);
    font = new Font(f, type, fontSize);
    mfont = new Font(prop.get(GUIProp.MONOFONT), type, fontSize);
    bfont = new Font(f, Font.BOLD, fontSize);
    lfont = new Font(f, type, 18 + (fontSize >> 1));
    dmfont = new Font(prop.get(GUIProp.MONOFONT), 0, TFONT.getSize() - 1);

    final Container comp = new Container();
    dwidth = comp.getFontMetrics(dmfont).getWidths();
    fwidth = comp.getFontMetrics(font).getWidths();
    lwidth = comp.getFontMetrics(lfont).getWidths();
    mfwidth = comp.getFontMetrics(mfont).getWidths();
    bwidth = comp.getFontMetrics(bfont).getWidths();
  }
コード例 #3
0
ファイル: GlyphPainter1.java プロジェクト: FauxFaux/jdk9-jdk
 @SuppressWarnings("deprecation")
 void sync(GlyphView v) {
   Font f = v.getFont();
   if ((metrics == null) || (!f.equals(metrics.getFont()))) {
     // fetch a new FontMetrics
     Container c = v.getContainer();
     metrics = (c != null) ? c.getFontMetrics(f) : Toolkit.getDefaultToolkit().getFontMetrics(f);
   }
 }
コード例 #4
0
 /*     */ final void updateMetrics() {
   /* 316 */ Container localContainer = getContainer();
   /* 317 */ Font localFont = localContainer.getFont();
   /* 318 */ this.metrics = localContainer.getFontMetrics(localFont);
   /* 319 */ this.tabSize = (getTabSize() * this.metrics.charWidth('m'));
   /*     */ }