示例#1
0
  private Dimension textBounds() {
    final FontMetrics textMetrics = getFontMetrics(textFont);
    final FontMetrics titleMetrics = getFontMetrics(titleFont);
    int width = 0;
    int height = 0;

    // framework details
    width = titleMetrics.stringWidth(AboutIsis.getFrameworkName());
    height += titleLineHeight;
    width = Math.max(width, textMetrics.stringWidth(AboutIsis.getFrameworkCopyrightNotice()));
    height += textLineHeight;
    width = Math.max(width, textMetrics.stringWidth(frameworkVersion()));
    height += textLineHeight;

    // application details
    String text = AboutIsis.getApplicationName();
    if (text != null) {
      width = Math.max(width, titleMetrics.stringWidth(text));
      height += titleLineHeight;
    }
    text = AboutIsis.getApplicationCopyrightNotice();
    if (text != null) {
      width = Math.max(width, textMetrics.stringWidth(text));
      height += textLineHeight;
    }
    text = AboutIsis.getApplicationVersion();
    if (text != null) {
      width = Math.max(width, textMetrics.stringWidth(text));
      height += textLineHeight;
    }

    return new Dimension(width, height);
  }
示例#2
0
  @Override
  public void paint(final Graphics g) {
    g.setColor(Color.black);
    g.drawRect(0, 0, width - 1, height - 1);

    if (logo != null) {
      g.drawImage(logo, PADDING, PADDING, this);
      // g.drawRect(PADDING, PADDING, logo.getWidth(this) - 1,
      // logo.getHeight(this) - 1);
    } else {
      g.setFont(logoFont);
      final FontMetrics fm = g.getFontMetrics();
      g.drawString(LOGO_TEXT, PADDING, PADDING + fm.getAscent());
    }

    int baseline = height - PADDING - getFontMetrics(textFont).getDescent();

    // framework details - from bottom to top
    g.setFont(textFont);
    g.drawString(frameworkVersion(), left, baseline);
    baseline -= textLineHeight;
    g.drawString(AboutIsis.getFrameworkCopyrightNotice(), left, baseline);
    baseline -= textLineHeight;
    g.setFont(titleFont);
    g.drawString(AboutIsis.getFrameworkName(), left, baseline);
    baseline -= titleLineHeight;

    // application details - from bottom to top
    g.setFont(textFont);
    final String applicationVersion = AboutIsis.getApplicationVersion();
    if (applicationVersion != null) {
      g.drawString(applicationVersion, left, baseline);
      baseline -= textLineHeight;
    }
    final String applicationCopyrightNotice = AboutIsis.getApplicationCopyrightNotice();
    if (applicationCopyrightNotice != null) {
      g.drawString(applicationCopyrightNotice, left, baseline);
      baseline -= textLineHeight;
    }
    final String applicationName = AboutIsis.getApplicationName();
    if (applicationName != null) {
      g.setFont(titleFont);
      g.drawString(applicationName, left, baseline);
    }
  }