Exemple #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);
  }
Exemple #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);
    }
  }
Exemple #3
0
  public SplashWindow(final TemplateImageLoader loader) {
    super(new Frame());
    parent = (Frame) getParent();
    final String imageName = AboutIsis.getImageName();
    final TemplateImage templateImage = loader.getTemplateImage(imageName);
    if (templateImage == null) {
      throw new IsisException("Failed to find splash image " + imageName);
    }
    logo = templateImage.getImage();

    textFont = new Font("SansSerif", Font.PLAIN, 10);
    titleFont = new Font("SansSerif", Font.BOLD, 11);
    logoFont = new Font("Serif", Font.PLAIN, 36);
    textLineHeight = (int) (getFontMetrics(textFont).getHeight() * 0.85);
    titleLineHeight = (int) (getFontMetrics(titleFont).getHeight() * 1.20);

    int height = 0;
    int width = 0;

    if (logo != null) {
      width = logo.getWidth(this);
      height += logo.getHeight(this);
    } else {
      final FontMetrics metrics = getFontMetrics(logoFont);
      width = metrics.stringWidth(LOGO_TEXT);
      height = metrics.getHeight();
    }
    height += PADDING;

    final Dimension text = textBounds();
    width = Math.max(width, text.width);
    height += text.height;

    height = PADDING + height + PADDING;
    width = PADDING + width + PADDING;
    setSize(width, height);

    this.height = height;
    this.width = width;
    this.left = width / 2 - text.width / 2;

    setupCenterLocation();

    setVisible(true);
    // toFront();
  }
Exemple #4
0
 private String frameworkVersion() {
   return AboutIsis.getFrameworkVersion();
 }