當前位置: 首頁>>代碼示例>>Java>>正文


Java JComboBox.setPopupVisible方法代碼示例

本文整理匯總了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());
            }
        }
    });
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:30,代碼來源:ReturnTypeUIHelper.java

示例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);
            }
        });
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:29,代碼來源:DataComboBoxSupport.java

示例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());
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:8,代碼來源:ResolveDeclarationsPanel.java

示例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() );
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:7,代碼來源:FixDuplicateImportStmts.java


注:本文中的javax.swing.JComboBox.setPopupVisible方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。