本文整理了Java中javax.swing.JSpinner.getFont()
方法的一些代码示例,展示了JSpinner.getFont()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JSpinner.getFont()
方法的具体详情如下:
包路径:javax.swing.JSpinner
类名称:JSpinner
方法名:getFont
暂无
代码示例来源:origin: otros-systems/otroslogviewer
@Override
public void loadConfiguration(Configuration c) {
final int defaultValue = fontSize.getFont().getSize();
model.setValue(c.getInt("appearance.fontSize", defaultValue));
customFontSize.setSelected(c.getBoolean("appearance.customFontSize", false));
fontSize.setEnabled(customFontSize.isSelected());
final String currentLf = UIManager.getLookAndFeel().getClass().getName();
final String lookAndFeel = c.getString("appearance.lookAndFeel", currentLf);
for (int i = 0; i < lookAndFeelInfoJComboBox.getItemCount(); i++) {
if (lookAndFeelInfoJComboBox.getItemAt(i).getClassName().equals(lookAndFeel)) {
lookAndFeelInfoJComboBox.setSelectedIndex(i);
break;
}
}
}
代码示例来源:origin: org.netbeans.api/org-netbeans-modules-mobility-svgcore
currentTimeSpinner.setValue(new Float(0.0f));
Font font = currentTimeSpinner.getFont();
FontMetrics fm = currentTimeSpinner.getFontMetrics(font);
int w = fm.stringWidth("000.0"); //NOI18N
代码示例来源:origin: org.gephi/tools-plugin
statusLabel = new javax.swing.JLabel();
sizeSpinner.setFont(sizeSpinner.getFont().deriveFont((float)10));
sizeSpinner.setModel(new javax.swing.SpinnerNumberModel(Float.valueOf(1.0f), Float.valueOf(0.0f), null, Float.valueOf(0.5f)));
代码示例来源: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: SKCraft/Launcher
private void initComponents() {
gameKeysText.setFont(prioritySpinner.getFont());
prioritySpinner.setComponentPopupMenu(TextFieldPopupMenu.INSTANCE);
gameKeysText.setComponentPopupMenu(TextFieldPopupMenu.INSTANCE);
JPanel container = new JPanel();
container.setLayout(new MigLayout("insets dialog"));
container.add(includeCheck, "span, gapbottom unrel");
container.add(new JLabel("Priority:"));
container.add(prioritySpinner, "span, split 2, w 50");
container.add(new JLabel("(Greater is higher)"));
container.add(new JLabel("Game Keys:"));
container.add(SwingHelper.wrapScrollPane(gameKeysText), "span");
container.add(okButton, "tag ok, span, split 2, sizegroup bttn, gaptop unrel");
container.add(cancelButton, "tag cancel, sizegroup bttn");
add(container, BorderLayout.CENTER);
getRootPane().setDefaultButton(okButton);
getRootPane().registerKeyboardAction(e -> cancelButton.doClick(), KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), JComponent.WHEN_IN_FOCUSED_WINDOW);
}
代码示例来源: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();
}
代码示例来源:origin: org.gephi/tools-plugin
statusLabel.setText(org.openide.util.NbBundle.getMessage(EdgePencilPanel.class, "EdgePencilPanel.statusLabel.text")); // NOI18N
weightSpinner.setFont(weightSpinner.getFont().deriveFont((float)10));
weightSpinner.setModel(new javax.swing.SpinnerNumberModel(Float.valueOf(1.0f), Float.valueOf(0.0f), null, Float.valueOf(0.1f)));
代码示例来源:origin: org.gephi/tools-plugin
labelIntensity.setText(org.openide.util.NbBundle.getMessage(BrushPanel.class, "BrushPanel.labelIntensity.text")); // NOI18N
intensitySpinner.setFont(intensitySpinner.getFont().deriveFont((float)10));
intensitySpinner.setModel(new javax.swing.SpinnerNumberModel(0, 0, 100, 1));
代码示例来源:origin: com.anrisoftware.prefdialog/prefdialog-misc-swing
/**
* Create the panel.
*/
UiNavigationPanel() {
setLayout(new BoxLayout(this, BoxLayout.X_AXIS));
add(Box.createHorizontalGlue());
JPanel panel = new JPanel();
panel.setLayout(new MigLayout("",
"0[64,grow]2[64,grow][pref!][64,grow]2[64,grow]0", "0[]0"));
add(panel);
currentColumn = new JSpinner();
currentColumn.setFont(currentColumn.getFont().deriveFont(
currentColumn.getFont().getStyle() & ~Font.BOLD));
panel.add(currentColumn, "cell 0 0,growx");
maximumColumn = new JFormattedTextField();
maximumColumn.setHorizontalAlignment(SwingConstants.TRAILING);
maximumColumn.setEditable(false);
panel.add(maximumColumn, "cell 1 0,grow");
seperatorLabel = new JLabel("-");
panel.add(seperatorLabel, "cell 2 0,alignx center");
currentRow = new JSpinner();
currentRow.setFont(currentRow.getFont().deriveFont(
currentRow.getFont().getStyle() & ~Font.BOLD));
panel.add(currentRow, "cell 3 0,growx");
maximumRow = new JFormattedTextField();
maximumRow.setHorizontalAlignment(SwingConstants.TRAILING);
maximumRow.setEditable(false);
panel.add(maximumRow, "cell 4 0,grow");
}
代码示例来源:origin: com.github.insubstantial/substance
this.nextButton = new SubstanceSpinnerButton(this.spinner,
SwingConstants.NORTH);
this.nextButton.setFont(this.spinner.getFont());
this.nextButton.setName("Spinner.nextButton");
代码示例来源:origin: org.java.net.substance/substance
this.nextButton = new SubstanceSpinnerButton(this.spinner,
SwingConstants.NORTH);
this.nextButton.setFont(this.spinner.getFont());
this.nextButton.setName("Spinner.nextButton");
代码示例来源:origin: org.java.net.substance/substance
this.prevButton = new SubstanceSpinnerButton(this.spinner,
SwingConstants.SOUTH);
this.prevButton.setFont(this.spinner.getFont());
this.prevButton.setName("Spinner.previousButton");
代码示例来源:origin: com.github.insubstantial/substance
this.prevButton = new SubstanceSpinnerButton(this.spinner,
SwingConstants.SOUTH);
this.prevButton.setFont(this.spinner.getFont());
this.prevButton.setName("Spinner.previousButton");
代码示例来源:origin: org.java.net.substance/substance
@Override
protected void installDefaults() {
super.installDefaults();
JComponent editor = this.spinner.getEditor();
if ((editor != null) && (editor instanceof JSpinner.DefaultEditor)) {
JTextField tf = ((JSpinner.DefaultEditor) editor).getTextField();
if (tf != null) {
int fontSize = SubstanceSizeUtils
.getComponentFontSize(this.spinner);
Insets ins = SubstanceSizeUtils
.getSpinnerTextBorderInsets(fontSize);
tf.setBorder(new EmptyBorder(ins.top, ins.left, ins.bottom,
ins.right));
tf.setFont(spinner.getFont());
tf.setOpaque(false);
}
}
if (editor != null) {
editor.setOpaque(false);
}
Border b = this.spinner.getBorder();
if (b == null || b instanceof UIResource) {
this.spinner.setBorder(new SubstanceTextComponentBorder(
SubstanceSizeUtils
.getSpinnerBorderInsets(SubstanceSizeUtils
.getComponentFontSize(this.spinner))));
}
}
代码示例来源:origin: com.github.insubstantial/substance
@Override
protected void installDefaults() {
super.installDefaults();
JComponent editor = this.spinner.getEditor();
if ((editor != null) && (editor instanceof JSpinner.DefaultEditor)) {
JTextField tf = ((JSpinner.DefaultEditor) editor).getTextField();
if (tf != null) {
int fontSize = SubstanceSizeUtils
.getComponentFontSize(this.spinner);
Insets ins = SubstanceSizeUtils
.getSpinnerTextBorderInsets(fontSize);
tf.setBorder(new EmptyBorder(ins.top, ins.left, ins.bottom,
ins.right));
tf.setFont(spinner.getFont());
tf.setOpaque(false);
}
}
if (editor != null) {
editor.setOpaque(false);
}
Border b = this.spinner.getBorder();
if (b == null || b instanceof UIResource) {
this.spinner.setBorder(new SubstanceTextComponentBorder(
SubstanceSizeUtils
.getSpinnerBorderInsets(SubstanceSizeUtils
.getComponentFontSize(this.spinner))));
}
}
内容来源于网络,如有侵权,请联系作者删除!