Java 8 DefaultTableColumnModel - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 DefaultTableColumnModel class.

This code example shows how to use the following methods:addColumn
 
	public static void initializeTable(JTable table)
	{ 
		table.setAutoCreateColumnsFromModel(false);
		JTableHeader header = table.getTableHeader();
		TableColumnModel columns = new DefaultTableColumnModel();
		TableCellRenderer headerRenderer = header.getDefaultRenderer();
		columns.addColumn(Utilities.createTableColumn(0, "in_level", headerRenderer, false));
		columns.addColumn(Utilities.createTableColumn(1, "in_class", headerRenderer, true));
		TableColumn remainCol = Utilities.createTableColumn(2, "in_iskRemain", headerRenderer, false);
		remainCol.setCellRenderer(new BoldNumberRenderer());
		columns.addColumn(remainCol);
		columns.addColumn(Utilities.createTableColumn(3, "in_gained", headerRenderer, false));
		table.setDefaultRenderer(Integer.class,
			new TableCellUtilities.AlignRenderer(SwingConstants.CENTER));
		table.setColumnModel(columns);
		table.setFocusable(false);
		header.setReorderingAllowed(false);
		header.setResizingAllowed(false);
	} 
 
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:addColumn
        dialog.dispose();
    } 
 
    @Test
    public void testTableHeaderExists() throws Exception {
        TableColumnModel model = new DefaultTableColumnModel();
        TableColumn column = new TableColumn(0);
        column.setIdentifier("header_name");
        model.addColumn(column);
        JTableHeader tableHeader = new JTableHeader(model);
        MTableHeaderItem header = new MTableHeaderItem(tableHeader, "table_name", "header_name", null, WindowMonitor.getInstance());
        assertEquals("header_name", header.getText());
    } 
 
    @Test
    public void testClick() { 
        MTableHeaderItem mheader = new MTableHeaderItem(dialog.getTable().getTableHeader(), "table.name.header", "col2", null,
                WindowMonitor.getInstance()); 
        mheader.click(1, false);
        assertEquals(result, "col2");
5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:addColumn
    public void setStarTable( StarTable startable, boolean rowHeader ) {
        setModel( new StarTableModel( startable, rowHeader ) );
        this.startable = startable;
 
        /* Set up the column and column model. */ 
        TableColumnModel tcm = new DefaultTableColumnModel();
        int jcol = 0;
 
        /* Construct a dummy column for the index entries if required. */ 
        if ( rowHeader ) {
            ColumnInfo rhColInfo = new ColumnInfo( new DefaultValueInfo(
                "Index", Integer.class, "Row index" ) );
            TableColumn rhcol = new StarTableColumn( rhColInfo, jcol++ );
            rhcol.setCellRenderer( getRowHeaderRenderer() );
            tcm.addColumn( rhcol );
        } 
 
        /* Construct proper columns for the entries from the StarTable. */ 
        for ( int icol = 0; icol < startable.getColumnCount(); icol++ ) {
            ColumnInfo cinfo = startable.getColumnInfo( icol );

5
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
See Code Examples for Java 8 DefaultTableColumnModel Methods: