테이블 모델을 만들어보아요 JAVA
2010-05-09 19:38:11

// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

// 테이블을 나타내기 위한 내부클래스 Cross Validation WordTable

// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

class TopPizzaTable extends AbstractTableModel {

List docuList;

Object[][] data;

private String[] columnNames = { "No", "Words", "Possibility" };

public CVWordTable() {

data = new Object[100][3];

for (int i = 0; i < 100; i++) {

data[i][0] = " -";

data[i][1] = " -";

data[i][2] = " -";// 긍정문에서 해당 단어가 나올확률

}

}

public void reset(int order) {

pw1CV[order] = AlSpamFilterMgr.getPosiNegaCV(

SettingValue.PROGRAM_ID, 1, order);

pw2CV[order] = AlSpamFilterMgr.getPosiNegaCV(

SettingValue.PROGRAM_ID, 0, order);

List word = AlSpamFilterMgr.getWordsProbabilityCV(

SettingValue.PROGRAM_ID, order/* 번째 */);

data = new Object[word.size()][3];

double temp_weight = 0.0f;

for (int i = 0; i < word.size(); i++) {

data[i][0] = i + 1;

data[i][1] = word.get(i).getWord();

temp_weight = BayesianSpamFilter.calWordsWeight(word.get(i)

.getAnW1(), word.get(i).getAnW2(), pw1CV[order],

pw2CV[order]);// 부정문에서 해당 단어가 나올확률

data[i][2] = temp_weight;

word.get(i).setWeight(temp_weight);

}

afterCVWordTable[order] = true;

}

public int getColumnCount() {

return columnNames.length;

}

public int getRowCount() {

return data.length;

}

public String getColumnName(int col) {

return columnNames[col];

}

public Object getValueAt(int row, int col) {

return data[row][col];

}

/*

* JTable uses this method to determine the default renderer/ editor for

* each cell. If we didn't implement this method, then the last column

* would contain text ("true"/"false"), rather than a check box.

*/

public Class getColumnClass(int c) {

return getValueAt(0, c).getClass();

}

public boolean isCellEditable(int row, int col) {

// Note that the data/cell address is constant,

// no matter where the cell appears onscreen.

if (col < 2) {

return false;

} else {

return true;

}

}

public void setValueAt(Object value, int row, int col) {

if (DEBUG) {

System.out.println("Setting value at " + row + "," + col

+ " to " + value + " (an instance of "

+ value.getClass() + ")");

}

data[row][col] = value;

fireTableCellUpdated(row, col);

if (DEBUG) {

System.out.println("New value of data:");

printDebugData();

}

}

private void printDebugData() {

int numRows = getRowCount();

int numCols = getColumnCount();

for (int i = 0; i < numRows; i++) {

System.out.print(" row " + i + ":");

for (int j = 0; j < numCols; j++) {

System.out.print(" " + data[i][j]);

}

System.out.println();

}

System.out.println("--------------------------");

}

}

// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

// 테이블을 나타내기 위한 내부클래스

// ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

▼ more
테이블을 만들어 보아요 JAVA
2010-05-09 19:37:49

model3 = new TotalWordWeightTable();

jTable3 = new JTable(model3);

jTable3.setModel(model3);

jTable3.setFillsViewportHeight(true);

jTable3.setPreferredSize(new java.awt.Dimension(214, 5000*TABLE_HEIGHT));

jTable3.setToolTipText("weight");

// jTable2.addMouseListener(new MyMouseListener()); // MouseListener등록

//Create the scroll pane and add the table to it.

scrollPane3 = new JScrollPane(jTable3);

//Add the scroll pane to this panel.

jInternalFrame1.getContentPane().add(scrollPane3);//internalFrame에 넣는다.

scrollPane3.setBounds(200, 31, 300, 139);

▼ more
내가알던 아빠는
2010-05-08 18:51:47

비맞은연에서 대나무실만 떼어내어

갱지에 붙이는것 만으로도 훌륭한연을

만들수 있는 사람 이었다

아직도 기억난다 현대타운을 두개를 엎은 높이보다

더 높이날던 갱지 가오리연.

잿빛하늘에도 아랑곳 하지 않았다

좋았다

▼ more
Get project folder path in JAVA
2010-05-08 17:15:44

System.getProperty("user.dir")

▼ more