本文整理汇总了Java中javax.swing.DefaultComboBoxModel.getIndexOf方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultComboBoxModel.getIndexOf方法的具体用法?Java DefaultComboBoxModel.getIndexOf怎么用?Java DefaultComboBoxModel.getIndexOf使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.DefaultComboBoxModel
的用法示例。
在下文中一共展示了DefaultComboBoxModel.getIndexOf方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getSelectedRCIntern
import javax.swing.DefaultComboBoxModel; //导入方法依赖的package包/类
RepositoryConnection getSelectedRCIntern() {
String urlString;
try {
urlString = getUrlString();
}
catch (InterruptedException ex) {
// should not happen
Subversion.LOG.log(Level.SEVERE, null, ex);
return null;
}
DefaultComboBoxModel dcbm = (DefaultComboBoxModel) repositoryPanel.urlComboBox.getModel();
int idx = dcbm.getIndexOf(urlString);
if(idx > -1) {
return (RepositoryConnection) dcbm.getElementAt(idx);
}
return getEditedRC();
}
示例2: selectProject
import javax.swing.DefaultComboBoxModel; //导入方法依赖的package包/类
private void selectProject (@NullAllowed Project p) {
if (p != null) {
DefaultComboBoxModel projectsModel = (DefaultComboBoxModel) projectsComboBox.getModel ();
if ( projectsModel.getIndexOf( p ) == -1 ) {
projectsModel.insertElementAt( p, 0 );
}
projectsComboBox.setSelectedItem( p );
}
else {
projectsComboBox.setSelectedItem(null);
}
}
示例3: onSelectedRepositoryChange
import javax.swing.DefaultComboBoxModel; //导入方法依赖的package包/类
/**
* Always updates UI fields visibility.
*/
private void onSelectedRepositoryChange() {
setValid(true, ""); // NOI18N
String urlString = ""; // NOI18N
try {
urlString = getUrlString();
} catch (InterruptedException ex) {
return; // should not happen
}
if(urlString != null) {
RepositoryConnection editedrc = getEditedRC();
editedrc.setUrl(urlString);
DefaultComboBoxModel dcbm = (DefaultComboBoxModel) repositoryPanel.urlComboBox.getModel();
int idx = dcbm.getIndexOf(editedrc);
if(idx > -1) {
//dcbm.setSelectedItem(urlString);
currentPanel.refresh((RepositoryConnection)dcbm.getElementAt(idx));
}
currentPanel.onSelectedRepositoryChange(urlString);
currentPanel.fillRC(editedrc);
}
message = ""; // NOI18N
updateVisibility();
}
示例4: repaint
import javax.swing.DefaultComboBoxModel; //导入方法依赖的package包/类
protected void repaint() {
DefaultComboBoxModel<String> currentTrainModelTrains = (DefaultComboBoxModel<String>)cbTrainModelTrains.getModel();
DefaultComboBoxModel<String> currentTrainControllerTrains = (DefaultComboBoxModel<String>)cbTrainControllerTrains.getModel();
DefaultComboBoxModel<String> newTrainModelTrains = new DefaultComboBoxModel<String>();
DefaultComboBoxModel<String> newTrainControllerTrains = new DefaultComboBoxModel<String>();
boolean trainModelChanged = false;
boolean trainControllerChanged = false;
newTrainModelTrains.addElement("<html><i>Select a Train</i></html>");
newTrainControllerTrains.addElement("<html><i>Select a Train</i></html>");
for(String key : simulator.ctc.trains.keySet()) {
newTrainModelTrains.addElement(key);
if(currentTrainModelTrains.getIndexOf(key)==-1) {
trainModelChanged = true;
}
newTrainControllerTrains.addElement(key);
if(currentTrainControllerTrains.getIndexOf(key)==-1){
trainControllerChanged = true;
}
}
if(trainModelChanged) {
cbTrainModelTrains.setModel(newTrainModelTrains);
}
if(trainControllerChanged){
cbTrainControllerTrains.setModel(newTrainControllerTrains);
}
}