List of usage examples for javax.swing JTable getValueAt
public Object getValueAt(int row, int column)
row
and column
. 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 .j a v a2 s. c o 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:edu.ucla.stat.SOCR.chart.SuperPowerChart.java
protected void setTable(XYDataset ds) { convertor.Power2Table(ds);//from w w w . j a va 2s . c om //convertor.dataset2Table(dataset); 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++) { dataTable.setValueAt(tempDataTable.getValueAt(i, j), i, j); } dataPanel.removeAll(); dataPanel.add(new JScrollPane(dataTable)); dataTable.setGridColor(Color.gray); dataTable.setShowGrid(true); dataTable.doLayout(); // this is a fix for the BAD SGI Java VM - not up to date as of dec. 22, 2003 try { dataTable.setDragEnabled(true); } catch (Exception e) { } dataPanel.validate(); // don't bring graph to the front if (tabbedPanelContainer.getTitleAt(tabbedPanelContainer.getSelectedIndex()) != ALL) { // tabbedPanelContainer.setSelectedIndex(tabbedPanelContainer.indexOfComponent(graphPanel)); } else { dataPanel2.removeAll(); dataPanel2.add(new JLabel(" ")); dataPanel2.add(new JLabel("Data")); JScrollPane dt = new JScrollPane(dataTable); dt.setPreferredSize(new Dimension(CHART_SIZE_X / 3, CHART_SIZE_Y * 3 / 8)); dataPanel2.add(dt); JScrollPane st = new JScrollPane(summaryPanel); st.setPreferredSize(new Dimension(CHART_SIZE_X / 3, CHART_SIZE_Y / 6)); dataPanel2.add(st); st.validate(); dataPanel2.add(new JLabel(" ")); dataPanel2.add(new JLabel("Mapping")); mapPanel.setPreferredSize(new Dimension(CHART_SIZE_X / 3, CHART_SIZE_Y / 2)); dataPanel2.add(mapPanel); dataPanel2.validate(); } }
From source file:com.sec.ose.osi.ui.frm.main.identification.codematch.table.JTableInfoForCMFolder.java
synchronized public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { JComponent comp = (JComponent) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);//w w w .ja v a 2 s. c o m if (value == null) { comp.setToolTipText(null); return comp; } comp.setToolTipText(String.valueOf(value)); if (row >= table.getRowCount()) { log.debug("row > table.getRowCount()"); return comp; } switch (column) { case TableModelForCMFolder.COL_COMPONENT_NAME: case TableModelForCMFolder.COL_LICENSE_NAME: setHorizontalAlignment(SwingConstants.LEFT); break; case TableModelForCMFolder.COL_VERSION_NAME: case TableModelForCMFolder.COL_IDENTIFIED: case TableModelForCMFolder.COL_STATUS: case TableModelForCMFolder.COL_PENDING: setHorizontalAlignment(SwingConstants.CENTER); break; } int pendingHits = 0; int identifiedHits = 0; if (table.getValueAt(row, TableModelForCMFolder.COL_PENDING) != null) { pendingHits = Tools .transStringToInteger(table.getValueAt(row, TableModelForCMFolder.COL_PENDING).toString()); } if (table.getValueAt(row, TableModelForCMFolder.COL_IDENTIFIED) != null) { identifiedHits = Tools .transStringToInteger(table.getValueAt(row, TableModelForCMFolder.COL_IDENTIFIED).toString()); } if (identifiedHits > 0 && pendingHits == 0) { comp.setFont(new Font("Arial", Font.BOLD, 12)); comp.setForeground(NORMAL_COLOR); } else if (identifiedHits == 0 && pendingHits == 0) { comp.setForeground(GRAY_COLOR); } else { comp.setForeground(NORMAL_COLOR); } return comp; }
From source file:frameworks.Masken.java
public void maskentranscode(JTable table, String altezd, String neuezd) { int neuezdint = 0; int dbnummerx = 0; for (int i = 0; i < table.getRowCount(); i++) { // Tabelle durchlaufen // Und die Maske erst mal in ZD umrechnen // Schleife ber das Maskenarray der DB for (int dbnummer = 1; dbnummer < 41; dbnummer++) { //Schleife ebr die Gruppen for (int grnummer = 0; grnummer < 21; grnummer++) { // Wenn nun die Maskennummer zur aktuellen Tabellenzeile passt if (GlobalVars.MaskArray[dbnummer][grnummer] != null) { if (GlobalVars.MaskArray[dbnummer][grnummer].equals(table.getValueAt(i, 0))) { // Dann wissen wir die Datei und die GR //die muss aber noch bersetzt werden in Vartab anstatt DB Vartab vartab = new Vartab(); dbnummerx = vartab.ZD2Vartab(dbnummer); //Falls diese mit der bergeben ZD die gendert wurde bereinstimmt if (altezd.equals(Integer.toString(dbnummerx))) { // dann mssen wir diese transferieren int neuezdi = Integer.parseInt(neuezd); neuezdi = vartab.Vartab2ZD(neuezdi); table.setValueAt(GlobalVars.MaskArray[neuezdi][grnummer], i, 1); }//from www .j av a 2s .c o m } } } /* dbgr = table.getValueAt(i, 3).toString(); db = dbgr.substring(0, dbgr.indexOf(":")); gr = dbgr.substring(dbgr.indexOf(":") + 1, dbgr.length()); if (db.equals(altezd)) { table.setValueAt(neuezd + ":" + gr, i, 3);*/ } } }
From source file:com.mirth.connect.client.ui.browsers.message.MessageBrowserAdvancedFilter.java
private void initMetaDataSearchTable() { metaDataSearchTable.setModel(new DefaultTableModel(new Object[][] {}, new String[] { "Metadata", "Operator", "Value", "Ignore Case" }) { public boolean isCellEditable(int rowIndex, int columnIndex) { if (columnIndex == 3 && cachedMetaDataColumns.get(getValueAt(rowIndex, 0)) .getType() != MetaDataColumnType.STRING) { return false; }/*from ww w .j a va 2 s . com*/ return true; } @Override public void setValueAt(Object value, int row, int column) { int metaDataColumnIndex = findColumn("Metadata"); int operatorColumnIndex = findColumn("Operator"); int valueColumnIndex = findColumn("Value"); int ignoreCaseColumnIndex = findColumn("Ignore Case"); if (column == valueColumnIndex) { MetaDataColumn metaDataColumn = cachedMetaDataColumns.get(getValueAt(row, metaDataColumnIndex)); if (StringUtils.isNotEmpty((String) value)) { try { metaDataColumn.getType().castValue(value); } catch (MetaDataColumnException e) { parent.alertError(parent, "Invalid value for column type " + metaDataColumn.getType().toString()); return; } } } else if (column == metaDataColumnIndex) { if (!value.equals(getValueAt(row, metaDataColumnIndex))) { MetaDataSearchOperator operator = MetaDataSearchOperator.EQUAL; super.setValueAt(operator, row, operatorColumnIndex); MetaDataColumn metaDataColumn = cachedMetaDataColumns.get(value); if (metaDataColumn.getType() != MetaDataColumnType.STRING) { super.setValueAt(Boolean.FALSE, row, ignoreCaseColumnIndex); } } super.setValueAt("", row, valueColumnIndex); } super.setValueAt(value, row, column); } }); metaDataSearchTable.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); metaDataSearchTable.setDragEnabled(false); metaDataSearchTable.setSortable(false); metaDataSearchTable.getTableHeader().setReorderingAllowed(false); addMetaDataSearchButton.setEnabled(!messageBrowser.getMetaDataColumns().isEmpty()); metaDataSearchTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() { public void valueChanged(ListSelectionEvent evt) { deleteMetaDataSearchButton.setEnabled(getSelectedRow(metaDataSearchTable) != -1); } }); if (Preferences.userNodeForPackage(Mirth.class).getBoolean("highlightRows", true)) { metaDataSearchTable.setHighlighters(HighlighterFactory .createAlternateStriping(UIConstants.HIGHLIGHTER_COLOR, UIConstants.BACKGROUND_COLOR)); } List<MetaDataColumn> metaDataColumns = messageBrowser.getMetaDataColumns(); cachedMetaDataColumns.clear(); String[] metaDataNames = new String[metaDataColumns.size()]; for (int i = 0; i < metaDataColumns.size(); i++) { String columnName = metaDataColumns.get(i).getName(); metaDataNames[i] = columnName; cachedMetaDataColumns.put(columnName, metaDataColumns.get(i)); } MirthComboBoxTableCellEditor metaDataEditor = new MirthComboBoxTableCellEditor(metaDataSearchTable, metaDataNames, 1, false, null); metaDataEditor.getComboBox().setAutoResizeDropdown(true); TableColumn metaDataColumn = metaDataSearchTable.getColumnModel().getColumn(0); metaDataColumn.setCellRenderer(new MirthComboBoxTableCellRenderer(metaDataNames)); metaDataColumn.setCellEditor(metaDataEditor); metaDataColumn.setMinWidth(METADATA_NAME_COLUMN_WIDTH); metaDataColumn.setMaxWidth(METADATA_NAME_COLUMN_WIDTH * 2); metaDataColumn.setPreferredWidth(METADATA_NAME_COLUMN_WIDTH); // Need to create this custom editor since the combo box values are dynamic based on metadata column type. MirthComboBoxTableCellEditor operatorEditor = new MirthComboBoxTableCellEditor(metaDataSearchTable, MetaDataSearchOperator.values(), 1, false, null) { public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { MetaDataColumn metaDataColumn = cachedMetaDataColumns.get(table.getValueAt(row, 0)); comboBox.setModel(new DefaultComboBoxModel( MetaDataSearchOperator.valuesForColumnType(metaDataColumn.getType()))); return super.getTableCellEditorComponent(table, value, isSelected, row, column); } }; TableColumn operatorColumn = metaDataSearchTable.getColumnModel().getColumn(1); operatorColumn.setCellRenderer(new MirthComboBoxTableCellRenderer(MetaDataSearchOperator.values())); operatorColumn.setCellEditor(operatorEditor); operatorColumn.setMinWidth(METADATA_OPERATOR_COLUMN_WIDTH); operatorColumn.setMaxWidth(METADATA_OPERATOR_COLUMN_WIDTH); TableColumn caseColumn = metaDataSearchTable.getColumnModel().getColumn(3); caseColumn.setMinWidth(METADATA_CASE_COLUMN_WIDTH); caseColumn.setMaxWidth(METADATA_CASE_COLUMN_WIDTH); deleteMetaDataSearchButton.setEnabled(false); }
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. co m*/ 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.sec.ose.osi.ui.frm.main.identification.codematch.table.JTableInfoForCMFile.java
synchronized public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) { JComponent comp = (JComponent) super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);//from w w w .j a va 2 s. co m if (value == null) { comp.setToolTipText(null); return comp; } comp.setToolTipText(String.valueOf(value)); if (row >= table.getRowCount()) { log.debug("row > table.getRowCount()"); return comp; } switch (column) { case TableModelForCMFile.COL_COMPONENT_NAME: case TableModelForCMFile.COL_LICENSE_NAME: setHorizontalAlignment(SwingConstants.LEFT); break; case TableModelForCMFile.COL_VERSION_NAME: case TableModelForCMFile.COL_USAGE: case TableModelForCMFile.COL_STATUS: case TableModelForCMFile.COL_PERCENTAGE: case TableModelForCMFile.COL_MATCHED_FILE: setHorizontalAlignment(SwingConstants.CENTER); break; } if (table.getValueAt(row, TableModelForCMFile.COL_STATUS) == null) return comp; String status = table.getValueAt(row, TableModelForCMFile.COL_STATUS).toString(); String licenseName = table.getValueAt(row, TableModelForCMFile.COL_LICENSE_NAME).toString(); if (status.equals(AbstractMatchInfo.IDENTIFIED)) { comp.setFont(new Font("Arial", Font.BOLD | Font.ITALIC, 12)); comp.setForeground(NORMAL_COLOR); } else if ((status.equals(AbstractMatchInfo.REJECTED)) || (status.equals(AbstractMatchInfo.DECLARED))) { comp.setForeground(new Color(150, 150, 150)); } else if (status.equals(AbstractMatchInfo.PENDING)) { if (identifiedStringSearchLicense != null && !identifiedStringSearchLicense.equals("")) { String currentRowLicense = "" + licenseName; if (identifiedStringSearchLicense.equals(currentRowLicense)) { comp.setForeground(NORMAL_COLOR); } else { comp.setForeground(GRAY_COLOR); } } else { comp.setForeground(NORMAL_COLOR); } } return comp; }
From source file:edu.ucla.stat.SOCR.chart.SuperHistogramChart.java
/** * reset dataTable to default (demo data), and refesh chart *//*from w w w . jav a 2 s . co m*/ public void resetExample() { reset_BinSlider(); IntervalXYDataset dataset = createDataset(true); JFreeChart chart = createChart(dataset); chartPanel = new ChartPanel(chart, false); setChart(); hasExample = true; convertor.Y2Table(raw_x, row_count); //convertor.dataset2Table(dataset); 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++) { dataTable.setValueAt(tempDataTable.getValueAt(i, j), i, j); } dataPanel.removeAll(); dataPanel.add(new JScrollPane(dataTable)); dataTable.setGridColor(Color.gray); dataTable.setShowGrid(true); dataTable.doLayout(); // this is a fix for the BAD SGI Java VM - not up to date as of dec. 22, 2003 try { dataTable.setDragEnabled(true); } catch (Exception e) { } dataPanel.validate(); // do the mapping setMapping(); updateStatus(url); }
From source file:edu.ucla.stat.SOCR.chart.SuperPieChart.java
/** * reset dataTable to default (demo data), and refesh chart *//* ww w . ja va2s.c o m*/ public void resetExample() { isDemo = true; dataset = createDataset(true); JFreeChart chart = createChart(dataset); chartPanel = new ChartPanel(chart, false); setChart(); hasExample = true; if (!ThreeDPie) convertor.dataset2Table(dataset, pulloutFlag); else convertor.dataset2Table(dataset); JTable tempDataTable = convertor.getTable(); // resetTable(); resetTableRows(tempDataTable.getRowCount() + 1); resetTableColumns(tempDataTable.getColumnCount() + 1); 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++) { dataTable.setValueAt(tempDataTable.getValueAt(i, j), i, j); //System.out.println("setting dataTable :"+tempDataTable.getValueAt(i,j)); } dataPanel.removeAll(); dataPanel.add(new JScrollPane(dataTable)); dataTable.setGridColor(Color.gray); dataTable.setShowGrid(true); dataTable.doLayout(); // this is a fix for the BAD SGI Java VM - not up to date as of dec. 22, 2003 try { dataTable.setDragEnabled(true); } catch (Exception e) { } dataPanel.validate(); // do the mapping setMapping(); updateStatus(url); }
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); }// w w w. ja v a2 s .co 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; }