本文整理匯總了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;
}