本文整理汇总了Java中javax.swing.table.TableModel.getValueAt方法的典型用法代码示例。如果您正苦于以下问题:Java TableModel.getValueAt方法的具体用法?Java TableModel.getValueAt怎么用?Java TableModel.getValueAt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.swing.table.TableModel
的用法示例。
在下文中一共展示了TableModel.getValueAt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isChanged
import javax.swing.table.TableModel; //导入方法依赖的package包/类
@Override
public boolean isChanged() {
TableModel filterClassesModel = filterClassesTable.getModel();
Set<String> allFilters = new LinkedHashSet<String>();
Set<String> enabledFilters = new HashSet<String>();
for (int i = 0; i < filterClassesModel.getRowCount(); i++) {
boolean isEnabled = (Boolean) filterClassesModel.getValueAt(i, 0);
String clazz = (String) filterClassesModel.getValueAt(i, 1);
allFilters.add(clazz);
if (isEnabled) {
enabledFilters.add(clazz);
}
}
Set savedEnabledFilters = (Set) Properties.getDefault().getProperties("debugger").
getProperties("sources").getProperties("class_filters").getCollection("enabled", Collections.EMPTY_SET);
Set<String> savedAllFilters = (Set<String>) Properties.getDefault().getProperties("debugger").
getProperties("sources").getProperties("class_filters").getCollection("all", Collections.EMPTY_SET);
Properties p = Properties.getDefault().getProperties("debugger.options.JPDA");
return useStepFiltersCheckBox.isSelected() != p.getBoolean("UseStepFilters", true)
|| filterSyntheticCheckBox.isSelected() != p.getBoolean("FilterSyntheticMethods", true)
|| filterStaticInitCheckBox.isSelected() != p.getBoolean("FilterStaticInitializers", false)
|| filterConstructorsCheckBox.isSelected() != p.getBoolean("FilterConstructors", false)
|| stepThroughFiltersCheckBox.isSelected() != p.getBoolean("StepThroughFilters", false)
|| !savedAllFilters.equals(allFilters)
|| !savedEnabledFilters.equals(enabledFilters);
}
示例2: updatePreferredWidth
import javax.swing.table.TableModel; //导入方法依赖的package包/类
/**
* Computes preferred width of the column by checking all the
* data in the given column. If the resize parameter is true
* it also directly resizes the column to the computed size (besides
* setting the preferred size).
*/
void updatePreferredWidth(JTable table, boolean resize) {
TableModel dataModel = table.getModel();
int rows = dataModel.getRowCount();
if (rows == 0) {
return;
}
int sum = 0;
int max = 15;
for (int i = 0; i < rows; i++) {
Object data = dataModel.getValueAt(i, modelIndex);
int estimate = estimatedWidth(data, table);
sum += estimate;
if (estimate > max) {
max = estimate;
}
}
max += 5;
setPreferredWidth(max);
if (resize) {
resize(max, table);
}
}
示例3: updateFormat
import javax.swing.table.TableModel; //导入方法依赖的package包/类
boolean updateFormat(TableModel model) {
int rowCount = model.getRowCount();
long first = rowCount > 0 ? (Long)model.getValueAt(0, 1) : REFERENCE_TIMESTAMP;
long last = rowCount > 0 ? (Long)model.getValueAt(rowCount - 1, 1) :
REFERENCE_TIMESTAMP + 1;
String newFormatString = TimeAxisUtils.getFormatString(1, first, last);
if (!newFormatString.equals(formatString)) {
formatString = newFormatString;
format = new SimpleDateFormat(formatString);
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: 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;
}
}
示例6: 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;
}
}
示例7: 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;
}
示例8: store
import javax.swing.table.TableModel; //导入方法依赖的package包/类
@Override
public void store() {
Properties p = Properties.getDefault().getProperties("debugger.options.JPDA");
p.setBoolean("UseStepFilters", useStepFiltersCheckBox.isSelected());
p.setBoolean("FilterSyntheticMethods", filterSyntheticCheckBox.isSelected());
p.setBoolean("FilterStaticInitializers", filterStaticInitCheckBox.isSelected());
p.setBoolean("FilterConstructors", filterConstructorsCheckBox.isSelected());
TableModel filterClassesModel = filterClassesTable.getModel();
Set<String> allFilters = new LinkedHashSet<String>();
Set<String> enabledFilters = new HashSet<String>();
int n = filterClassesModel.getRowCount();
for (int i = 0; i < n; i++) {
boolean isEnabled = (Boolean) filterClassesModel.getValueAt(i, 0);
String clazz = (String) filterClassesModel.getValueAt(i, 1);
allFilters.add(clazz);
if (isEnabled) {
enabledFilters.add(clazz);
}
}
Properties.getDefault ().getProperties ("debugger").
getProperties ("sources").getProperties ("class_filters").
setCollection (
"all",
allFilters
);
Properties.getDefault ().getProperties ("debugger").
getProperties ("sources").getProperties ("class_filters").
setCollection (
"enabled",
enabledFilters
);
p.setBoolean("StepThroughFilters", stepThroughFiltersCheckBox.isSelected());
}
示例9: getIncludedNamespaces
import javax.swing.table.TableModel; //导入方法依赖的package包/类
public String[] getIncludedNamespaces() {
List<String> incs = new ArrayList<String>();
TableModel model = includesTable.getModel();
for(int i = 0; i < model.getRowCount(); i++) {
Boolean selected = (Boolean) model.getValueAt(i, 0);
if(selected != null && selected == Boolean.TRUE) {
String namespace = (String) model.getValueAt(i, 1);
incs.add(namespace);
}
}
return incs.toArray(new String[0]);
}
示例10: 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;
}
}
}
示例11: getAnnotationExpressions
import javax.swing.table.TableModel; //导入方法依赖的package包/类
private List<AnnotationExpression> getAnnotationExpressions() {
TableModel model = panel.expresionsTable.getModel();
List<AnnotationExpression> exps = new ArrayList<AnnotationExpression>(model.getRowCount());
for (int r = 0; r < model.getRowCount(); r++) {
String urlExp = (String) model.getValueAt(r, 0);
if (urlExp.trim().equals("")) {
continue;
}
String annotationExp = (String) model.getValueAt(r, 1);
exps.add(new AnnotationExpression(urlExp, annotationExp));
}
return exps;
}
示例12: tableChanged
import javax.swing.table.TableModel; //导入方法依赖的package包/类
public void tableChanged(final TableModelEvent e) {
// only post changes to the draggable column
if (isColumnEditable(e.getColumn())) {
final TableModel model = (TableModel)e.getSource();
Object tableValue = model.getValueAt(e.getFirstRow(),
e.getColumn());
if (LOGGER.isLoggable(Level.TRACE)) {
LOGGER.log(Level.TRACE,
"tableChanged: firstRow="+e.getFirstRow()+
", lastRow="+e.getLastRow()+", column="+e.getColumn()+
", value="+tableValue);
}
// if it's a String, try construct new value
// using the defined type.
if (tableValue instanceof String) {
try {
tableValue =
Utils.createObjectFromString(getClassName(e.getFirstRow()), // type
(String)tableValue);// value
} catch (Throwable ex) {
popupAndLog(ex,"tableChanged",
Messages.PROBLEM_SETTING_ATTRIBUTE);
}
}
final String attributeName = getValueName(e.getFirstRow());
final Attribute attribute =
new Attribute(attributeName,tableValue);
setAttribute(attribute, "tableChanged");
}
}
示例13: 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;
}
示例14: 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;
}
示例15: appendToDOM
import javax.swing.table.TableModel; //导入方法依赖的package包/类
private void appendToDOM(Element root) {
Document doc = root.getOwnerDocument();
TableModel atm = jt.getModel();
int count = atm.getRowCount();
for (int i = 0; i < count; i++) {
MainDataEnum[] xmlNames = MainDataEnum.values();
String name = xmlNames[i].name();
String info = (String) atm.getValueAt(i, 2);
Element e = doc.createElement(name);
e.appendChild(doc.createTextNode(info));
root.appendChild(e);
}
}