List of usage examples for javax.swing JTable getRowCount
@BeanProperty(bound = false) public int getRowCount()
JTable
, given unlimited space. From source file:gdt.jgui.tool.JEntityEditor.java
private void save() { try {//from ww w. ja v a 2s.c o m int eCnt = tabbedPane.getComponentCount(); Sack candidate = new Sack(); String element$; JScrollPane scrollPane; JTable table; int rCnt; Core row; TableModel model; for (int i = 0; i < eCnt; i++) { element$ = tabbedPane.getTitleAt(i); candidate.createElement(element$); scrollPane = (JScrollPane) tabbedPane.getComponentAt(i); table = (JTable) scrollPane.getViewport().getView(); rCnt = table.getRowCount(); model = table.getModel(); for (int j = 0; j < rCnt; j++) { row = new Core((String) model.getValueAt(j, 0), (String) model.getValueAt(j, 1), (String) model.getValueAt(j, 2)); if ("attributes".equals(element$)) candidate.putAttribute(row); else candidate.putElementItem(element$, row); } } candidate.setKey(entityKey$); candidate.saveXML(entihome$ + "/" + Entigrator.ENTITY_BASE + "/data/" + entityKey$); } catch (Exception e) { LOGGER.severe(e.toString()); } }
From source file:edu.ku.brc.specify.plugins.sgr.SGRResultsDisplay.java
/** * From http://www.pikopong.com/blog/2008/08/13/auto-resize-jtable-column-width/ * //from w ww.ja v a 2 s . co m * @param table * @param model * @return */ private JTable autoResizeColWidth(JTable table, DefaultTableModel model) { table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF); table.setModel(model); int margin = 5; for (int i = 0; i < table.getColumnCount(); i++) { int vColIndex = i; DefaultTableColumnModel colModel = (DefaultTableColumnModel) table.getColumnModel(); TableColumn col = colModel.getColumn(vColIndex); int width = 0; // Get width of column header TableCellRenderer renderer = col.getHeaderRenderer(); if (renderer == null) { renderer = table.getTableHeader().getDefaultRenderer(); } Component comp = renderer.getTableCellRendererComponent(table, col.getHeaderValue(), false, false, 0, 0); width = comp.getPreferredSize().width; // Get maximum width of column data for (int r = 0; r < table.getRowCount(); r++) { renderer = table.getCellRenderer(r, vColIndex); comp = renderer.getTableCellRendererComponent(table, table.getValueAt(r, vColIndex), false, false, r, vColIndex); width = Math.max(width, comp.getPreferredSize().width); } // Add margin width += 2 * margin; // Set the width col.setPreferredWidth(width); } ((DefaultTableCellRenderer) table.getTableHeader().getDefaultRenderer()) .setHorizontalAlignment(SwingConstants.LEFT); // table.setAutoCreateRowSorter(true); //table.getTableHeader().setReorderingAllowed(false); return table; }
From source file:com.smanempat.controller.ControllerEvaluation.java
public void showDataSetModel(JTable tableDataSetModel, JTable tableTahunModel, JLabel totalDataModel) throws SQLException { int row;/* w ww .ja v a2s . co m*/ int transMinat; tableModelDataSet1 = (DefaultTableModel) tableDataSetModel.getModel(); row = tableModelDataSet1.getRowCount(); for (int i = 0; i < row; i++) { tableModelDataSet1.removeRow(0); } row = tableTahunModel.getRowCount(); boolean checkList; for (int i = 0; i < row; i++) { checkList = Boolean.valueOf("" + tableTahunModel.getValueAt(i, 1)); if (checkList == true) { dbConnection = new DbConnection(); connect = dbConnection.connect(); query = "SELECT * FROM siswa WHERE tahun_ajaran = ?"; pstmt = connect.prepareStatement(query); pstmt.setString(1, tableTahunModel.getValueAt(i, 0).toString()); rs = pstmt.executeQuery(); while (rs.next()) { String nis = rs.getString("nis"); String nama = rs.getString("nama"); String jenisKelamin = rs.getString("jenis_kelamin"); String nilaiUN = rs.getString("nilai_un"); double meanUN = Double.parseDouble(nilaiUN) / 4; String ptBindo = rs.getString("pt_bhs_indonesia"); String ptMtk = rs.getString("pt_matematika"); String ptBing = rs.getString("pt_bhs_inggris"); String ptIpa = rs.getString("pt_ipa"); double meanPt = (Double.parseDouble(ptBindo) + Double.parseDouble(ptMtk) + Double.parseDouble(ptBing) + Double.parseDouble(ptIpa)) / 4; String minat = rs.getString("minat"); if (minat.equals("IPA")) { transMinat = 1; } else { transMinat = 0; } String jurusan = rs.getString("jurusan"); Object tableContent[] = { nis, nilaiUN, meanUN, ptBindo, ptMtk, ptBing, ptIpa, meanPt, minat, transMinat, jurusan }; tableModelDataSet1.addRow(tableContent); } } tableDataSetModel.setModel(tableModelDataSet1); totalDataModel.setText(tableDataSetModel.getRowCount() + " Data"); } }
From source file:com.smanempat.controller.ControllerClassification.java
public void chooseFile(ActionEvent evt, JTextField txtFileDirectory, JTextField txtNumberOfK, JLabel labelJumlahData, JButton buttonProses, JTable tablePreview) { try {//from www.j av a 2 s .co m JFileChooser fileChooser = new JFileChooser(); FileNameExtensionFilter fileNameExtensionFilter = new FileNameExtensionFilter("Excel File", "xls", "xlsx"); fileChooser.setFileFilter(fileNameExtensionFilter); if (fileChooser.showOpenDialog(fileChooser) == JFileChooser.APPROVE_OPTION) { txtFileDirectory.setText(fileChooser.getSelectedFile().getAbsolutePath()); System.out.println("Good, File Chooser runing well!"); if (txtFileDirectory.getText().endsWith(".xls") || txtFileDirectory.getText().endsWith(".xlsx")) { showOnTable(evt, txtFileDirectory, tablePreview); labelJumlahData.setText(tablePreview.getRowCount() + " Data"); txtNumberOfK.setEnabled(true); txtNumberOfK.requestFocus(); buttonProses.setEnabled(true); } else { JOptionPane.showMessageDialog(null, "File dataset harus file spreadsheet dengan ekstensi *xls atau *.xlsx!", "Error", JOptionPane.INFORMATION_MESSAGE, new ImageIcon("src/com/smanempat/image/fail.png")); txtFileDirectory.setText(""); chooseFile(evt, txtFileDirectory, txtNumberOfK, labelJumlahData, buttonProses, tablePreview); } } } catch (Exception e) { e.printStackTrace(); } }
From source file:com.smanempat.controller.ControllerEvaluation.java
public void showDataSetTest(JTable tableDataSetTesting, JTable tableTahunTesting, JLabel labelTotalDataModel) throws SQLException { int row;/*from w w w . j a va 2 s . c om*/ int transMinat; //modelEvaluation = new ModelEvaluation(); tableModelDataSet2 = (DefaultTableModel) tableDataSetTesting.getModel(); //tempArray = new ArrayList<String>(); row = tableModelDataSet2.getRowCount(); for (int i = 0; i < row; i++) { tableModelDataSet2.removeRow(0); } row = tableTahunTesting.getRowCount(); boolean checkList; for (int i = 0; i < row; i++) { checkList = Boolean.valueOf("" + tableTahunTesting.getValueAt(i, 1)); if (checkList == true) { dbConnection = new DbConnection(); connect = dbConnection.connect(); query = "SELECT * FROM siswa WHERE tahun_ajaran = ?"; pstmt = connect.prepareStatement(query); pstmt.setString(1, tableTahunTesting.getValueAt(i, 0).toString()); rs = pstmt.executeQuery(); while (rs.next()) { String nis = rs.getString("nis"); String nama = rs.getString("nama"); String jenisKelamin = rs.getString("jenis_kelamin"); String nilaiUN = rs.getString("nilai_un"); double meanUN = Double.parseDouble(nilaiUN) / 4; String ptBindo = rs.getString("pt_bhs_indonesia"); String ptMtk = rs.getString("pt_matematika"); String ptBing = rs.getString("pt_bhs_inggris"); String ptIpa = rs.getString("pt_ipa"); double meanPt = (Double.parseDouble(ptBindo) + Double.parseDouble(ptMtk) + Double.parseDouble(ptBing) + Double.parseDouble(ptIpa)) / 4; String minat = rs.getString("minat"); if (minat.equals("IPA")) { transMinat = 1; } else { transMinat = 0; } jurusan = rs.getString("jurusan"); Object tableContent[] = { nis, nilaiUN, meanUN, ptBindo, ptMtk, ptBing, ptIpa, meanPt, minat, transMinat }; tableModelDataSet2.addRow(tableContent); } } tableDataSetTesting.setModel(tableModelDataSet2); labelTotalDataModel.setText(tableDataSetTesting.getRowCount() + " Data"); } }
From source file:com.smanempat.controller.ControllerEvaluation.java
private double[][] evaluationModel(JTable tableResult, JTable tableConfMatrix, JLabel totalAccuracy, JTable tableTahunTesting, JTable tableDataSetTesting, String[] knnValue, int i, int[] tempK, JPanel panelChart) throws SQLException { int actIPA = 0; int actIPS = 0; int trueIPA = 0; int falseIPA = 0; int trueIPS = 0; int falseIPS = 0; double recIPA; double recIPS; double preIPA; double preIPS; double accuracy; DefaultTableModel tableModelRes = new DefaultTableModel(); tableModelRes = (DefaultTableModel) tableResult.getModel(); String[] tempJurusan = getJurusanTest(tableTahunTesting, tableDataSetTesting); for (int j = 0; j < tableDataSetTesting.getRowCount(); j++) { String nis = tableDataSetTesting.getValueAt(j, 0).toString(); String jurusan = tempJurusan[j]; String classified = knnValue[j]; Object[] tableContent = { nis, jurusan, classified }; tableModelRes.addRow(tableContent); tableResult.setModel(tableModelRes); }/*from w ww . j av a 2 s . c o m*/ /*Hitung Jumlah Data Actual IPA dan IPS*/ for (int j = 0; j < tempJurusan.length; j++) { if (tempJurusan[j].equals("IPA")) { actIPA = actIPA + 1; } else if (tempJurusan[j].equals("IPS")) { actIPS = actIPS + 1; } } /*Hitung Jumlah Data Classified IPA dan IPS*/ for (int j = 0; j < knnValue.length; j++) { if (tableResult.getValueAt(j, 1).equals("IPA")) { if (tableResult.getValueAt(j, 1).equals(tableResult.getValueAt(j, 2))) { trueIPA = trueIPA + 1; } else { falseIPS = falseIPS + 1; } } else if (tableResult.getValueAt(j, 1).equals("IPS")) { if (tableResult.getValueAt(j, 1).equals(tableResult.getValueAt(j, 2))) { trueIPS = trueIPS + 1; } else { falseIPA = falseIPA + 1; } } } /*Hitung Nilai Recall, Precision, dan Accuracy*/ preIPA = (double) trueIPA / (trueIPA + falseIPA); preIPS = (double) trueIPS / (trueIPS + falseIPS); recIPA = (double) trueIPA / (trueIPA + falseIPS); recIPS = (double) trueIPS / (trueIPS + falseIPA); accuracy = (double) (trueIPA + trueIPS) / (trueIPA + trueIPS + falseIPA + falseIPS); /*Tampung Nilai Recall, Precision, dan Accuracy*/ double[][] tempEval = new double[3][tempK.length]; tempEval[0][i] = accuracy; tempEval[1][i] = recIPA; tempEval[2][i] = preIPA; /*Set Nilai TF, TN, FP, FN ke Tabel Confusion Matrix*/ tableConfMatrix.setValueAt("Actual IPA", 0, 0); tableConfMatrix.setValueAt("Actual IPS", 1, 0); tableConfMatrix.setValueAt("Class Precision", 2, 0); tableConfMatrix.setValueAt(trueIPA, 0, 1); tableConfMatrix.setValueAt(falseIPS, 0, 2); tableConfMatrix.setValueAt(falseIPA, 1, 1); tableConfMatrix.setValueAt(trueIPS, 1, 2); /*Set Nilai Recall, Precision, dan Accuracy ke Tabel Confusion Matrix*/ if (Double.isNaN(preIPA)) { tableConfMatrix.setValueAt("NaN" + " %", 2, 1); } else { tableConfMatrix.setValueAt(df.format(preIPA * 100) + " %", 2, 1); } if (Double.isNaN(preIPS)) { tableConfMatrix.setValueAt("NaN" + " %", 2, 2); } else { tableConfMatrix.setValueAt(df.format(preIPS * 100) + " %", 2, 2); } if (Double.isNaN(recIPA)) { tableConfMatrix.setValueAt("NaN" + " %", 0, 3); } else { tableConfMatrix.setValueAt(df.format(recIPA * 100) + " %", 0, 3); } if (Double.isNaN(recIPS)) { tableConfMatrix.setValueAt("NaN" + " %", 1, 3); } else { tableConfMatrix.setValueAt(df.format(recIPS * 100) + " %", 1, 3); } if (Double.isNaN(accuracy)) { totalAccuracy.setText("Overall Accuracy is " + "NaN" + " %"); } else { totalAccuracy.setText("Overall Accuracy is " + df.format(accuracy * 100) + " %"); } tableModelRes.setRowCount(0); return tempEval; }
From source file:edu.ucla.stat.SOCR.chart.demo.SOCR_EM_MixtureModelChartDemo.java
protected void emptyResultsTable() { String[] resultsHeading = new String[2]; resultsHeading[0] = "Kernel"; resultsHeading[1] = "Resutls"; String[][] results = new String[1][2]; JTable tempResultsTable = new JTable(results, resultsHeading); resetRTableRows(tempResultsTable.getRowCount()); for (int i = 0; i < tempResultsTable.getRowCount(); i++) for (int j = 0; j < tempResultsTable.getColumnCount(); j++) { for (int s = 0; s < num_series; s++) { resultsTables[s].setValueAt(tempResultsTable.getValueAt(i, j), i, j); }//from w w w . ja v a 2 s . c o m } }
From source file:com.smanempat.controller.ControllerEvaluation.java
public void proccessMining(JTable tableDataSetModel, JTable tableDataSetTesting, JTextField txtNumberOfK, JLabel labelPesanError, JTabbedPane jTabbedPane1, JTable tableResult, JTable tableConfMatrix, JTable tableTahunTesting, JLabel totalAccuracy, JPanel panelChart, JPanel panelChart1, JPanel panelChart2, JRadioButton singleTesting, JRadioButton multiTesting, JTextArea txtArea) throws SQLException { Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR); modelEvaluation = new ModelEvaluation(); int rowCountModel = tableDataSetModel.getRowCount(); int rowCountTest = tableDataSetTesting.getRowCount(); int[] tempK;/* ww w .j av a2s . co m*/ double[][] tempEval; double[][] evalValue; boolean valid = false; /*Validasi Dataset Model dan Dataset Uji*/ if (rowCountModel == 0) { JOptionPane.showMessageDialog(null, "Pilih dataset model terlebih dahulu!", "Error", JOptionPane.INFORMATION_MESSAGE, new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png"))); txtNumberOfK.requestFocus(); } else if (rowCountTest == 0) { JOptionPane.showMessageDialog(null, "Pilih dataset uji terlebih dahulu!", "Error", JOptionPane.INFORMATION_MESSAGE, new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png"))); txtNumberOfK.requestFocus(); } else { valid = true; } /*Validasi Dataset Model dan Dataset Uji*/ if (valid == true) { if (multiTesting.isSelected()) { String iterasi = JOptionPane.showInputDialog("Input Jumlah Iterasi Pengujian :"); boolean validMulti = false; if (iterasi != null) { /*Validasi Jumlah Iterasi*/ if (Pattern.matches("[0-9]+", iterasi) == false && iterasi.length() > 0) { JOptionPane.showMessageDialog(null, "Nilai iterasi tidak valid!", "Error", JOptionPane.INFORMATION_MESSAGE, new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png"))); } else if (iterasi.isEmpty()) { JOptionPane.showMessageDialog(null, "Nilai iterasi tidak boleh kosong!", "Error", JOptionPane.INFORMATION_MESSAGE, new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png"))); } else if (iterasi.length() == 9) { JOptionPane.showMessageDialog(null, "Nilai iterasi terlalu panjang!", "Error", JOptionPane.INFORMATION_MESSAGE, new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png"))); } else if (rowCountTest > rowCountModel) { JOptionPane.showMessageDialog(null, "Data Uji tidak boleh lebih besar daripada data Model!", "Error", JOptionPane.INFORMATION_MESSAGE, new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png"))); } else { validMulti = true; System.out.println("valiMulti = " + validMulti + " Kok"); } /*Validasi Jumlah Iterasi*/ } if (validMulti == true) { tempK = new int[Integer.parseInt(iterasi)]; evalValue = new double[3][tempK.length]; for (int i = 0; i < Integer.parseInt(iterasi); i++) { validMulti = false; String k = JOptionPane .showInputDialog("Input Nilai Nearest Neighbor (k) ke " + (i + 1) + " :"); if (k != null) { /*Validasi Nilai K Tiap Iterasi*/ if (Pattern.matches("[0-9]+", k) == false && k.length() > 0) { JOptionPane.showMessageDialog(null, "Nilai nearest neighbor (k) tidak valid!", "Error", JOptionPane.INFORMATION_MESSAGE, new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png"))); } else if (k.isEmpty()) { JOptionPane.showMessageDialog(null, "Nilai nearest neighbor (k) tidak boleh kosong!", "Error", JOptionPane.INFORMATION_MESSAGE, new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png"))); } else if (k.length() == 9) { JOptionPane.showMessageDialog(null, "Nilai nearest neighbor (k) terlalu panjang!", "Error", JOptionPane.INFORMATION_MESSAGE, new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png"))); } else { validMulti = true; } /*Validasi Nilai K Tiap Iterasi*/ } if (validMulti == true) { tempK[i] = Integer.parseInt(k); System.out.println(tempK[i]); } else { break; } } if (validMulti == true) { for (int i = 0; i < tempK.length; i++) { int kValue = tempK[i]; String[][] modelValue = getModelValue(rowCountModel, tableDataSetModel); double[][] testValue = getTestvalue(rowCountTest, tableDataSetTesting); String[] knnValue = getKNNValue(rowCountModel, rowCountTest, modelValue, testValue, kValue); tempEval = evaluationModel(tableResult, tableConfMatrix, totalAccuracy, tableTahunTesting, tableDataSetTesting, knnValue, i, tempK, panelChart); //Menampung nilai Accuracy evalValue[0][i] = tempEval[0][i]; //Menampung nilai Recall evalValue[1][i] = tempEval[1][i]; //Menampung nilai Precision evalValue[2][i] = tempEval[2][i]; jTabbedPane1.setSelectedIndex(1); txtArea.append( "Tingkat Keberhasilan Sistem dengan Nilai Number of Nearest Neighbor (K) = " + tempK[i] + "\n"); txtArea.append("Akurasi\t\t: " + evalValue[0][i] * 100 + " %\n"); txtArea.append("Recall\t\t: " + evalValue[1][i] * 100 + " %\n"); txtArea.append("Precision\t: " + evalValue[2][i] * 100 + " %\n"); txtArea.append( "=============================================================================\n"); } showChart(tempK, evalValue, panelChart, panelChart1, panelChart2); } } } else if (singleTesting.isSelected()) { boolean validSingle = false; String k = txtNumberOfK.getText(); int nilaiK = 0; evalValue = new double[3][1]; /*Validasi Nilai Number of Nearest Neighbor*/ if (Pattern.matches("[0-9]+", k) == false && k.length() > 0) { labelPesanError.setText("Number of Nearest Neighbor tidak valid"); JOptionPane.showMessageDialog(null, "Number of Nearest Neighbor tidak valid!", "Error", JOptionPane.INFORMATION_MESSAGE, new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png"))); txtNumberOfK.requestFocus(); } else if (k.isEmpty()) { JOptionPane.showMessageDialog(null, "Number of Nearest Neighbor tidak boleh kosong!", "Error", JOptionPane.INFORMATION_MESSAGE, new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png"))); labelPesanError.setText("Number of Nearest Neighbor tidak boleh kosong"); txtNumberOfK.requestFocus(); } else if (rowCountModel == 0 && Integer.parseInt(k) >= rowCountModel) { JOptionPane.showMessageDialog(null, "Pilih dataset model terlebih dahulu!", "Error", JOptionPane.INFORMATION_MESSAGE, new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png"))); txtNumberOfK.requestFocus(); } else if (rowCountTest == 0 && Integer.parseInt(k) >= rowCountTest) { JOptionPane.showMessageDialog(null, "Pilih dataset uji terlebih dahulu!", "Error", JOptionPane.INFORMATION_MESSAGE, new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png"))); txtNumberOfK.requestFocus(); } else if (Integer.parseInt(k) >= rowCountModel) { JOptionPane.showMessageDialog(null, "Number of Nearest Neighbor tidak boleh lebih dari " + rowCountModel + " !", "Error", JOptionPane.INFORMATION_MESSAGE, new ImageIcon(getClass().getResource("/com/smanempat/image/fail.png"))); txtNumberOfK.requestFocus(); } else { validSingle = true; nilaiK = Integer.parseInt(k); } /*Validasi Nilai Number of Nearest Neighbor*/ if (validSingle == true) { int confirm; int i = 0; confirm = JOptionPane.showOptionDialog(null, "Yakin ingin memproses data?", "Proses Klasifikasi", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE, null, null, null); if (confirm == JOptionPane.OK_OPTION) { int kValue = Integer.parseInt(txtNumberOfK.getText()); String[][] modelValue = getModelValue(rowCountModel, tableDataSetModel); double[][] testValue = getTestvalue(rowCountTest, tableDataSetTesting); String[] knnValue = getKNNValue(rowCountModel, rowCountTest, modelValue, testValue, kValue); tempEval = evaluationModel(tableResult, tableConfMatrix, totalAccuracy, tableTahunTesting, tableDataSetTesting, knnValue, nilaiK, panelChart); evalValue[0][i] = tempEval[0][0]; evalValue[1][i] = tempEval[1][0]; evalValue[2][i] = tempEval[2][0]; jTabbedPane1.setSelectedIndex(1); } System.out.println("com.smanempat.controller.ControllerEvaluation.proccessMining()OKOKOK"); showChart(nilaiK, evalValue, panelChart, panelChart1, panelChart2); Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR); } } } }
From source file:org.jas.gui.MainWindow.java
@EventMethod(Events.LOAD_METADATA) void onLoadMetadata(List<Metadata> metadatas) { JTable descriptionTable = getDescriptionTable(); DefaultTableModel model = (DefaultTableModel) descriptionTable.getModel(); for (Metadata metadata : metadatas) { int row = descriptionTable.getRowCount(); model.addRow(new Object[] { "", "", "", "", "", "", "", "" }); descriptionTable.setValueAt(metadata.getArtist(), row, ApplicationState.ARTIST_COLUMN); descriptionTable.setValueAt(metadata.getTitle(), row, ApplicationState.TITLE_COLUMN); descriptionTable.setValueAt(metadata.getAlbum(), row, ApplicationState.ALBUM_COLUMN); descriptionTable.setValueAt(metadata.getGenre(), row, ApplicationState.GENRE_COLUMN); descriptionTable.setValueAt(metadata.getYear(), row, ApplicationState.YEAR_COLUMN); descriptionTable.setValueAt(metadata.getTrackNumber(), row, ApplicationState.TRACK_NUMBER_COLUMN); descriptionTable.setValueAt(metadata.getTotalTracks(), row, ApplicationState.TOTAL_TRACKS_NUMBER_COLUMN); descriptionTable.setValueAt(metadata.getCdNumber(), row, ApplicationState.CD_NUMBER_COLUMN); descriptionTable.setValueAt(metadata.getTotalCds(), row, ApplicationState.TOTAL_CDS_NUMBER_COLUMN); if (metadata.isMetadataFromFile()) { descriptionTable.setValueAt(ApplicationState.NEW, row, ApplicationState.STATUS_COLUMN); metadataWithAlbum.add(metadata); getApplyButton().setEnabled(true); } else {/*from ww w.jav a 2s . co m*/ descriptionTable.setValueAt(ApplicationState.READY, row, ApplicationState.STATUS_COLUMN); } } }
From source file:edu.ucla.stat.SOCR.chart.demo.SOCR_EM_MixtureModelChartDemo.java
protected void setTable(XYDataset ds) { // update results table after segment //System.out.println("setTable get called"); //printDataset(ds); if (segment_flag) { // System.out.println("settable: setting segment resultTable"); resultsTables = new CustomJTable[num_series]; for (int s = 0; s < num_series; s++) { resultsTables[s] = mEMexperiment[s].getResultsTable(); }// w w w. j a v a2 s. c o m } else { convertor.dataset2Table((XYDataset) ds); JTable tempDataTable = convertor.getTable(); resetTableRows(tempDataTable.getRowCount() + 1); resetTableColumns(tempDataTable.getColumnCount()); for (int i = 0; i < tempDataTable.getColumnCount(); i++) { columnModel.getColumn(i).setHeaderValue(tempDataTable.getColumnName(i)); // System.out.println("updateExample tempDataTable["+i+"] = " +tempDataTable.getColumnName(i)); } columnModel = dataTable.getColumnModel(); dataTable.setTableHeader(new EditableHeader(columnModel)); for (int i = 0; i < tempDataTable.getRowCount(); i++) for (int j = 0; j < tempDataTable.getColumnCount(); j++) { String v = (String) tempDataTable.getValueAt(i, j); //if (v!="null" && v!="NaN") dataTable.setValueAt(v, i, j); } } //no segment // int columnCount = dataTable.getColumnCount(); //attention this is a quick fix for losted mapping, need revisit!!!!! for (int i = 0; i < num_series; i++) { //System.out.println("mapping"); addButtonIndependent(); addButtonDependent(); } setTablePane(); // don't bring graph to the front if (tabbedPanelContainer.getTitleAt(tabbedPanelContainer.getSelectedIndex()) != ALL) { // tabbedPanelContainer.setSelectedIndex(tabbedPanelContainer.indexOfComponent(graphPanel)); } else { setMixPanel(); } }