本文整理匯總了Java中javax.swing.JComboBox.addPopupMenuListener方法的典型用法代碼示例。如果您正苦於以下問題:Java JComboBox.addPopupMenuListener方法的具體用法?Java JComboBox.addPopupMenuListener怎麽用?Java JComboBox.addPopupMenuListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.JComboBox
的用法示例。
在下文中一共展示了JComboBox.addPopupMenuListener方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: actionPerformed
import javax.swing.JComboBox; //導入方法依賴的package包/類
@Override
public void actionPerformed(ActionEvent ae) {
currentActiveItem = this;
JComboBox combo = (JComboBox) ae.getSource();
combo.setEditable(true);
combo.getEditor().getEditorComponent().addFocusListener(this);
combo.getEditor().getEditorComponent().addKeyListener(this);
combo.addPopupMenuListener(this);
combo.setSelectedItem(configName == null ? lastSelected + "1" : configName);
}
示例2: actionPerformed
import javax.swing.JComboBox; //導入方法依賴的package包/類
@Override
public void actionPerformed(ActionEvent ae) {
JComboBox combo = (JComboBox) ae.getSource();
combo.setEditable(true);
combo.getEditor().getEditorComponent().addFocusListener(this);
combo.getEditor().getEditorComponent().addKeyListener(this);
combo.addPopupMenuListener(this);
combo.setSelectedItem(configName == null ? lastSelected + "1" : configName);
}
示例3: DataComboBoxSupport
import javax.swing.JComboBox; //導入方法依賴的package包/類
/** Not private because used in tests. */
DataComboBoxSupport(JComboBox comboBox, DataComboBoxModel dataModel, boolean allowAdding) {
this.dataModel = dataModel;
this.allowAdding = allowAdding;
comboBox.setEditable(false);
comboBox.setModel(new ItemComboBoxModel());
comboBox.setRenderer(new ItemListCellRenderer());
comboBox.addActionListener(new ItemActionListener());
comboBox.addPopupMenuListener(new ItemPopupMenuListener());
}
示例4: subscribeActual
import javax.swing.JComboBox; //導入方法依賴的package包/類
@Override
protected void subscribeActual(Observer<? super PopupMenuEvent> observer) {
JComboBox<?> w = widget;
PopupMenuEventConsumer aec = new PopupMenuEventConsumer(observer, w);
observer.onSubscribe(aec);
w.addPopupMenuListener(aec);
if (aec.get() == null) {
aec.onDispose(w);
}
}
示例5: createSaveBox
import javax.swing.JComboBox; //導入方法依賴的package包/類
protected Component createSaveBox() {
save = new JComboBox(saveOptions);
save.addActionListener(this);
save.addItemListener(this);
save.addPopupMenuListener(this);
save.setActionCommand("save");
return save;
}
示例6: createSelectBox
import javax.swing.JComboBox; //導入方法依賴的package包/類
protected Component createSelectBox() {
box = new JComboBox();
box.addActionListener(this);
box.addItemListener(this);
box.addPopupMenuListener(this);
box.setActionCommand("select");
return box;
}