当前位置: 首页>>代码示例>>Java>>正文


Java DefaultComboBoxModel.getIndexOf方法代码示例

本文整理汇总了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();        
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:Repository.java

示例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);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:TemplateChooserPanelGUI.java

示例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();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:31,代码来源:Repository.java

示例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);
	}
}
 
开发者ID:kevingilboy,项目名称:COE1186,代码行数:34,代码来源:SimulatorGui.java


注:本文中的javax.swing.DefaultComboBoxModel.getIndexOf方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。