本文整理汇总了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;
}
示例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;
}
}
示例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;
}
}
示例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;
}
示例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;
}
示例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
}
示例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() : "");
}
示例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;
}
示例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);
}
示例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);
}
示例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);
}
}
}
示例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;
}
示例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;
}
}
}
示例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;
}
示例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);
}