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:ru.codemine.pos.ui.salespanel.modules.ChequeSetupPanel.java

public void init() {
    newCheque();/*from w ww .jav  a 2  s . co m*/

    TableColumnModel columnModel = table.getColumnModel();
    columnModel.getColumn(0).setPreferredWidth(50);
    columnModel.getColumn(1).setMinWidth(300);
    columnModel.getColumn(2).setPreferredWidth(100);
    columnModel.getColumn(3).setPreferredWidth(100);
    columnModel.getColumn(4).setPreferredWidth(100);
}

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

public void setYLabel(String yLabel) {
    rangeLabel = yLabel;//from   w  ww  .j a v  a 2s  . c  o  m
    TableColumnModel columnModel = dataTable.getColumnModel();
    columnModel.getColumn(1).setHeaderValue("StdDev");
    dataTable.setTableHeader(new EditableHeader(columnModel));
}

From source file:ru.codemine.pos.ui.windows.products.ProductsListWindow.java

@Override
public void showWindow() {
    List<Product> products = productService.getAll();

    tableModel = new ProductCatalogTableModel(products);
    table.setModel(tableModel);/*from w  ww  .j av  a  2  s . c o  m*/

    TableColumnModel columnModel = table.getColumnModel();
    columnModel.getColumn(0).setMaxWidth(10);
    columnModel.getColumn(1).setMaxWidth(10);

    if (!actionListenersInit)
        setupActionListeners();

    statusLabel.setText(" " + products.size() + " ?");

    setupSorter();
    setVisible(true);
}

From source file:ru.codemine.pos.ui.windows.devices.kkm.KkmListWindow.java

@Override
public void showWindow() {
    List<KkmDevice> kkms = kkmService.getAllKkmDevices();

    tableModel.setKkmDevices(kkms);//from  w ww .  java  2  s. c o  m
    table.setModel(tableModel);

    TableColumnModel columnModel = table.getColumnModel();
    columnModel.getColumn(0).setMaxWidth(10);
    columnModel.getColumn(1).setMaxWidth(10);
    columnModel.getColumn(2).setMaxWidth(50);

    if (!actionListenersInit)
        setupActionListeners();

    statusLabel.setText(" " + kkms.size() + " ?");

    setupSorter();
    setVisible(true);

}

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

public void setXLabel(String xLabel) {

    domainLabel = xLabel;//from w  w  w . j  a  v  a  2  s  .com

    TableColumnModel columnModel = dataTable.getColumnModel();
    columnModel.getColumn(0).setHeaderValue("Mean");
    dataTable.setTableHeader(new EditableHeader(columnModel));
}

From source file:PropertyTable.java

/**
 * This constructor method specifies what data the table will display (the
 * table model) and uses the TableColumnModel to customize the way that the
 * table displays it. The hard work is done by the TableModel implementation
 * below./*from   w  w  w.ja  va  2s. co m*/
 */
public PropertyTable(Class beanClass) {
    // Set the data model for this table
    try {
        setModel(new JavaBeanPropertyTableModel(beanClass));
    } catch (IntrospectionException e) {
        System.err.println("WARNING: can't introspect: " + beanClass);
    }

    // Tweak the appearance of the table by manipulating its column model
    TableColumnModel colmodel = getColumnModel();

    // Set column widths
    colmodel.getColumn(0).setPreferredWidth(125);
    colmodel.getColumn(1).setPreferredWidth(200);
    colmodel.getColumn(2).setPreferredWidth(75);
    colmodel.getColumn(3).setPreferredWidth(50);

    // Right justify the text in the first column
    TableColumn namecol = colmodel.getColumn(0);
    DefaultTableCellRenderer renderer = new DefaultTableCellRenderer();
    renderer.setHorizontalAlignment(SwingConstants.RIGHT);
    namecol.setCellRenderer(renderer);
}

From source file:org.jfree.chart.demo.selection.SelectionDemo2.java

/**
 * A demonstration application showing a scatter plot.
 *
 * @param title  the frame title./*from  w w  w. ja va  2s . c  om*/
 */
public SelectionDemo2(String title) {
    super(title);
    ChartPanel chartPanel = (ChartPanel) createDemoPanel();
    chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));

    JFreeChart chart = chartPanel.getChart();
    XYPlot plot = (XYPlot) chart.getPlot();
    this.dataset = (XYSeriesCollection) plot.getDataset();
    JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    split.add(chartPanel);

    this.model = new DefaultTableModel(new String[] { "Series:", "Item:", "X:", "Y:" }, 0);
    this.table = new JTable(this.model);
    TableColumnModel tcm = this.table.getColumnModel();
    tcm.getColumn(2).setCellRenderer(new NumberCellRenderer());
    tcm.getColumn(3).setCellRenderer(new NumberCellRenderer());
    JPanel p = new JPanel(new BorderLayout());
    JScrollPane scroller = new JScrollPane(this.table);
    p.add(scroller);
    p.setBorder(BorderFactory.createCompoundBorder(new TitledBorder("Selected Items: "),
            new EmptyBorder(4, 4, 4, 4)));
    split.add(p);
    setContentPane(split);
}

From source file:ru.codemine.pos.ui.windows.document.cheque.ChequeWindow.java

@Override
public void showWindow(Cheque cheque) {
    if (!actionListenersInit)
        setupActionListeners();//ww  w.ja v a  2s .  c om

    idField.setText(cheque.getId() == null ? "" : cheque.getId().toString());
    workdayField.setText("" + cheque.getWorkday().getId().toString() + "  "
            + cheque.getWorkday().getOpenTime().toString("dd.MM.YY HH:mm"));

    creationTimeField.setDate(cheque.getCreationTime().toDate());
    documentTimeField.setDate(cheque.getDocumentTime().toDate());
    creatorField.setText(cheque.getCreator().getUsername());
    ptypeComboBox.removeAllItems();
    ptypeComboBox.addItem(cheque.getPaymentTypeString());
    totalField.setText(cheque.getChequeTotal().toString());

    tableModel = new ChequeContentTableModel(cheque);
    contentTable.setModel(tableModel);
    TableColumnModel columnModel = contentTable.getColumnModel();
    columnModel.getColumn(0).setMaxWidth(10);

    setVisible(true);

}

From source file:ru.codemine.pos.ui.windows.document.startbalances.StartBalancesListWindow.java

public void showWindow(List<StartBalance> startBalances) {
    tableModel = new StartBalancesListTableModel(startBalances);
    table.setModel(tableModel);/*from   w  w  w  . j  a va  2s  . com*/

    TableColumnModel columnModel = table.getColumnModel();
    columnModel.getColumn(0).setMaxWidth(10);
    columnModel.getColumn(1).setMaxWidth(50);

    if (!actionListenersInit)
        setupActionListeners();

    statusLabel.setText(" " + startBalances.size() + " ?");

    setupSorter();
    setVisible(true);
}

From source file:org.jfree.chart.demo.selection.SelectionDemo3.java

/**
 * A demonstration application showing a scatter plot.
 *
 * @param title  the frame title.//from  w  w  w .ja v a  2  s  . c o m
 */
public SelectionDemo3(String title) {
    super(title);
    ChartPanel chartPanel = (ChartPanel) createDemoPanel();
    chartPanel.setPreferredSize(new java.awt.Dimension(500, 270));

    JFreeChart chart = chartPanel.getChart();
    XYPlot plot = (XYPlot) chart.getPlot();
    this.dataset = (XYSeriesCollection) plot.getDataset();
    JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    split.add(chartPanel);

    this.model = new DefaultTableModel(new String[] { "Series:", "Item:", "X:", "Y:" }, 0);
    this.table = new JTable(this.model);
    TableColumnModel tcm = this.table.getColumnModel();
    tcm.getColumn(2).setCellRenderer(new NumberCellRenderer());
    tcm.getColumn(3).setCellRenderer(new NumberCellRenderer());
    JPanel p = new JPanel(new BorderLayout());
    JScrollPane scroller = new JScrollPane(this.table);
    p.add(scroller);
    p.setBorder(BorderFactory.createCompoundBorder(new TitledBorder("Selected Items: "),
            new EmptyBorder(4, 4, 4, 4)));
    split.add(p);
    setContentPane(split);
}