本文整理汇总了Java中javax.swing.JComboBox.hidePopup方法的典型用法代码示例。如果您正苦于以下问题:Java JComboBox.hidePopup方法的具体用法?Java JComboBox.hidePopup怎么用?Java JComboBox.hidePopup使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.JComboBox
的用法示例。
在下文中一共展示了JComboBox.hidePopup方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: actionPerformed
import javax.swing.JComboBox; //导入方法依赖的package包/类
@Override
public void actionPerformed(ActionEvent ae) {
if (ConfigurationsManager.getDefault().size() == 1) {
setSelectedItem(getElementAt(0));
return;
}
JComboBox combo = (JComboBox) ae.getSource();
combo.setSelectedItem(lastSelected);
combo.hidePopup();
if (JOptionPane.showConfirmDialog(combo,
Bundle.MSG_ReallyDeleteConfig(lastSelected),
Bundle.DeleteConfigTitle(),
JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION) {
ConfigurationsManager.getDefault().remove(lastSelected);
setSelectedItem(getElementAt(0));
}
}
示例2: isMemorySelectionError
import javax.swing.JComboBox; //导入方法依赖的package包/类
/**
* Checks if is memory selection error. The initial memory should
* always be larger than the maximum memory of the JVM.
* @return true, if is memory selection error
*/
private boolean isMemorySelectionError(JComboBox<String> combo) {
boolean error = false;
String initialMemory = (String) getJComboBoxJVMMemoryInitial().getSelectedItem();
String maximumMemory = (String) getJComboBoxJVMMemoryMaximum().getSelectedItem();
int initMem = Integer.parseInt(initialMemory.replaceAll("[a-zA-Z]", ""));
int maxiMem = Integer.parseInt(maximumMemory.replaceAll("[a-zA-Z]", ""));
if(initialMemory.contains("g")){
initMem = initMem*1024;
}
if(maximumMemory.contains("g")){
maxiMem = maxiMem*1024;
}
if (initMem>=maxiMem) {
combo.hidePopup();
String head = Language.translate("Initialer Arbeitsspeicher >= Maximaler Arbeitsspeicher !");
String msg = Language.translate("Der maximale Arbeitsspeicher muss größer als der initiale Arbeitsspeicher sein.");
JOptionPane.showMessageDialog(Application.getMainWindow(), msg, head, JOptionPane.ERROR_MESSAGE);
error = true;
}
return error;
}