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


Java DefaultTableModel.getRowCount方法代码示例

本文整理汇总了Java中javax.swing.table.DefaultTableModel.getRowCount方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultTableModel.getRowCount方法的具体用法?Java DefaultTableModel.getRowCount怎么用?Java DefaultTableModel.getRowCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.table.DefaultTableModel的用法示例。


在下文中一共展示了DefaultTableModel.getRowCount方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fireChanged

import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
private void fireChanged() {
    DefaultTableModel model = (DefaultTableModel) table.getModel();
    ArrayList<String> patterns = new ArrayList<String>(model.getRowCount());
    for (int i = 0; i < model.getRowCount(); i++) {
        Object value = model.getValueAt(i, 0);
        if (value == null) {
            continue;
        }
        String pattern = value.toString();
        //remove empty patterns
        if (!pattern.trim().isEmpty() && !pattern.trim().equals(getDummyPattern())) {
            patterns.add(pattern);
        }
    }
    changed = !id2comments.isEmpty()
            || Settings.getDefault().isScanCommentsOnly() != checkScanCommentsOnly.isSelected()
            || Settings.getDefault().getPatterns().size() != patterns.size()
            || !Settings.getDefault().getPatterns().containsAll(patterns)
            || Settings.getDefault().getExtensionIdentifiers().size() != extensionIdentifiers.size()
            || !Settings.getDefault().getExtensionIdentifiers().containsAll(extensionIdentifiers)
            || Settings.getDefault().getMimeIdentifiers().size() != mimeIdentifiers.size()
            || !Settings.getDefault().getMimeIdentifiers().containsAll(mimeIdentifiers);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:ToDoCustomizer.java

示例2: btnRemoveActionPerformed

import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
private void btnRemoveActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnRemoveActionPerformed
    TableCellEditor editor = table.getCellEditor();
    if( null != editor )
        editor.cancelCellEditing();
    
    boolean wasValid = isDataValid();
    
    int selRow = table.getSelectedRow();
    if( selRow < 0 )
        return;
    DefaultTableModel model = (DefaultTableModel)table.getModel();
    model.removeRow( selRow );
    if( selRow > model.getRowCount()-1 )
        selRow--;
    if( selRow >= 0 )
        table.getSelectionModel().setSelectionInterval( selRow, selRow );
    
    boolean wasChanged = changed;
    fireChanged();
    firePropertyChange( OptionsPanelController.PROP_CHANGED, new Boolean(wasChanged), Boolean.TRUE);
    
    firePropertyChange( OptionsPanelController.PROP_VALID, new Boolean(wasValid), new Boolean(isDataValid()));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:ToDoCustomizer.java

示例3: renameDomainInComponents

import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
/**
 * Rename domain in components.
 *
 * @param oldDomainName the old domain name
 * @param newDomainName the new domain name
 */
public void renameDomainInComponents(String oldDomainName, String newDomainName) {
	
	DefaultTableModel dtmComponents = this.getTableModel4ComponentTypes();
	int column = getColumnHeaderIndexComponents(COL_Domain);
	
	// --- Get the component type definitions from table ----
	JTable jtComponents = this.getJTable4ComponentTypes();
	// --- Confirm, apply changes in table ------------------						
	TableCellEditor tceComponents = jtComponents.getCellEditor();
	if (tceComponents!=null) {
		tceComponents.stopCellEditing();
	}
	for(int row=0; row<dtmComponents.getRowCount(); row++){
		String currValue = (String) dtmComponents.getValueAt(row, column);
		if (currValue.equals(oldDomainName)) {
			dtmComponents.setValueAt(newDomainName, row, column);	
		}
	}
	this.setTableCellEditor4DomainsInComponents(null);
}
 
开发者ID:EnFlexIT,项目名称:AgentWorkbench,代码行数:27,代码来源:ComponentTypeDialog.java

示例4: convertTableModelToStringValue

import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
private String convertTableModelToStringValue(DefaultTableModel tableModel) {
    StringBuilder stringBuilder = new StringBuilder();
    int rowCount = tableModel.getRowCount();
    for (int i = 0; i < rowCount; i++) {
        String option = (String) tableModel.getValueAt(i, 0);
        try {
            Double min = Double.parseDouble((String) tableModel.getValueAt(i, 1));
            Double max = Double.parseDouble((String) tableModel.getValueAt(i, 2));
            String colorValue = (String) tableModel.getValueAt(i, 3);
            stringBuilder.append(option + "=" + min + ".." + max + "->" + colorValue + ",");
        } catch (Throwable skip) {
            stringBuilder.append(option + "=" + 0 + ".." + 0 + "->" + "#FFFFFFFF" + ",");
        }
    }
    return stringBuilder.toString();
}
 
开发者ID:dmitrykolesnikovich,项目名称:featurea,代码行数:17,代码来源:EditIntervalsColorScript.java

示例5: isModified

import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
/**
 * 是否已修改
 *
 * @return
 */
@Override
public boolean isModified() {
    Variables variables = settingManager.getVariables();
    DefaultTableModel tableModel = (DefaultTableModel) varTable.getModel();
    if (variables.getParams().size() != tableModel.getRowCount()) {
        return true;
    }
    Map<String, String> params = variables.getParams();
    for (int i = 0; i < tableModel.getRowCount(); i++) {
        String key = tableModel.getValueAt(i, 0).toString();
        String value = tableModel.getValueAt(i, 1).toString();
        if (!params.containsKey(key)) {
            return true;
        } else if (params.containsKey(key) && !params.get(key).equals(value)) {
            return true;
        }
    }
    if (!Objects.equals(ignoreText.getText().trim(), variables.getIgnoreFields())) {
        return true;
    }
    return false;
}
 
开发者ID:hykes,项目名称:CodeGen,代码行数:28,代码来源:VariableUI.java

示例6: filtersCheckAllButtonActionPerformed

import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
private void filtersCheckAllButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_filtersCheckAllButtonActionPerformed
    DefaultTableModel model = (DefaultTableModel) filterClassesTable.getModel();
    for (int i = 0; i < model.getRowCount(); i++) {
        model.setValueAt(Boolean.TRUE, i, 0);
    }
    filterClassesTable.repaint();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:CategoryPanelStepFilters.java

示例7: saveCommonSettings

import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
private void saveCommonSettings() {
    if (driverPropTable.isEditing()) {
        driverPropTable.getCellEditor().stopCellEditing();
    }
    DefaultTableModel model = (DefaultTableModel) driverPropTable.getModel();
    settings.getDriverSettings().clear();
    for (int i = 0; i < model.getRowCount(); i++) {
        String prop = Objects.toString(model.getValueAt(i, 0), "").trim();
        if (!prop.isEmpty()) {
            String value = Objects.toString(model.getValueAt(i, 1), "");
            settings.getDriverSettings().setProperty(prop, value);
        }
    }
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:15,代码来源:DriverSettings.java

示例8: moveDownVarButtonActionPerformed

import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
private void moveDownVarButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_moveDownVarButtonActionPerformed
    int index = childrenVariablesTable.getSelectedRow();
    if (index < 0) return ;
    DefaultTableModel model = (DefaultTableModel) childrenVariablesTable.getModel();
    if (index >= (model.getRowCount() - 1)) return ;
    Object[] row = new Object[] { model.getValueAt(index, 0), model.getValueAt(index, 1) };
    model.removeRow(index);
    model.insertRow(index + 1, row);
    childrenVariablesTable.getSelectionModel().setSelectionInterval(index + 1, index + 1);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:VariableFormatterEditPanel.java

示例9: writeTemplateData

import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
/**
 * 保持模板数据
 *
 * @param msgName 消息名称
 * @throws IOException
 */
public void writeTemplateData(String msgName) throws IOException {
    File dir = new File("data/template_data/");
    File file = new File("data/template_data/" + msgName + ".csv");
    if (!file.exists()) {
        dir.mkdirs();
        file.createNewFile();
    }

    CSVWriter writer = new CSVWriter(new FileWriter(file));

    List<String[]> records = new ArrayList<String[]>();

    // 如果table为空,则初始化
    if (MainWindow.mainWindow.getTemplateMsgDataTable().getModel().getRowCount() == 0) {
        Init.initTemplateDataTable();
    }

    // 逐行读取
    DefaultTableModel tableModel = (DefaultTableModel) MainWindow.mainWindow.getTemplateMsgDataTable()
            .getModel();
    int rowCount = tableModel.getRowCount();
    String[] arryData;
    for (int i = 0; i < rowCount; i++) {
        arryData = new String[3];
        arryData[0] = (String) tableModel.getValueAt(i, 0);
        arryData[1] = (String) tableModel.getValueAt(i, 1);
        arryData[2] = ((String) tableModel.getValueAt(i, 2)).trim();
        records.add(arryData);
    }

    // 写入文件
    writer.writeAll(records);
    writer.close();
}
 
开发者ID:rememberber,项目名称:WePush,代码行数:41,代码来源:MsgHisManage.java

示例10: fillTimeTable

import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
private void fillTimeTable() {
    Reference ref = (Reference)jList1.getSelectedValue();
    Object fo = ref == null ? null : ref.get();
    
    // clear the table
    DefaultTableModel model = (DefaultTableModel) times.getModel();
    while (model.getRowCount() > 0) {
        model.removeRow(0);
    }
    key2RowNumber.clear();
    
    if (fo == null) return;
    
    Collection<String> keys = TimesCollectorPeer.getDefault().getKeysForFile(fo);
    for (int i = 0; i < 10; i++) {
        try {
            synchronized(keys) {
                for (String key : keys) {
                    changeRow(fo, key);
                }
                return;
            }
        } catch (ConcurrentModificationException ex) {
            LOG.log(Level.INFO, "Retry " + i, ex);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:28,代码来源:TimeComponentPanel.java

示例11: limpiarTabla

import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
public void limpiarTabla(DefaultTableModel modelo) //recibe el modelo de la tabla
{
    int filas = modelo.getRowCount(); //para saber cuantas filas tiene la tabla hasta el momento
    for(int i=0;i<filas;i++)//colocamos "<" porque  sino borrara una fila inexistente
    {
        modelo.removeRow(0); //para que valla borrando borrando la PRIMERA linea(que en si es toda la tabla)
    }
}
 
开发者ID:JuanJoseFJ,项目名称:ProyectoPacientes,代码行数:9,代码来源:Cita.java

示例12: removeOptionButtonActionPerformed

import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
private void removeOptionButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_removeOptionButtonActionPerformed
    DefaultTableModel model = (DefaultTableModel) processorOptionsTable.getModel();
    int[] rows = processorOptionsTable.getSelectedRows();
    for(int i = rows.length - 1 ; i >= 0 ; i--) {
        model.removeRow(rows[i]);
    }
    if (model.getRowCount() > 0) {
        // Select reasonable row
        int selectedIndex = rows[rows.length - 1] - rows.length  + 1;
        if ( selectedIndex > model.getRowCount() - 1) {
            selectedIndex = model.getRowCount() - 1;
        }
        processorOptionsTable.setRowSelectionInterval(selectedIndex, selectedIndex);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:16,代码来源:CustomizerCompile.java

示例13: apply

import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
/**
 * 应用
 */
@Override
public void apply() {
    Map<String, String> params = new HashMap<>();
    DefaultTableModel tableModel = (DefaultTableModel) varTable.getModel();
    for (int i = 0; i < tableModel.getRowCount(); i++) {
        params.put(tableModel.getValueAt(i, 0).toString().trim(), tableModel.getValueAt(i, 1).toString().trim());
    }
    settingManager.getVariables().setParams(params);
    settingManager.getVariables().setIgnoreFields(ignoreText.getText().trim());
}
 
开发者ID:hykes,项目名称:CodeGen,代码行数:14,代码来源:VariableUI.java

示例14: checkTableExists

import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
private boolean checkTableExists(String number) {
    DefaultTableModel model = (DefaultTableModel) table1.getModel();
    List<String> numdata = new ArrayList<String>();
    for (int count = 0; count < model.getRowCount(); count++) {
        numdata.add(model.getValueAt(count, 0).toString());
    }
    return numdata.contains(number);
}
 
开发者ID:Advait-M,项目名称:AttendanceTracker,代码行数:9,代码来源:Interface.java

示例15: updateTable

import javax.swing.table.DefaultTableModel; //导入方法依赖的package包/类
private void updateTable(List list, final DefaultTableModel dftm) {
	int num = dftm.getRowCount();
	for (int i = 0; i < num; i++)
		dftm.removeRow(0);
	Iterator iterator = list.iterator();
	TbKhinfo khInfo;
	while (iterator.hasNext()) {
		List info = (List) iterator.next();
		Item item = new Item();
		item.setId((String) info.get(0));
		item.setName((String) info.get(1));
		khInfo = Dao.getKhInfo(item);
		Vector rowData = new Vector();
		rowData.add(khInfo.getId().trim());
		rowData.add(khInfo.getKhname().trim());
		rowData.add(khInfo.getAddress().trim());
		rowData.add(khInfo.getJian().trim());
		rowData.add(khInfo.getBianma().trim());
		rowData.add(khInfo.getTel().trim());
		rowData.add(khInfo.getFax().trim());
		rowData.add(khInfo.getLian().trim());
		rowData.add(khInfo.getLtel().trim());
		rowData.add(khInfo.getMail().trim());
		rowData.add(khInfo.getXinhang().trim());
		rowData.add(khInfo.getHao().trim());
		dftm.addRow(rowData);
	}
}
 
开发者ID:Edward7Zhang,项目名称:SuperMarketManageSystem,代码行数:29,代码来源:KeHuChaXun.java


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