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


Java TableModel.getRowCount方法代码示例

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


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

示例1: removeAbbreviation

import javax.swing.table.TableModel; //导入方法依赖的package包/类
public boolean removeAbbreviation(String abbreviation) {
    int row = getTemplateTable().findCellRow(abbreviation,
            new Operator.DefaultStringComparator(true, true));        
    if (row == (-1)) {
        System.out.println("Didn't find "+abbreviation);
        TableModel model = getTemplateTable().getModel();
        int rowCount = model.getRowCount();
        for (int cntr = 0; cntr < rowCount; cntr++) {
            System.out.print(model.getValueAt(cntr, 0)+" ");
        }
        System.out.println("");
        return false;
    }
    getTemplateTable().selectCell(row, 0);                
    getRemoveButton().push();        
    return true;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:Abbreviations.java

示例2: saveProperties

import javax.swing.table.TableModel; //导入方法依赖的package包/类
private boolean saveProperties() {
	final Map<String, Object> properties = new HashMap<String, Object>();
	final TableModel model = table.getModel();
	if (model.getColumnCount() == 2) {
		for (int i = 0; i < model.getRowCount(); i++) {
			final String key = (String) model.getValueAt(i, 0);
			final Object value = model.getValueAt(i, 1);
			if (properties.containsKey(key)) {
				return false;
			} else {
				properties.put(key, value);
			}
		}
		sourceFile.setProperties(properties);
		return true;
	} else {
		return false;
	}
}
 
开发者ID:roscisz,项目名称:KernelHive,代码行数:20,代码来源:SourceFilePropertiesDialog.java

示例3: saveProperties

import javax.swing.table.TableModel; //导入方法依赖的package包/类
private boolean saveProperties() {
	final Map<String, Object> properties = new HashMap<String, Object>();
	final TableModel model = table.getModel();
	if (model.getColumnCount() == 2) {
		for (int i = 0; i < model.getRowCount(); i++) {
			final String key = (String) model.getValueAt(i, 0);
			final Object value = model.getValueAt(i, 1);
			if (properties.containsKey(key)) {
				return false;
			} else {
				properties.put(key, value);
			}
		}
		node.getGraphNode().setProperties(properties);
		return true;
	} else {
		return false;
	}
}
 
开发者ID:roscisz,项目名称:KernelHive,代码行数:20,代码来源:NodePropertiesDialog.java

示例4: retrievedParcelOperations

import javax.swing.table.TableModel; //导入方法依赖的package包/类
public List<ParcelOperationDAO> retrievedParcelOperations(){
    hasBeenEdited = false;
    List<ParcelOperationDAO> ops = new LinkedList<>();
    TableModel model = table.getModel();
    if (model.getRowCount() != parcelOperations.size()) {
        hasBeenEdited = true;
    }
    for (int i = 0; i < model.getRowCount(); i++){
        String parcelOperation = (String) model.getValueAt(i, 0);
        Object parcelValue = model.getValueAt(i, 1);
        String originalOperation = parcelOperations.get(i).parcelType;
        Object originalValue = parcelOperations.get(i).value;
        if (parcelValue == null && originalValue == null) {
            ops.add(parcelOperations.get(i));
        } else if (parcelValue == null || originalValue == null) {
            hasBeenEdited = true;
            ops.add(new ParcelOperationDAO(parcelOperation, parcelValue));
        } else if (!originalOperation.equals(parcelOperation) || !originalValue.equals(parcelValue)) {
            hasBeenEdited = true;
            ops.add(new ParcelOperationDAO(parcelOperation, parcelValue));
        } else {
            ops.add(parcelOperations.get(i));
        }
    }
    return ops;
}
 
开发者ID:mateuszk87,项目名称:BadIntent,代码行数:27,代码来源:ParcelPanel.java

示例5: getResources

import javax.swing.table.TableModel; //导入方法依赖的package包/类
Map<String,String> getResources() {
    final TableModel model = this.tableCallbacks.getModel();
    final Map<String,String> result = new TreeMap<String,String>();
    for (int i = 0; i < model.getRowCount(); i++) {
        if (model.getValueAt(i, 0) != null && !((String)model.getValueAt(i, 0)).isEmpty()) {
            result.put((String)model.getValueAt(i, 0), (String)model.getValueAt(i, 1));
        }
    }
    return result;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:JFXJavaScriptCallbacksPanel.java

示例6: writeData

import javax.swing.table.TableModel; //导入方法依赖的package包/类
protected void writeData(TableModel model, String title, Writer writer,
                         TracerProgressObject progress) throws IOException {
    int columnsCount = model.getColumnCount();
    int rowsCount = model.getRowCount();

    writeLine(writer, "  <table border=\"1\" summary=\"" + title + "\">"); // NOI18N

    writeLine(writer, "    <thead>"); // NOI18N
    writeLine(writer, "      <tr>"); // NOI18N
    for (int c = 0; c < columnsCount; c++)
        writeLine(writer, "        <td>" + model.getColumnName(c) + "</td>"); // NOI18N
    writeLine(writer, "      </tr>"); // NOI18N
    writeLine(writer, "    </thead>"); // NOI18N

    writeLine(writer, "    <tbody>"); // NOI18N
    for (int r = 0; r < rowsCount; r++) {
        writeLine(writer, "      <tr>"); // NOI18N
        for (int c = 0; c < columnsCount; c++)
            writeLine(writer, "        <td>" + model.getValueAt(r, c) + "</td>"); // NOI18N
        writeLine(writer, "      </tr>"); // NOI18N
        
        if (progress.isFinished()) break;

        if (step == 1) {
            progress.addStep();
        } else {
            int currentStep = (int)(r * step);
            if (currentStep > lastStep) {
                progress.addStep();
                lastStep = currentStep;
            }
        }
    }
    writeLine(writer, "    </tbody>"); // NOI18N

    writeLine(writer, "  </table>"); // NOI18N
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:38,代码来源:HTMLExporter.java

示例7: store

import javax.swing.table.TableModel; //导入方法依赖的package包/类
public void store(VariablesFormatter f) {
    f.setName(nameTextField.getText());
    f.setClassTypes(classTypesTextField.getText());
    f.setIncludeSubTypes(subtypesCheckBox.isSelected());
    f.setValueFormatCode(valueFormatCheckBox.isSelected() ? valueEditorPane.getText() : "");
    f.setChildrenFormatCode(childrenCodeEditorPane.getText());
    TableModel tableModel = childrenVariablesTable.getModel();
    f.getChildrenVariables().clear();
    for (int i = 0; i < tableModel.getRowCount(); i++) {
        f.addChildrenVariable((String) tableModel.getValueAt(i, 0), (String) tableModel.getValueAt(i, 1));
    }
    f.setUseChildrenVariables(childrenVariablesRadioButton.isSelected());
    f.setChildrenExpandTestCode(testChildrenCheckBox.isSelected() ? testChildrenEditorPane.getText() : "");
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:VariableFormatterEditPanel.java

示例8: getSteps

import javax.swing.table.TableModel; //导入方法依赖的package包/类
protected int getSteps(TableModel model) {
    int steps = model.getRowCount();
    if (steps > MAX_STEPS) {
        step = MAX_STEPS / (float)steps;
        steps = MAX_STEPS;
    }
    return steps;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:HTMLExporter.java

示例9: getShortDescription

import javax.swing.table.TableModel; //导入方法依赖的package包/类
public String getShortDescription (String defaultValue) {
    TableModel model = getModel();
    if (model.getRowCount() <= 0) {
        return null;
    }
    if (getModelIndex () == 0) {
        // 1st column
        if (nodesColumnDescription != null) {
            return nodesColumnDescription;
        }
        return defaultValue;
    }
    return rowModel.getShortDescription (getModelIndex () - 1);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:OutlineView.java

示例10: getRawColumnName

import javax.swing.table.TableModel; //导入方法依赖的package包/类
public String getRawColumnName () {
    TableModel model = getModel();
    if (model.getRowCount() <= 0) {
        return null;
    }
    if (getModelIndex () == 0) {
        return null;
    }
    return rowModel.getRawColumnName (getModelIndex () - 1);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:OutlineView.java

示例11: postReadSettings

import javax.swing.table.TableModel; //导入方法依赖的package包/类
void postReadSettings(Properties p, int index, String propertyPrefix) {
    TableModel model = getModel();
    if (model.getRowCount() > 0 && getModelIndex () > 0) {
        String myPrefix = propertyPrefix + PROP_PREFIX + Integer.toString(index) + "-";
        String shortDescription = p.getProperty(myPrefix + PROP_SHORT_DESCRIPTION, null);
        if (shortDescription != null) {
            rowModel.setShortDescription(getModelIndex () - 1, shortDescription);
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:OutlineView.java

示例12: getIndexByName

import javax.swing.table.TableModel; //导入方法依赖的package包/类
private static int getIndexByName(TableModel model, String projectName) {
    int length = model.getRowCount();
    String name;
    for(int i =0; i< length; i++) {
        name = (String)model.getValueAt(i, 1);
        if(name.startsWith(projectName)) return i;
    }
    return 0;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:ProjectImporterTestCase.java

示例13: restoreSelection

import javax.swing.table.TableModel; //导入方法依赖的package包/类
private void restoreSelection(String id, int colIndex) {
    if (id == null) {
        clearSelection();
        return;
    }
    TableModel tm = getModel();
    for (int i = 0; i < tm.getRowCount(); i++) {
        ActionHolder ah = (ActionHolder)tm.getValueAt(i, 0);
        if (ah != null && id.equals(ah.getAction().getId())) {
            changeSelection(i, colIndex, false, false);
            break;
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:KeymapPanel.java

示例14: getResources

import javax.swing.table.TableModel; //导入方法依赖的package包/类
List<File> getResources() {
    final TableModel model = this.resources.getModel();
    final List<File> result = new LinkedList<File>();
    for (int i=0; i< model.getRowCount(); i++) {
        if ((Boolean)model.getValueAt(i, 1)) {
            result.add((File)model.getValueAt(i, 0));
        }
    }
    return result;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:ResourcesCustomizer.java

示例15: validateRowCol

import javax.swing.table.TableModel; //导入方法依赖的package包/类
private void validateRowCol() {
    JTable table = (JTable) parent.getComponent();
    try {
        int row = table.convertRowIndexToModel(viewRow);
        int col = table.convertColumnIndexToModel(viewCol);
        TableModel model = table.getModel();
        if (row >= 0 && row < model.getRowCount() && col >= 0 && col < model.getColumnCount()) {
            return;
        }
    } catch (IndexOutOfBoundsException e) {
    }
    throw new NoSuchElementException("Invalid row/col for JTable: (" + viewRow + ", " + viewCol + ")", null);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:14,代码来源:JTableCellJavaElement.java


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