Example usage for javax.swing.table TableColumnModel getColumn

List of usage examples for javax.swing.table TableColumnModel getColumn

Introduction

In this page you can find the example usage for javax.swing.table TableColumnModel getColumn.

Prototype

public TableColumn getColumn(int columnIndex);

Source Link

Document

Returns the TableColumn object for the column at columnIndex.

Usage

From source file:edu.ucla.stat.SOCR.chart.SuperCategoryChart.java

public void setYLabel(String yLabel) {
    rangeLabel = yLabel;//from w  ww.  j a  va2  s  .  c  o m
    TableColumnModel columnModel = dataTable.getColumnModel();
    columnModel.getColumn(0).setHeaderValue("Series");
}

From source file:edu.ucla.stat.SOCR.chart.SuperXYChart_QQ_DD.java

public void setDataTable(String input) {
    hasExample = true;/*from w ww  .  j a  va 2s. co  m*/
    StringTokenizer lnTkns = new StringTokenizer(input, "#");
    String line;
    int lineCt = lnTkns.countTokens();
    resetTableRows(0);
    resetTableColumns(lineCt);
    int r = 0;
    while (lnTkns.hasMoreTokens()) {
        line = lnTkns.nextToken();

        //   String tb[] =line.split("\t");
        StringTokenizer cTkns = new StringTokenizer(line, ";");

        if (r == 0) {
            domainLabel = cTkns.nextToken();
        }
        if (r == 1) {
            rangeLabel = cTkns.nextToken();
        }

        StringTokenizer cellTkns = new StringTokenizer(cTkns.nextToken(), ",");
        int cellCnt = cellTkns.countTokens();
        String tb[] = new String[cellCnt];
        int r1 = 0;
        while (cellTkns.hasMoreTokens()) {
            tb[r1] = cellTkns.nextToken();
            r1++;
        }
        //System.out.println("tb.length="+tb.length);

        int colCt = tb.length;
        //   System.out.println("rowCount="+dataTable.getRowCount()+" input count="+colCt);
        if (dataTable.getRowCount() < colCt)
            resetTableRows(colCt);
        for (int i = 0; i < tb.length; i++) {
            dataTable.setValueAt(tb[i], i, r);
        }
        r++;
    }

    // this will update the mapping panel     
    resetTableColumns(dataTable.getColumnCount());
    TableColumnModel columnModel = dataTable.getColumnModel();
    columnModel.getColumn(0).setHeaderValue(domainLabel);
    columnModel.getColumn(1).setHeaderValue(rangeLabel);
}

From source file:edu.ucla.stat.SOCR.chart.SuperIntervalXYChart.java

public void setXLabel(String xLabel) {

    domainLabel = xLabel;//from w w  w. ja va2s  .c om
    TableColumnModel columnModel = dataTable.getColumnModel();
    for (int i = 0; i < columnModel.getColumnCount() / 2; i++)
        columnModel.getColumn(2 * i).setHeaderValue(xLabel + ":" + i);
    dataTable.setTableHeader(new EditableHeader(columnModel));
}

From source file:edu.ucla.stat.SOCR.chart.SuperIntervalXYChart.java

public void setYLabel(String yLabel) {
    rangeLabel = yLabel;/*from ww  w .j  a  va 2s. c o m*/
    TableColumnModel columnModel = dataTable.getColumnModel();
    for (int i = 0; i < columnModel.getColumnCount() / 2; i++)
        columnModel.getColumn(2 * i + 1).setHeaderValue(yLabel + ":" + i);
    dataTable.setTableHeader(new EditableHeader(columnModel));

}

From source file:edu.ucla.stat.SOCR.chart.SuperAreaChart_XY.java

public void setYLabel(String yLabel) {
    rangeLabel = yLabel;/*from w  ww .j a v  a 2s.  c  om*/
    TableColumnModel columnModel = dataTable.getColumnModel();
    for (int i = 0; i < columnModel.getColumnCount() / 2; i++)
        columnModel.getColumn(2 * i + 1).setHeaderValue(rangeLabel + i);
}

From source file:mod.steps.stepmode.threads.forms.TransitionsChooser.java

private void initializeTable() {

    // Load table model
    this.tableModel = new GeneralTableModel(listChoosenElement, areaTransitionsSet);
    this.tableTransitionsRepetitions.setModel(tableModel);

    TableColumnModel tcm = this.initializeComboboxColumn();

    // Set column widths
    tcm.getColumn(0).setPreferredWidth(320);
    tcm.getColumn(1).setPreferredWidth(120);

    // Set row heighht
    tableTransitionsRepetitions.setRowHeight(20);

    tableTransitionsRepetitions.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
    tableTransitionsRepetitions//from  w w  w  .  j a  v  a 2  s.co m
            .setPreferredScrollableViewportSize(tableTransitionsRepetitions.getPreferredSize());

}

From source file:edu.ucla.stat.SOCR.chart.SuperAreaChart_XY.java

public void setXLabel(String xLabel) {

    domainLabel = xLabel;/*from   w w  w .  j  a  v a2  s. com*/
    TableColumnModel columnModel = dataTable.getColumnModel();
    for (int i = 0; i < columnModel.getColumnCount() / 2; i++)
        columnModel.getColumn(2 * i).setHeaderValue(domainLabel + i);

    dataTable.setTableHeader(new EditableHeader(columnModel));
}

From source file:edu.ucla.stat.SOCR.chart.SuperCategoryChart_vertical.java

public void setYLabel(String yLabel) {
    rangeLabel = yLabel;//from w  w w .j a  v  a 2  s. co  m

    TableColumnModel columnModel = dataTable.getColumnModel();
    for (int i = 1; i < columnModel.getColumnCount(); i++)
        columnModel.getColumn(i).setHeaderValue("Case" + i);
}

From source file:org.hsh.bfr.db.gui.dbtable.editoren.MyChartDialog.java

private void initComponents() {
    // JFormDesigner - Component initialization - DO NOT MODIFY  //GEN-BEGIN:initComponents
    splitPane1 = new JSplitPane();
    scrollPane1 = new JScrollPane();
    table1 = new JTable();
    panel1 = new JPanel();
    button1 = new JButton();
    panel2 = new JPanel();
    button2 = new JButton();
    button3 = new JButton();
    button4 = new JButton();
    CellConstraints cc = new CellConstraints();

    //======== this ========
    setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE);
    Container contentPane = getContentPane();
    contentPane.setLayout(new FormLayout("default:grow", "2*(default, $lgap), default"));

    //======== splitPane1 ========
    {/*from  w  w  w  .  j  a va 2 s. c o m*/
        splitPane1.setDividerLocation(200);

        //======== scrollPane1 ========
        {
            scrollPane1.setPreferredSize(new Dimension(200, 423));

            //---- table1 ----
            table1.setModel(
                    new DefaultTableModel(
                            new Object[][] { { "3.0", "5" }, { null, null }, { null, null }, { null, null },
                                    { null, null }, { null, null }, { null, null }, { null, null },
                                    { null, null }, { null, null }, { null, null }, { null, null },
                                    { null, null }, { null, null }, { null, null }, { null, null },
                                    { null, null }, { null, null }, { null, null }, { null, null }, },
                            new String[] { "Zeit (h)", "Temperatur" }) {
                        /**
                         * 
                         */
                        private static final long serialVersionUID = 1L;
                        Class<?>[] columnTypes = new Class<?>[] { String.class, String.class };

                        @Override
                        public Class<?> getColumnClass(int columnIndex) {
                            return columnTypes[columnIndex];
                        }
                    });
            {
                TableColumnModel cm = table1.getColumnModel();
                cm.getColumn(0).setPreferredWidth(100);
            }
            scrollPane1.setViewportView(table1);
        }
        splitPane1.setLeftComponent(scrollPane1);

        //======== panel1 ========
        {
            panel1.setLayout(new FormLayout("default:grow", "fill:default:grow"));

            //---- button1 ----
            button1.setText("text");
            panel1.add(button1, cc.xy(1, 1));
        }
        splitPane1.setRightComponent(panel1);
    }
    contentPane.add(splitPane1, cc.xy(1, 1));

    //======== panel2 ========
    {
        panel2.setLayout(new FormLayout("3*(default:grow, $lcgap), default:grow", "default"));
        ((FormLayout) panel2.getLayout()).setColumnGroups(new int[][] { { 1, 3, 5, 7 } });

        //---- button2 ----
        button2.setText("OK");
        button2.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                button2ActionPerformed(e);
            }
        });
        panel2.add(button2, cc.xy(3, 1));

        //---- button3 ----
        button3.setText("Abbrechen");
        button3.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                button3ActionPerformed(e);
            }
        });
        panel2.add(button3, cc.xy(5, 1));

        //---- button4 ----
        button4.setText("Hilfe");
        button4.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                button4ActionPerformed(e);
            }
        });
        panel2.add(button4, cc.xy(7, 1));
    }
    contentPane.add(panel2, cc.xy(1, 5));
    setSize(555, 390);
    setLocationRelativeTo(null);
    // JFormDesigner - End of component initialization  //GEN-END:initComponents
}

From source file:edu.ucla.stat.SOCR.chart.SuperBoxAndWhiskerChart.java

public void setXLabel(String xLabel) {

    domainLabel = xLabel;//from  ww  w  .  j  av  a 2s.  co m
    TableColumnModel columnModel = dataTable.getColumnModel();
    columnModel.getColumn(0).setHeaderValue("Series");

    for (int i = 1; i < columnModel.getColumnCount(); i++)
        columnModel.getColumn(i).setHeaderValue(domainLabel + i);

    dataTable.setTableHeader(new EditableHeader(columnModel));
}