?? propertytablemodel.java
字號:
package com.sutternow.swingkar.gui;import javax.swing.table.AbstractTableModel;import javax.swing.*;import java.util.Set;import java.util.Iterator;import java.util.Map;import java.util.HashMap;import java.awt.*;/** * Created by IntelliJ IDEA. * User: sergei * Date: Apr 30, 2003 * Time: 1:22:37 AM * To change this template use Options | File Templates. */public class PropertyTableModel extends AbstractTableModel { /** * Constructs an AppList table model. * @param _appSet the collection of extentions and associations */ String[] colNames ={"Name", "Value"}; public PropertyTableModel(Set _appSet) { appSet = _appSet; } public PropertyTableModel(Set _appSet, String colOneName, String colTwoName) { colNames[0] = colOneName; colNames[1] = colTwoName; appSet = _appSet; } public int getRowCount() { return appSet.size(); } public void requestRefresh() { /* Used to refresh the table */ super.fireTableDataChanged(); } public int getColumnCount() { return 2; } public void setValueAt(Object aValue, int r, int c) { Map m = new HashMap(); Iterator iter = appSet.iterator(); int iCurrentRow = 0; while (iter.hasNext()) { Map.Entry entry = (Map.Entry) iter.next(); if (iCurrentRow == r) { if( c == 1) { //todo fill this out appSet.re //(String)entry.getKey() =(String)aValue; } else if (c==2) { entry.setValue((String)aValue); } entry.getValue(); } iCurrentRow++; } } public Object getValueAt(int r, int c) { Iterator iter = appSet.iterator(); int iCurrentRow = 0; while (iter.hasNext()) { Map.Entry entry = (Map.Entry) iter.next(); if (iCurrentRow == r) switch (c) { case 0: return entry.getKey(); case 1: return entry.getValue(); } iCurrentRow++; } return "no value dude"; } public String getColumnName(int c) { return colNames[c]; } private Set appSet;} //}}}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -