javax.swing.JComboBox.isVisible()方法的使用及代码示例

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

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

JComboBox.isVisible介绍

暂无

代码示例

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

if (this.cbExpansionSet.isVisible()) {
  String expansionSelection = this.cbExpansionSet.getSelectedItem().toString();
  if (!expansionSelection.equals("- All Sets")) {

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

criteria.rarities(Rarity.BONUS);
if (this.cbExpansionSet.isVisible()) {
  if (listCodeSelected.getCheckedIndices().length <= 1) {
    String expansionSelection = this.cbExpansionSet.getSelectedItem().toString();

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

final JButton testButton = new JButton("show");
  final JComboBox combo = new JComboBox(new String[]{"test1","test2"});
  testButton.addActionListener(new ActionListener(){
      // this is anonymous class
      @Override
      public void actionPerformed(ActionEvent evt){
        //then you know that is attached to this button
        combo.setVisible(!combo.isVisible());
      }
  });              
  combo.setVisible(Boolean.FALSE);
  testFrame.add(testButton);
  testFrame.add(combo);

代码示例来源:origin: com.jidesoft/jide-oss

/**
 * Sets the searching text.
 *
 * @param searchingText the new searching text.
 */
public void setSearchingText(String searchingText) {
  if (_textField != null && _textField.isVisible()) {
    _textField.setText(searchingText);
  }
  if (_comboBox != null && _comboBox.isVisible()) {
    _comboBox.setSelectedItem(searchingText);
  }
}

代码示例来源:origin: com.jidesoft/jide-oss

/**
 * Makes the search field having focus.
 */
public void focusSearchField() {
  if (_textField != null && _textField.isVisible()) {
    _textField.requestFocus();
  }
  if (_comboBox != null && _comboBox.isVisible()) {
    _comboBox.requestFocus();
  }
}

代码示例来源:origin: com.jidesoft/jide-oss

/**
 * Gets the searching text.
 *
 * @return the searching text.
 */
public String getSearchingText() {
  if (_textField != null && _textField.isVisible()) {
    return _textField.getText();
  }
  if (_comboBox != null && _comboBox.isVisible()) {
    Object item = _comboBox.getEditor().getItem();
    return item == null ? "" : item.toString();
  }
  return "";
}

代码示例来源:origin: de.dfki.mary/marytts-client

return inputText;
} else if (aComponent.equals(inputText)) {
  if (cbVoiceExampleText.isVisible()) {
    return cbVoiceExampleText;
  } else {

代码示例来源:origin: de.dfki.mary/marytts-client

return cbDefaultVoice;
} else if (aComponent.equals(cbDefaultVoice)) {
  if (cbVoiceExampleText.isVisible()) {
    return cbVoiceExampleText;
  } else {

代码示例来源:origin: com.jidesoft/jide-oss

private void clearStatus() {
  _statusLabel.setIcon(null);
  _textField.setBackground(UIDefaultsLookup.getColor("TextField.background"));
  _comboBox.getEditor().getEditorComponent().setBackground(UIDefaultsLookup.getColor("TextField.background"));
  if (isShowMatchCount() && (_textField.getText().length() > 0 || (_comboBox.isVisible() && _comboBox.getEditor().getEditorComponent() instanceof JTextField && ((JTextField) _comboBox.getEditor().getEditorComponent()).getText().length() > 0))) {
    _statusLabel.setText(getSearchable().getMatchCount() + " " + getResourceString("SearchableBar.matches"));
  }
  else {
    _statusLabel.setText("");
  }
  hideMessage();
}

代码示例来源:origin: com.jidesoft/jide-oss

private void showMessage(String message) {
  hideMessage();
  _messagePopup = com.jidesoft.popup.JidePopupFactory.getSharedInstance().createPopup();
  JLabel label = new JLabel(message);
  label.setOpaque(true);
  label.setFont(UIDefaultsLookup.getFont("Label.font").deriveFont(Font.BOLD, 11));
  label.setBackground(new Color(253, 254, 226));
  label.setBorder(BorderFactory.createEmptyBorder(2, 6, 2, 6));
  label.setForeground(UIDefaultsLookup.getColor("ToolTip.foreground"));
  _messagePopup.getContentPane().setLayout(new BorderLayout());
  _messagePopup.getContentPane().add(label);
  if (_textField != null && _textField.isVisible()) {
    _messagePopup.setOwner(_textField);
  }
  if (_comboBox != null && _comboBox.isVisible()) {
    _messagePopup.setOwner(_comboBox);
  }
  _messagePopup.setDefaultMoveOperation(JidePopup.HIDE_ON_MOVED);
  _messagePopup.setTransient(true);
  _messagePopup.showPopup();
  addMouseMotionListener(_mouseMotionListener);
  if (_textField != null && _textField.isVisible()) {
    _textField.addKeyListener(_keyListener);
  }
  if (_comboBox != null && _comboBox.isVisible()) {
    _comboBox.addKeyListener(_keyListener);
  }
}

代码示例来源:origin: joel-costigliola/assertj-swing

/**
 * Returns the {@code String} representation of the given {@code Component}, which should be a {@code JComboBox}.
 *
 * @param c the given {@code Component}.
 * @return the {@code String} representation of the given {@code JComboBox}.
 */
@RunsInCurrentThread
@Override
@Nonnull protected String doFormat(@Nonnull Component c) {
 JComboBox<?> comboBox = (JComboBox<?>) c;
 String format = "%s[name=%s, selectedItem=%s, contents=%s, editable=%b, enabled=%b, visible=%b, showing=%b]";
 return String.format(format, getRealClassName(c), quote(comboBox.getName()),
            quote(comboBox.getSelectedItem()), Arrays.format(contentsOf(comboBox)), comboBox.isEditable(),
            comboBox.isEnabled(), comboBox.isVisible(), comboBox.isShowing());
}

代码示例来源:origin: com.jidesoft/jide-oss

/**
 * Sets the maximum search history length.
 * <p/>
 * By default, it's 0, which means there is no history to shown to keep the behavior backward compatibility. To show
 * history with a JComboBox, please use this method to set a positive or negative value. Any negative value means
 * that the history size is unlimited.
 *
 * @param maxHistoryLength the maximum history length
 * @since 3.4.1
 */
public void setMaxHistoryLength(int maxHistoryLength) {
  if (_maxHistoryLength != maxHistoryLength) {
    int old = _maxHistoryLength;
    _maxHistoryLength = maxHistoryLength;
    if (getMaxHistoryLength() == 0) {
      _leadingLabel.setLabelFor(_textField);
      _textField.setVisible(true);
      Object item = _comboBox.getEditor().getItem();
      _textField.setText(item == null ? "" : item.toString());
      _comboBox.setVisible(false);
    }
    else if (!_comboBox.isVisible()) {
      _leadingLabel.setLabelFor(_comboBox);
      _comboBox.setVisible(true);
      _comboBox.getEditor().setItem(_textField.getText());
      _textField.setVisible(false);
    }
    firePropertyChange(PROPERTY_MAX_HISTORY_LENGTH, old, _maxHistoryLength);
  }
}

相关文章

JComboBox类方法