List of usage examples for javax.swing JTable getValueAt
public Object getValueAt(int row, int column)
row
and column
. From source file:com.smanempat.controller.ControllerEvaluation.java
private double[][] getTestvalue(int rowCountTest, JTable tableDataSetTesting) { double[][] returnValue = new double[rowCountTest][3]; //System.out.println("Ini Data Set Testing"); for (int i = 0; i < rowCountTest; i++) { returnValue[i][0] = Double.parseDouble(tableDataSetTesting.getValueAt(i, 2).toString()); returnValue[i][1] = Double.parseDouble(tableDataSetTesting.getValueAt(i, 7).toString()); returnValue[i][2] = Double.parseDouble(tableDataSetTesting.getValueAt(i, 9).toString()); }//from ww w . j ava2 s .com // System.out.println("======================================"); return returnValue; }
From source file:com.smanempat.controller.ControllerEvaluation.java
private String[][] getModelValue(int rowCountModel, JTable tableDataSetModel) { String[][] returnValue = new String[rowCountModel][4]; //System.out.println(tableModelDataSet1.getValueAt(0, 2)); // System.out.println("Ini Data Set Model"); for (int i = 0; i < rowCountModel; i++) { returnValue[i][0] = tableDataSetModel.getValueAt(i, 2).toString(); returnValue[i][1] = tableDataSetModel.getValueAt(i, 7).toString(); returnValue[i][2] = tableDataSetModel.getValueAt(i, 9).toString(); returnValue[i][3] = tableDataSetModel.getValueAt(i, 10).toString(); }//from w ww .ja va2s . c om /// System.out.println("======================================"); return returnValue; }
From source file:edu.ucla.stat.SOCR.chart.demo.EventFrequencyDemo1.java
public void resetExample() { dataset = createDataset(true);//from w ww. j a v a 2 s . c o m JFreeChart chart = createChart(dataset); chartPanel = new ChartPanel(chart, false); // setSummary(dataset); setChart(); hasExample = true; convertor.dataset2Table(dataset); JTable tempDataTable = convertor.getTable(); 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)); DecimalFormat f = new DecimalFormat("#.#E0"); for (int i = 0; i < tempDataTable.getRowCount(); i++) for (int j = 0; j < tempDataTable.getColumnCount(); j++) { if (j != 0) { try { long time = f.parse((String) tempDataTable.getValueAt(i, j)).longValue(); Date date = new Date(time); dataTable.setValueAt(new Day(date).toString(), i, j); } catch (ParseException e) { dataTable.setValueAt("NaN", i, j); } } else 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 addButtonDependent(); int columnCount = dataset.getColumnCount(); for (int i = 0; i < columnCount; i++) addButtonIndependent(); updateStatus(url); }
From source file:edu.ucla.stat.SOCR.chart.SuperXYChart_QQ_DD.java
/** * reset dataTable to default (demo data), and refesh chart *///from ww w . java 2 s . c o m public void resetExample() { XYDataset dataset = createDataset(true); JFreeChart chart = createChart(dataset); chartPanel = new ChartPanel(chart, false); setChart(); hasExample = true; convertor.XY2Table(raw_x, raw_y, larger_row_count); 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)); columnModel.getColumn(i).setHeaderValue("Group " + (i + 1)); } 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.demo.PowerTransformQQNormalPlotChart.java
protected void setTable(XYDataset ds) { convertor.data2Table(raw_y, transformed_x, "Data", "Transformed Data", row_count); //convertor.dataset2Table(dataset); JTable tempDataTable = convertor.getTable(); resetTableRows(tempDataTable.getRowCount()); 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)); }//ww w .j a va2s . com 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(); JScrollPane dt = new JScrollPane(dataTable); dataPanel.add(dt); dt.setRowHeaderView(headerTable); 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 dt2 = new JScrollPane(dataTable); dt2.setPreferredSize(new Dimension(CHART_SIZE_X / 3, CHART_SIZE_Y * 3 / 8)); dt2.setRowHeaderView(headerTable); dataPanel2.add(dt2); 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:edu.ucla.stat.SOCR.chart.SuperYIntervalChart.java
/** * reset dataTable to default (demo data), and refesh chart */// w w w.ja va2s .c o m public void resetExample() { isDemo = true; dataset = createDataset(isDemo); JFreeChart chart = createChart(dataset); chartPanel = new ChartPanel(chart, false); setChart(); hasExample = true; convertor.YIntervalDataset2Table(dataset); JTable tempDataTable = convertor.getTable(); resetTableRows(tempDataTable.getRowCount()); 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); // 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.SuperCategoryChart_vertical.java
/** * reset dataTable to default (demo data), and refesh chart */// www . j a va 2s . c o m public void resetExample() { dataset = createDataset(true); JFreeChart chart = createChart(dataset); chartPanel = new ChartPanel(chart, false); setChart(); hasExample = true; convertor.dataset2Table_vertical(dataset); JTable tempDataTable = convertor.getTable(); resetTableRows(tempDataTable.getRowCount()); 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.SuperIntervalXYChart.java
/** * reset dataTable to default (demo data), and refesh chart *///from w w w . j a v a 2 s. c o m public void resetExample() { isDemo = true; IntervalXYDataset dataset = createDataset(isDemo); JFreeChart chart = createChart(dataset); chartPanel = new ChartPanel(chart, false); setChart(); hasExample = true; convertor.dataset2Table(dataset); JTable tempDataTable = convertor.getTable(); int seriesCount = tempDataTable.getColumnCount() / 2; resetTableRows(tempDataTable.getRowCount() + 1); resetTableColumns(seriesCount * 2); for (int i = 0; i < seriesCount * 2; 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); // 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(); setMapping(); updateStatus(url); }
From source file:com.smanempat.controller.ControllerClassification.java
public void convertToExcel(JTable tableResult, File fileToSave) throws FileNotFoundException, IOException { XSSFWorkbook workBook = new XSSFWorkbook(); XSSFSheet sheet = workBook.createSheet(); XSSFRow row;/* www. j a va 2 s .c om*/ int rowCountData = tableResult.getRowCount(); Map<Integer, Object[]> data = new HashMap<Integer, Object[]>(); data.put(1, new Object[] { "NIS", "NAMA", "JK", "UN", "PT BINDO", "PT MTK", "PT BING", "PT IPA", "MINAT", "JURUSAN" }); for (int i = 0; i < rowCountData; i++) { // System.out.println(tableResult.getValueAt(i, 1)); data.put((i + 2), new Object[] { tableResult.getValueAt(i, 0), tableResult.getValueAt(i, 1), tableResult.getValueAt(i, 2), tableResult.getValueAt(i, 3), tableResult.getValueAt(i, 4), tableResult.getValueAt(i, 5), tableResult.getValueAt(i, 6), tableResult.getValueAt(i, 7), tableResult.getValueAt(i, 8), tableResult.getValueAt(i, 9) }); } //System.out.println("KeySet " + data.keySet()); Set<Integer> keyID = data.keySet(); int rowID = 0; for (Integer key : keyID) { row = sheet.createRow(rowID); Object[] tempData = data.get(key); rowID++; int cellID = 0; for (Object obj : tempData) { Cell cell = row.createCell(cellID); cell.setCellValue(obj.toString()); cellID++; } } FileOutputStream out = new FileOutputStream(fileToSave); workBook.write(out); out.close(); System.out.println(fileToSave + " Berhasil disimpan"); }
From source file:edu.ucla.stat.SOCR.chart.SuperYIntervalChartA.java
/** * reset dataTable to default (demo data), and refesh chart *//* w w w . j a v a2 s . c om*/ public void resetExample() { isDemo = true; dataset = createDataset(isDemo); JFreeChart chart = createChart(dataset); chartPanel = new ChartPanel(chart, false); setChart(); hasExample = true; convertor.YIntervalDataset2TableA(dataset); JTable tempDataTable = convertor.getTable(); resetTableRows(tempDataTable.getRowCount()); 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); // 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); }