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

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

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

JComboBox.getClientProperty介绍

暂无

代码示例

代码示例来源:origin: org.netbeans.api/org-openide-explorer

static boolean isIgnoreSelectionEvents( JComboBox combo ) {
  Object res = combo.getClientProperty( "nb.combo.autocomplete.ignoreselection" ); //NOI18N
  
  return res instanceof Boolean && ((Boolean)res).booleanValue();
}

代码示例来源:origin: org.netbeans.api/org-openide-explorer

static boolean isAutoCompleteInstalled( JComboBox combo ) {
  Object res = combo.getClientProperty( "nb.combo.autocomplete" ); //NOI18N
  return res instanceof Boolean && ((Boolean)res).booleanValue();
}

代码示例来源:origin: com.github.insubstantial/substance

/**
 * Returns the popup flyout orientation for the specified combobox.
 * 
 * @param combobox
 *            Combobox.
 * @return The popup flyout orientation for the specified combobox.
 * @see SubstanceLookAndFeel#COMBO_BOX_POPUP_FLYOUT_ORIENTATION
 */
public static int getPopupFlyoutOrientation(JComboBox combobox) {
  Object comboProperty = combobox
      .getClientProperty(SubstanceLookAndFeel.COMBO_BOX_POPUP_FLYOUT_ORIENTATION);
  if (comboProperty instanceof Integer)
    return (Integer) comboProperty;
  Object globalProperty = UIManager
      .get(SubstanceLookAndFeel.COMBO_BOX_POPUP_FLYOUT_ORIENTATION);
  if (globalProperty instanceof Integer)
    return (Integer) globalProperty;
  return SwingConstants.SOUTH;
}

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

/**
 * Returns the popup flyout orientation for the specified combobox.
 * 
 * @param combobox
 *            Combobox.
 * @return The popup flyout orientation for the specified combobox.
 * @see SubstanceLookAndFeel#COMBO_BOX_POPUP_FLYOUT_ORIENTATION
 */
public static int getPopupFlyoutOrientation(JComboBox combobox) {
  Object comboProperty = combobox
      .getClientProperty(SubstanceLookAndFeel.COMBO_BOX_POPUP_FLYOUT_ORIENTATION);
  if (comboProperty instanceof Integer)
    return (Integer) comboProperty;
  Object globalProperty = UIManager
      .get(SubstanceLookAndFeel.COMBO_BOX_POPUP_FLYOUT_ORIENTATION);
  if (globalProperty instanceof Integer)
    return (Integer) globalProperty;
  return SwingConstants.SOUTH;
}

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

/**
 * Returns the popup prototype display value for the specified combo box.
 * This value is used to compute the width of the combo popup.
 * 
 * @param combo
 *            Combo box.
 * @return The popup prototype display value for the specified combo box.
 * @see SubstanceLookAndFeel#COMBO_POPUP_PROTOTYPE
 */
public static Object getComboPopupPrototypeDisplayValue(JComboBox combo) {
  Object objProp = combo
      .getClientProperty(SubstanceLookAndFeel.COMBO_POPUP_PROTOTYPE);
  if (objProp == null)
    objProp = UIManager.get(SubstanceLookAndFeel.COMBO_POPUP_PROTOTYPE);
  if (objProp == null)
    return null;
  if (objProp instanceof ComboPopupPrototypeCallback) {
    ComboPopupPrototypeCallback callback = (ComboPopupPrototypeCallback) objProp;
    return callback.getPopupPrototypeDisplayValue(combo);
  }
  // check if this object is in the model ???
  return objProp;
}

代码示例来源:origin: com.github.insubstantial/substance

/**
 * Returns the popup prototype display value for the specified combo box.
 * This value is used to compute the width of the combo popup.
 * 
 * @param combo
 *            Combo box.
 * @return The popup prototype display value for the specified combo box.
 * @see SubstanceLookAndFeel#COMBO_POPUP_PROTOTYPE
 */
public static Object getComboPopupPrototypeDisplayValue(JComboBox combo) {
  Object objProp = combo
      .getClientProperty(SubstanceLookAndFeel.COMBO_POPUP_PROTOTYPE);
  if (objProp == null)
    objProp = UIManager.get(SubstanceLookAndFeel.COMBO_POPUP_PROTOTYPE);
  if (objProp == null)
    return null;
  if (objProp instanceof ComboPopupPrototypeCallback) {
    ComboPopupPrototypeCallback callback = (ComboPopupPrototypeCallback) objProp;
    return callback.getPopupPrototypeDisplayValue(combo);
  }
  // check if this object is in the model ???
  return objProp;
}

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

/**
 * Initialize the column control button's gui
 */
private void init() {
  setFocusPainted(false);
  setFocusable(false);
  // this is a trick to get hold of the client prop which
  // prevents closing of the popup
  JComboBox box = new JComboBox();
  Object preventHide = box.getClientProperty("doNotCancelPopup");
  putClientProperty("doNotCancelPopup", preventHide);
}

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

/**
 * Initialize the column control button's gui
 */
private void init() {
  setFocusPainted(false);
  setFocusable(false);
  // this is a trick to get hold of the client prop which
  // prevents closing of the popup
  JComboBox box = new JComboBox();
  Object preventHide = box.getClientProperty("doNotCancelPopup");
  putClientProperty("doNotCancelPopup", preventHide);
  additionalActionsVisible = true;
}

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

/**
 * Initialize the column control button's gui
 */
private void init() {
  setFocusPainted(false);
  setFocusable(false);
  // this is a trick to get hold of the client prop which
  // prevents closing of the popup
  JComboBox box = new JComboBox();
  Object preventHide = box.getClientProperty("doNotCancelPopup");
  putClientProperty("doNotCancelPopup", preventHide);
  additionalActionsVisible = true;
}

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

/**
 * Initialize the column control button's gui
 */
private void init() {
  setFocusPainted(false);
  setFocusable(false);
  // this is a trick to get hold of the client prop which
  // prevents closing of the popup
  JComboBox box = new JComboBox();
  Object preventHide = box.getClientProperty("doNotCancelPopup");
  putClientProperty("doNotCancelPopup", preventHide);
  additionalActionsVisible = true;
}

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

/**
 * Initialize the column control button's gui
 */
private void init() {
  setFocusPainted(false);
  setFocusable(false);
  // this is a trick to get hold of the client prop which
  // prevents closing of the popup
  JComboBox box = new JComboBox();
  Object preventHide = box.getClientProperty("doNotCancelPopup");
  putClientProperty("doNotCancelPopup", preventHide);
  additionalActionsVisible = true;
}

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

/**
 * Creates cell editor for a table with combo as editor component. Type of this editor
 * depends on auto-completion behavior of JComboBox
 * 
 * @param combo JComboBox to be used as editor component
 */
public TableCellEditor createCellEditor(JComboBox<?> combo) {
  combo.setBorder(BorderFactory.createEmptyBorder(0,5,0,0));
  if (Boolean.TRUE.equals(combo.getClientProperty(AutoCompletion.AUTOCOMPLETION_PROPERTY))) {
    return new ComboBoxCellEditor(combo);
  }
  DefaultCellEditor editor = new DefaultCellEditor(combo);
  editor.setClickCountToStart(1);
  return editor;
}

代码示例来源:origin: jawi/ols

/**
 * Creates a new {@link JPopdownButton} instance.
 * 
 * @param aDefaultIcon
 *          the default icon of this popdown button;
 * @param aPressedAndSelectedIcon
 *          the pressed and selected icon of this popdown button.
 */
public JPopdownButton( final Icon aDefaultIcon, final Icon aPressedAndSelectedIcon )
{
 // setup the default button state.
 setIcon( aDefaultIcon );
 setPressedIcon( aPressedAndSelectedIcon );
 setSelectedIcon( aPressedAndSelectedIcon );
 setFocusable( false );
 putClientProperty( "JButton.buttonType", "textured" );
 // install a mouse listener on the button to hide and show the popup
 // menu as appropriate.
 addMouseListener( createButtonMouseListener() );
 // add a popup menu listener to update the button's selection state
 // when the menu is being dismissed.
 this.popupMenu.addPopupMenuListener( createPopupMenuListener() );
 // install a special client property on the button to prevent it from
 // closing of the popup when the down arrow is pressed.
 final JComboBox box = new JComboBox();
 final Object preventHide = box.getClientProperty( "doNotCancelPopup" );
 putClientProperty( "doNotCancelPopup", preventHide );
}

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

Object preventHide = box.getClientProperty("doNotCancelPopup");
datePicker.getEditor().putClientProperty("doNotCancelPopup", preventHide);

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

protected void installComponents() {
  
  JFormattedTextField editor = datePicker.getEditor();
  if (SwingXUtilities.isUIInstallable(editor)) {
    DateFormat[] formats = getCustomFormats(editor);
    // we are not yet listening ...
    datePicker.setEditor(createEditor());
    if (formats != null) {
      datePicker.setFormats(formats);
    }
  }
  updateFromEditorChanged(null, false);
  
  popupButton = createPopupButton();
  if (popupButton != null) {
    // this is a trick to get hold of the client prop which
    // prevents closing of the popup
    JComboBox box = new JComboBox();
    Object preventHide = box.getClientProperty("doNotCancelPopup");
    popupButton.putClientProperty("doNotCancelPopup", preventHide);
    datePicker.add(popupButton);
    popupButton.setEnabled(datePicker.isEnabled());
    popupButton.setInheritsPopupMenu(true);
  }
    updateChildLocale(datePicker.getLocale());
  
}

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

protected void installComponents() {
  
  JFormattedTextField editor = datePicker.getEditor();
  if (SwingXUtilities.isUIInstallable(editor)) {
    DateFormat[] formats = getCustomFormats(editor);
    // we are not yet listening ...
    datePicker.setEditor(createEditor());
    if (formats != null) {
      datePicker.setFormats(formats);
    }
  }
  updateFromEditorChanged(null, false);
  
  popupButton = createPopupButton();
  if (popupButton != null) {
    // this is a trick to get hold of the client prop which
    // prevents closing of the popup
    JComboBox box = new JComboBox();
    Object preventHide = box.getClientProperty("doNotCancelPopup");
    popupButton.putClientProperty("doNotCancelPopup", preventHide);
    datePicker.add(popupButton);
    popupButton.setEnabled(datePicker.isEnabled());
    popupButton.setInheritsPopupMenu(true);
  }
    updateChildLocale(datePicker.getLocale());
  
}

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

protected void installComponents() {
  
  JFormattedTextField editor = datePicker.getEditor();
  if (SwingXUtilities.isUIInstallable(editor)) {
    DateFormat[] formats = getCustomFormats(editor);
    // we are not yet listening ...
    datePicker.setEditor(createEditor());
    if (formats != null) {
      datePicker.setFormats(formats);
    }
  }
  updateFromEditorChanged(null, false);
  
  popupButton = createPopupButton();
  if (popupButton != null) {
    // this is a trick to get hold of the client prop which
    // prevents closing of the popup
    JComboBox box = new JComboBox();
    Object preventHide = box.getClientProperty("doNotCancelPopup");
    popupButton.putClientProperty("doNotCancelPopup", preventHide);
    datePicker.add(popupButton);
    popupButton.setEnabled(datePicker.isEnabled());
    popupButton.setInheritsPopupMenu(true);
  }
    updateChildLocale(datePicker.getLocale());
  
}

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

protected void installComponents() {
  
  JFormattedTextField editor = datePicker.getEditor();
  if (SwingXUtilities.isUIInstallable(editor)) {
    DateFormat[] formats = getCustomFormats(editor);
    // we are not yet listening ...
    datePicker.setEditor(createEditor());
    if (formats != null) {
      datePicker.setFormats(formats);
    }
  }
  updateFromEditorChanged(null, false);
  
  popupButton = createPopupButton();
  if (popupButton != null) {
    // this is a trick to get hold of the client prop which
    // prevents closing of the popup
    JComboBox box = new JComboBox();
    Object preventHide = box.getClientProperty("doNotCancelPopup");
    popupButton.putClientProperty("doNotCancelPopup", preventHide);
    datePicker.add(popupButton);
    popupButton.setEnabled(datePicker.isEnabled());
    popupButton.setInheritsPopupMenu(true);
  }
    updateChildLocale(datePicker.getLocale());
  
}

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

protected void installComponents() {
  
  JFormattedTextField editor = datePicker.getEditor();
  if (SwingXUtilities.isUIInstallable(editor)) {
    DateFormat[] formats = getCustomFormats(editor);
    // we are not yet listening ...
    datePicker.setEditor(createEditor());
    if (formats != null) {
      datePicker.setFormats(formats);
    }
  }
  updateFromEditorChanged(null, false);
  
  popupButton = createPopupButton();
  if (popupButton != null) {
    // this is a trick to get hold of the client prop which
    // prevents closing of the popup
    JComboBox box = new JComboBox();
    Object preventHide = box.getClientProperty("doNotCancelPopup");
    popupButton.putClientProperty("doNotCancelPopup", preventHide);
    datePicker.add(popupButton);
  }
    updateChildLocale(datePicker.getLocale());
  
}

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

Object preventHide = box.getClientProperty("doNotCancelPopup");
datePicker.getEditor().putClientProperty("doNotCancelPopup", preventHide);
datePicker.getEditor().setInheritsPopupMenu(true);

相关文章

JComboBox类方法