ProgressCanvasViewer.java 文件源码

java
阅读 49 收藏 0 点赞 0 评论 0

项目:termsuite-ui 作者:
/**
   * Get the size hints for the receiver. These are used for
   * layout data.
   * @return Point - the preferred x and y coordinates
   */
  public Point getSizeHints() {

      Display display = canvas.getDisplay();

      GC gc = new GC(canvas);
      FontMetrics fm = gc.getFontMetrics();
      int charWidth = fm.getAverageCharWidth();
      int charHeight = fm.getHeight();
      int maxWidth = display.getBounds().width / 2;
      int maxHeight = display.getBounds().height / 6;
      int fontWidth = charWidth * maxCharacterWidth;
      int fontHeight = charHeight * numShowItems;
      if (maxWidth < fontWidth) {
    fontWidth = maxWidth;
}
      if (maxHeight < fontHeight) {
    fontHeight = maxHeight;
}
      gc.dispose();
      return new Point(fontWidth, fontHeight);
  }
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号