本文整理汇总了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;
}