當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。