本文整理了Java中javax.swing.JSpinner.getInsets()
方法的一些代码示例,展示了JSpinner.getInsets()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSpinner.getInsets()
方法的具体详情如下:
包路径:javax.swing.JSpinner
类名称:JSpinner
方法名:getInsets
暂无
代码示例来源:origin: com.github.insubstantial/substance
@Override
public Dimension getPreferredSize(JComponent c) {
Dimension nextD = this.nextButton.getPreferredSize();
Dimension previousD = this.prevButton.getPreferredSize();
Dimension editorD = spinner.getEditor().getPreferredSize();
Dimension size = new Dimension(editorD.width, editorD.height);
size.width += Math.max(nextD.width, previousD.width);
Insets insets = this.spinner.getInsets();
size.width += insets.left + insets.right;
size.height += insets.top + insets.bottom;
return size;
}
代码示例来源:origin: org.java.net.substance/substance
@Override
public Dimension getPreferredSize(JComponent c) {
Dimension nextD = this.nextButton.getPreferredSize();
Dimension previousD = this.prevButton.getPreferredSize();
Dimension editorD = spinner.getEditor().getPreferredSize();
Dimension size = new Dimension(editorD.width, editorD.height);
size.width += Math.max(nextD.width, previousD.width);
Insets insets = this.spinner.getInsets();
size.width += insets.left + insets.right;
size.height += insets.top + insets.bottom;
return size;
}
代码示例来源: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();
}
内容来源于网络,如有侵权,请联系作者删除!