javax.swing.JSpinner.setBorder()方法的使用及代码示例

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

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

JSpinner.setBorder介绍

暂无

代码示例

代码示例来源:origin: magefree/mage

this.cardsList = cardsList;
spinner = new JSpinner();
spinner.setBorder(BorderFactory.createEmptyBorder());
spinner.setModel(new SpinnerNumberModel(0,0,999,1));
editor = ((JSpinner.DefaultEditor) spinner.getEditor());

代码示例来源:origin: com.eas.platypus/platypus-js-calendar-widget

public void setBorderless(boolean aBorderless) {
  isBorderless = aBorderless;
  if (isBorderless) {
    _spinner.setBorder(null);
  }
}

代码示例来源:origin: com.eas.platypus/platypus-js-calendar-widget

@Override
public void updateUI() {
  super.updateUI();
  if (isBorderless) {
    _spinner.setBorder(null);
  }
}

代码示例来源:origin: tinyMediaManager/tinyMediaManager

@Override
public void installDefaults() {
 super.installDefaults();
 spinner.setBorder(BorderFactory.createLineBorder(fieldBorderColor));
}

代码示例来源:origin: stackoverflow.com

class SpinnerEditor extends DefaultCellEditor
{
  private JSpinner spinner;

  public SpinnerEditor()
  {
    super( new JTextField() );
    spinner = new JSpinner(new SpinnerNumberModel(0, 0, 100, 5));
    spinner.setBorder( null );
  }

  public Component getTableCellEditorComponent(
    JTable table, Object value, boolean isSelected, int row, int column)
  {
    spinner.setValue( value );
    return spinner;
  }

  public Object getCellEditorValue()
  {
    return spinner.getValue();
  }
}

代码示例来源:origin: freeplane/freeplane

/**
   * Updates the UI.
   *
   * @see javax.swing.JPanel#updateUI()
   */
  @Override
  public void updateUI() {
    final JSpinner testSpinner = new JSpinner();
    if (spinner != null) {
      if ("Windows".equals(UIManager.getLookAndFeel().getID())) {
        spinner.setBorder(testSpinner.getBorder());
      }
      else {
        spinner.setBorder(new EmptyBorder(0, 0, 0, 0));
      }
    }
  }
}

代码示例来源:origin: atarw/material-ui-swing

@Override
public void installUI (JComponent c) {
  super.installUI (c);
  JSpinner spinner = (JSpinner) c;
  spinner.setOpaque (false);
  spinner.setFont (UIManager.getFont ("Spinner.font"));
  spinner.setBackground (UIManager.getColor ("Spinner.background"));
  spinner.setForeground (UIManager.getColor ("Spinner.foreground"));
  spinner.setBorder (UIManager.getBorder ("Spinner.border"));
}

代码示例来源:origin: edu.stanford.protege/explanation-workbench

maxExplanationsSelector.setBorder(BorderFactory.createEmptyBorder(0, 30, 0, 0));
maxExplanationsSelector.addChangeListener(e -> spinnerUpdateTimer.restart());

代码示例来源:origin: net.java.abeille/abeille

/**
 * @return the spinner component that is visible when the focus box has
 *         'focus'.
 */
JSpinner getSpinner() {
  if (m_spinner == null) {
    m_spinner = new JSpinner(new SpinnerNumberModel(m_index, 1, m_max_index, 1));
    m_spinner.setBorder(javax.swing.BorderFactory.createLineBorder(m_background));
    JSpinner.NumberEditor seditor = (JSpinner.NumberEditor) m_spinner.getEditor();
    seditor.getTextField().setBackground(m_background);
    seditor.getTextField().setForeground(m_foreground);
    m_spinner.addChangeListener(new ChangeListener() {
      public void stateChanged(ChangeEvent e) {
        notifyListeners(new ActionEvent(FocusBox.this, ActionEvent.ACTION_PERFORMED, FOCUS_INDEX_CHANGED));
      }
    });
  }
  return m_spinner;
}

代码示例来源:origin: MegaMek/mekhq

private void initComponents() {
  spinnerHits = new JSpinner();
  btnOK = new JButton();
  ResourceBundle resourceMap = ResourceBundle.getBundle("mekhq.resources.EditPersonnelHitsDialog", new EncodeControl()); //$NON-NLS-1$
  setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
  setName("Form"); // NOI18N
  setTitle(resourceMap.getString("Form.title") + " " + person.getName());
  getContentPane().setLayout(new BorderLayout());
  setMinimumSize(new Dimension(240, 40));
  spinnerModel = new SpinnerNumberModel(person.getHits(), 0, 5, 1);
  spinnerHits.setModel(spinnerModel);
  spinnerHits.setBorder(BorderFactory.createCompoundBorder(
    BorderFactory.createTitledBorder(resourceMap.getString("spinnerHits.title")), // NOI18N
    BorderFactory.createEmptyBorder(5,5,5,5)));
  getContentPane().add(spinnerHits, BorderLayout.CENTER);
  btnOK.setText(resourceMap.getString("btnOK.text")); // NOI18N
  btnOK.setName("btnOK"); // NOI18N
  btnOK.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent evt) {
      btnOKActionPerformed(evt);
    }
  });
  getContentPane().add(btnOK, BorderLayout.PAGE_END);
  pack();
}

代码示例来源:origin: com.haulmont.thirdparty/swingx-core

/**
 * Creates and returns the JSpinner used for year navigation.
 * 
 * @return
 */
private JSpinner createSpinner() {
  JSpinner spinner = new JSpinner();
  spinner.setFocusable(false);
  spinner.setBorder(BorderFactory.createEmptyBorder());
  NumberEditor editor = new NumberEditor(spinner);
  editor.getFormat().setGroupingUsed(false);
  editor.getTextField().setFocusable(false);
  spinner.setEditor(editor);
  return spinner;
}

代码示例来源:origin: org.swinglabs.swingx/swingx-core

/**
 * Creates and returns the JSpinner used for year navigation.
 * 
 * @return
 */
private JSpinner createSpinner() {
  JSpinner spinner = new JSpinner();
  spinner.setFocusable(false);
  spinner.setBorder(BorderFactory.createEmptyBorder());
  NumberEditor editor = new NumberEditor(spinner);
  editor.getFormat().setGroupingUsed(false);
  editor.getTextField().setFocusable(false);
  spinner.setEditor(editor);
  return spinner;
}

代码示例来源:origin: org.bidib.jbidib.swinglabs.swingx/swingx-core

/**
 * Creates and returns the JSpinner used for year navigation.
 * 
 * @return
 */
private JSpinner createSpinner() {
  JSpinner spinner = new JSpinner();
  spinner.setFocusable(false);
  spinner.setBorder(BorderFactory.createEmptyBorder());
  NumberEditor editor = new NumberEditor(spinner);
  editor.getFormat().setGroupingUsed(false);
  editor.getTextField().setFocusable(false);
  spinner.setEditor(editor);
  return spinner;
}

代码示例来源:origin: org.swinglabs.swingx/swingx-all

/**
 * Creates and returns the JSpinner used for year navigation.
 * 
 * @return
 */
private JSpinner createSpinner() {
  JSpinner spinner = new JSpinner();
  spinner.setFocusable(false);
  spinner.setBorder(BorderFactory.createEmptyBorder());
  NumberEditor editor = new NumberEditor(spinner);
  editor.getFormat().setGroupingUsed(false);
  editor.getTextField().setFocusable(false);
  spinner.setEditor(editor);
  return spinner;
}

代码示例来源:origin: org.codehaus.jtstand/jtstand-desktop

/**
 * Creates and returns the JSpinner used for year navigation.
 * 
 * @return
 */
private JSpinner createSpinner() {
  JSpinner spinner = new JSpinner();
  spinner.setFocusable(false);
  spinner.setBorder(BorderFactory.createEmptyBorder());
  NumberEditor editor = new NumberEditor(spinner);
  editor.getFormat().setGroupingUsed(false);
  editor.getTextField().setFocusable(false);
  spinner.setEditor(editor);
  return spinner;
}

代码示例来源:origin: org.apache.cayenne/cayenne-nodeps

public SpinnerEditor(final JSpinner spinner) {
   super(new JTextField());
   editorComponent = spinner;
   spinner.setBorder(editStateBorder);
   spinner.getEditor().setBorder(null);
   final JFormattedTextField field =
     ((JSpinner.DefaultEditor)spinner.getEditor()).getTextField();
   field.setBorder(null);
   delegate = new EditorDelegate() {
    public void setValue(Object value) {
     spinner.setValue(value);
    }
    public Object getCellEditorValue() {
     return spinner.getValue();
    }
    public boolean stopCellEditing() {
     if (field.isEditValid()) {
      try {field.commitEdit();}
      catch (ParseException ex) {}
     } else {
      field.setBorder(invalidStateBorder);
      return false;
     }
     return super.stopCellEditing();
    }
   };
   field.addActionListener(delegate);
  }
//    public Component getTableCellEditorComponent(JTable table, Object value,

代码示例来源:origin: org.objectstyle.cayenne/cayenne

public SpinnerEditor(final JSpinner spinner) {
   super(new JTextField());
   editorComponent = spinner;
   spinner.setBorder(editStateBorder);
   spinner.getEditor().setBorder(null);
   final JFormattedTextField field =
     ((JSpinner.DefaultEditor)spinner.getEditor()).getTextField();
   field.setBorder(null);
   delegate = new EditorDelegate() {
    public void setValue(Object value) {
     spinner.setValue(value);
    }
    public Object getCellEditorValue() {
     return spinner.getValue();
    }
    public boolean stopCellEditing() {
     if (field.isEditValid()) {
      try {field.commitEdit();}
      catch (ParseException ex) {}
     } else {
      field.setBorder(invalidStateBorder);
      return false;
     }
     return super.stopCellEditing();
    }
   };
   field.addActionListener(delegate);
  }
//    public Component getTableCellEditorComponent(JTable table, Object value,

代码示例来源:origin: GoldenGnu/jeveassets

CompoundBorder compoundBorder = (CompoundBorder) border;
if (color == Color.GRAY)  {
  jGroup.setBorder(BorderFactory.createCompoundBorder(compoundBorder.getOutsideBorder(), BorderFactory.createLineBorder(jGroup.getBackground(), 2)));
} else {
  jGroup.setBorder(BorderFactory.createCompoundBorder(compoundBorder.getOutsideBorder(), BorderFactory.createLineBorder(color, 2)));

代码示例来源: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))));
  }
}

相关文章