本文整理了Java中javax.swing.JSpinner.getFontMetrics()
方法的一些代码示例,展示了JSpinner.getFontMetrics()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSpinner.getFontMetrics()
方法的具体详情如下:
包路径:javax.swing.JSpinner
类名称:JSpinner
方法名:getFontMetrics
暂无
代码示例来源:origin: org.netbeans.api/org-netbeans-modules-mobility-svgcore
FontMetrics fm = currentTimeSpinner.getFontMetrics(font);
int w = fm.stringWidth("000.0"); //NOI18N
Dimension d = currentTimeSpinner.getPreferredSize();
代码示例来源:origin: net.java.dev.swing-layout/swing-layout
private int getSpinnerBaseline(JSpinner spinner, int height) {
JComponent editor = spinner.getEditor();
if (editor instanceof JSpinner.DefaultEditor) {
JSpinner.DefaultEditor defaultEditor = (JSpinner.DefaultEditor)
editor;
JTextField tf = defaultEditor.getTextField();
Insets spinnerInsets = spinner.getInsets();
Insets editorInsets = defaultEditor.getInsets();
int offset = spinnerInsets.top + editorInsets.top;
height -= (offset + spinnerInsets.bottom + editorInsets.bottom);
if (height <= 0) {
return -1;
}
return offset + getSingleLineTextBaseline(tf, height);
}
Insets insets = spinner.getInsets();
FontMetrics fm = spinner.getFontMetrics(spinner.getFont());
return insets.top + fm.getAscent();
}
代码示例来源:origin: net.java.dev.swing-layout/swing-layout
private static int getSpinnerBaseline(JSpinner spinner, int height) {
JComponent editor = spinner.getEditor();
if (editor instanceof JSpinner.DefaultEditor) {
JSpinner.DefaultEditor defaultEditor = (JSpinner.DefaultEditor)
editor;
JTextField tf = defaultEditor.getTextField();
Insets spinnerInsets = spinner.getInsets();
Insets editorInsets = defaultEditor.getInsets();
int offset = spinnerInsets.top + editorInsets.top;
height -= (offset + spinnerInsets.bottom + editorInsets.bottom);
if (height <= 0) {
return -1;
}
return offset + getSingleLineTextBaseline(tf, height);
}
Insets insets = spinner.getInsets();
FontMetrics fm = spinner.getFontMetrics(spinner.getFont());
return insets.top + fm.getAscent();
}
内容来源于网络,如有侵权,请联系作者删除!