Results 1 to 3 of 3

Thread: Anyone can give me a tips using richclient table component?

  1. #1
    Join Date
    Aug 2004
    Location
    ChengDu,China
    Posts
    3

    Default Anyone can give me a tips using richclient table component?

    Hi all!

    I am confusing to how to code this using richclient table component,give a table sample.

    thinks.

  2. #2
    Join Date
    Aug 2004
    Location
    Melbourne, FL
    Posts
    2,794

    Default

    The simplest method to call, assuming you don't mind working with a standard JTable, is TableUtils.createStandardSortableTable(tableModel) . Just define a table model adapter for your data, and pass it in as a parameter to this method. You'll get back a fully multi-column sortable table with default renderers installed for common column types. See the BaseTableModel/BeanTableModel classes for convenient table model superclasses.

    Code:
    public static JTable createStandardSortableTable(TableModel tableModel) {
            JTable table = new JTable();
            ShuttleSortableTableModel sortedModel = new ShuttleSortableTableModel(
                    tableModel);
            table.setAutoCreateColumnsFromModel(true);
            table.setModel(sortedModel);
            table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
            installDefaultRenderers(table);
            TableSortIndicator sortIndicator = new TableSortIndicator(table);
            new SortTableCommand(table, sortIndicator.getColumnSortList());
            sizeColumnsToFitRowData(table);
            return table;
        }

  3. #3
    Join Date
    Aug 2004
    Location
    Whitehorse, YT, Canada
    Posts
    26

    Default

    I implemented a JTable using the method Keith describes above, only to spend some time trying to figure out why my Boolean would not render as a JCheckBox. That method also overrides the default renderers with ones defined in Spring-RCP. As for my case of trying to get Boolean as a JCheckBox, the Spring-RCP BooleanTableCellRenderer extends DefaultTableCellRenderer (by way of OptimizedTableCellRenderer), which is a JLabel.

Similar Threads

  1. Table Cell Renderers
    By benoitx in forum Swing
    Replies: 7
    Last Post: Sep 29th, 2005, 09:32 AM
  2. Replies: 4
    Last Post: Sep 27th, 2005, 11:31 PM
  3. Strange Data Access Error
    By webifyit in forum Data
    Replies: 2
    Last Post: Dec 28th, 2004, 11:06 AM
  4. Table framework filtering -first cut
    By snpe in forum Swing
    Replies: 2
    Last Post: Nov 15th, 2004, 12:17 AM
  5. shared buisness component.
    By djeang in forum Architecture
    Replies: 1
    Last Post: Oct 25th, 2004, 03:38 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •