本文整理匯總了Java中javax.swing.JComboBox.setPopupVisible方法的典型用法代碼示例。如果您正苦於以下問題:Java JComboBox.setPopupVisible方法的具體用法?Java JComboBox.setPopupVisible怎麽用?Java JComboBox.setPopupVisible使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.JComboBox
的用法示例。
在下文中一共展示了JComboBox.setPopupVisible方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: performBrowseType
import javax.swing.JComboBox; //導入方法依賴的package包/類
private static void performBrowseType(final JComboBox combo, final ClasspathInfo cpInfo) {
final ReturnTypeComboBoxModel model = (ReturnTypeComboBoxModel) combo.getModel();
combo.setPopupVisible(false);
SwingUtilities.invokeLater(new Runnable() {
public void run() {
final ElementHandle<TypeElement> handle = TypeElementFinder.find(cpInfo, new TypeElementFinder.Customizer() {
public Set<ElementHandle<TypeElement>> query(ClasspathInfo classpathInfo, String textForQuery, NameKind nameKind, Set<SearchScope> searchScopes) {//GEN-LAST:event_browseButtonActionPerformed
return classpathInfo.getClassIndex().getDeclaredTypes(textForQuery, nameKind, searchScopes);
}
public boolean accept(ElementHandle<TypeElement> typeHandle) {
return true;
}
});
combo.setPopupVisible(false);
if (handle == null) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
setSelectedItem(combo, model.getPreviousItem());
}
});
} else {
setSelectedItem(combo, handle.getQualifiedName());
}
}
});
}
示例2: actionPerformed
import javax.swing.JComboBox; //導入方法依賴的package包/類
@Override
public void actionPerformed(ActionEvent e) {
final JComboBox comboBox = (JComboBox)e.getSource();
Object selectedItem = comboBox.getSelectedItem();
if (selectedItem == NEW_ITEM) {
performingNewItemAction = true;
try {
comboBox.setPopupVisible(false);
dataModel.newItemActionPerformed();
} finally {
performingNewItemAction = false;
}
setPreviousNonSpecialItem(comboBox);
// we (or maybe the client) have just selected an item inside an actionPerformed event,
// which will not send another actionPerformed event for the new item.
// We need to make sure all listeners get an event for the new item,
// thus...
final Object newSelectedItem = comboBox.getSelectedItem();
SwingUtilities.invokeLater(new Runnable() {
@Override
public void run() {
comboBox.setSelectedItem(newSelectedItem);
}
});
}
}
示例3: actionPerformed
import javax.swing.JComboBox; //導入方法依賴的package包/類
@Override
public void actionPerformed(ActionEvent e) {
if (e.getSource() instanceof JComboBox) {
JComboBox combo = (JComboBox) e.getSource();
combo.setPopupVisible(!combo.isPopupVisible());
}
}
示例4: actionPerformed
import javax.swing.JComboBox; //導入方法依賴的package包/類
public void actionPerformed(ActionEvent e) {
if( e.getSource() instanceof JComboBox ) {
JComboBox combo = (JComboBox)e.getSource();
combo.setPopupVisible( !combo.isPopupVisible() );
}
}