javax.swing.JTabbedPane.getFontMetrics()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(3.9k)|赞(0)|评价(0)|浏览(145)

本文整理了Java中javax.swing.JTabbedPane.getFontMetrics()方法的一些代码示例,展示了JTabbedPane.getFontMetrics()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JTabbedPane.getFontMetrics()方法的具体详情如下:
包路径:javax.swing.JTabbedPane
类名称:JTabbedPane
方法名:getFontMetrics

JTabbedPane.getFontMetrics介绍

暂无

代码示例

代码示例来源:origin: khuxtable/seaglass

/**
 * Get the font metrics for the font.
 *
 * @param  font the font.
 *
 * @return the metrics for the font.
 */
protected FontMetrics getFontMetrics(Font font) {
  return tabPane.getFontMetrics(font);
}

代码示例来源:origin: net.sf.ingenias/editor

protected void installDefaults()
{
  super.installDefaults();
  tabAreaInsets.left = 4;
  selectedTabPadInsets = new Insets(0, 0, 0, 0);
  tabInsets = selectedTabPadInsets;
  Color background = tabPane.getBackground();
  fillColor = background.darker();
  boldFont = tabPane.getFont().deriveFont(Font.BOLD);
  boldFontMetrics = tabPane.getFontMetrics(boldFont);
}

代码示例来源:origin: org.opentcs.thirdparty.jhotdraw/jhotdraw

@Override
protected FontMetrics getFontMetrics() {
  //Font font = tabPane.getFont();
  Font font = PaletteLookAndFeel.getInstance().getFont("TabbedPane.selectedFont");
  return tabPane.getFontMetrics(font);
}

代码示例来源:origin: org.bidib.jbidib.com.vldocking/vldocking

/** Returns the width of this icon */
public int getIconWidth() {
  if(width == - 1) {
    if(container == null) {
      throw new NullPointerException("container for this smart icon not specified with setIconForTabbedPane()");
    }
    // reevaluate the width with correct graphics object, in case something has changed
    //Font f = UIManager.getFont("DockTabbedPane.font"); // 2006/01/23
    Font f = UIManager.getFont("JTabbedPaneSmartIcon.font"); // 2006/01/23
    FontMetrics fm = container.getFontMetrics(f);
    this.width = 0;
    if(icon != null) {
      width = icon.getIconWidth();
    }
    width += textIconGap + fm.stringWidth(label) + otherIconsGap;
    this.otherIconsOffset = width;
    @SuppressWarnings("unused")
    int iconsOffset = otherIconsOffset;
    if(otherIcons != null) {
      for(int i = 0; i < otherIcons.length; i++) {
        width += otherIcons[i].getIconWidth(); // additional width for icons
        if(i < otherIcons.length - 1) {
          width += inBetweenOtherIconsGap;
        }
      }
    }
  }
  return width;
}

代码示例来源:origin: net.java.dev.swing-layout/swing-layout

private static int getAquaTabbedPaneBaseline(JTabbedPane tp, int height) {
  Font font = tp.getFont();
  FontMetrics metrics = tp.getFontMetrics(font);
  int ascent = metrics.getAscent();
  int offset;

代码示例来源:origin: net.java.dev.swing-layout/swing-layout

private int getMaxTabHeight(JTabbedPane tp) {
  int fontHeight = tp.getFontMetrics(tp.getFont()).getHeight();
  int height = fontHeight;
  boolean tallerIcons = false;
  for (int counter = tp.getTabCount() - 1; counter >= 0; counter--) {
    Icon icon = tp.getIconAt(counter);
    if (icon != null) {
      int iconHeight = icon.getIconHeight();
      height = Math.max(height, iconHeight);
      if (iconHeight > fontHeight) {
        tallerIcons = true;
      }
    }
  }
  Insets tabInsets = UIManager.getInsets("TabbedPane.tabInsets");
  height += 2;
  /*
  if (!isMetal() || !tallerIcons) {
    height += tabInsets.top + tabInsets.bottom;
  }*/
  return height;
}

代码示例来源:origin: net.java.dev.swing-layout/swing-layout

private static int getMaxTabHeight(JTabbedPane tp) {
  int fontHeight = tp.getFontMetrics(tp.getFont()).getHeight();
  int height = fontHeight;
  boolean tallerIcons = false;
  for (int counter = tp.getTabCount() - 1; counter >= 0; counter--) {
    Icon icon = tp.getIconAt(counter);
    if (icon != null) {
      int iconHeight = icon.getIconHeight();
      height = Math.max(height, iconHeight);
      if (iconHeight > fontHeight) {
        tallerIcons = true;
      }
    }
  }
  Insets tabInsets = UIManager.getInsets("TabbedPane.tabInsets");
  height += 2;
  if (!isMetal() || !tallerIcons) {
    height += tabInsets.top + tabInsets.bottom;
  }
  return height;
}

代码示例来源:origin: net.java.dev.swing-layout/swing-layout

"TabbedPane.tabAreaInsets"),
                  tp.getTabPlacement());
FontMetrics metrics = tp.getFontMetrics(tp.getFont());
int maxHeight = getMaxTabHeight(tp);
iconRect.setBounds(0, 0, 0, 0);

代码示例来源:origin: net.java.dev.swing-layout/swing-layout

"TabbedPane.tabAreaInsets"),
                  tp.getTabPlacement());
FontMetrics metrics = tp.getFontMetrics(tp.getFont());
int maxHeight = getMaxTabHeight(tp);
iconRect.setBounds(0, 0, 0, 0);

相关文章

JTabbedPane类方法