Java 8 TableColumn - 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 TableColumn class.

This code example shows how to use the following methods:getHeaderRenderer, getHeaderValue, getModelIndex, setMaxWidth, setPreferredWidth
     * @param column to be resized 
     * @param table containing the column 
     */ 
    public static void fixSize(TableColumn column, JTable table) {
        TableCellRenderer rndr;
        rndr = column.getHeaderRenderer();
        if (rndr == null){
            rndr = table.getTableHeader().getDefaultRenderer();
        } 
        Component c = rndr.getTableCellRendererComponent(
                table, column.getHeaderValue(), false, false, -1, column.getModelIndex());
        int width = c.getPreferredSize().width+10;
        column.setMaxWidth(width);
        column.setPreferredWidth(width);
        column.setResizable(false);        
    } 
     
    /** 
     * Create a GUI component JLabel + JComboBox with a left and right margin (5px) 
     * @param label 
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setCellRenderer, setHeaderValue, setPreferredWidth, setResizable, setWidth
public class ChangesetCacheTableColumnModel extends DefaultTableColumnModel {
 
    private final ChangesetCacheTableCellRenderer renderer = new ChangesetCacheTableCellRenderer();
     
    protected void createColumn(int modelIndex, String headerValue, int preferredWidth, int width) {
        TableColumn col = new TableColumn(modelIndex);
        col.setHeaderValue(headerValue);
        col.setResizable(true);
        if (width > -1) {
            col.setWidth(width);
        } 
        col.setPreferredWidth(preferredWidth);
        col.setCellRenderer(renderer);
        addColumn(col);
    } 
     
    protected void createColumns() { 
 
        // column 0 - Id 
        createColumn(0, tr("ID"), 20, 20); 
7
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setCellRenderer, setHeaderValue, setPreferredWidth, setResizable
        col.setPreferredWidth(300);
        col.setCellRenderer(new MemberTableMemberCellRenderer());
        addColumn(col);
 
        // column 2 - 
        col = new TableColumn(2);
        col.setHeaderValue("");
        col.setResizable(false);
        col.setPreferredWidth(20);
        col.setCellRenderer(new MemberTableLinkedCellRenderer());
        addColumn(col);
    } 
} 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setCellRenderer, setHeaderValue, setPreferredWidth, setResizable
    public void cleanUp(final RepositoryEntry entry, final Repository repository) {
    } 
 
    public TableColumn getTableColumn() {
        if(_fileNameColumn == null) {
            _fileNameColumn = new TableColumn();
            _fileNameColumn.setHeaderValue("File Name");
            _fileNameColumn.setPreferredWidth(200);
            _fileNameColumn.setResizable(true);
            _fileNameColumn.setCellRenderer(new FileNameCellRenderer());
        } 
        return _fileNameColumn;
    } 
 
    private static class FileNameCellRenderer extends DefaultTableCellRenderer {
 
        @Override 
        public Component getTableCellRendererComponent(final JTable table,
                                                       final Object value, 
                                                       final boolean isSelected,
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getHeaderValue, setCellRenderer, setHeaderValue
			col.setHeaderValue(DEFAULT_COLUMN_NAME_REMOTE_ADDR);
			col.setCellRenderer(new RemoteAddrRenderer());
			tableColumns.put(col.getHeaderValue(), col);
		} 
		{ 
			TableColumn col = new TableColumn(0);
			col.setHeaderValue(DEFAULT_COLUMN_NAME_APPLICATIION);
			col.setCellRenderer(new ApplicationRenderer());
			tableColumns.put(col.getHeaderValue(), col);
		} 
/* 
		{ 
			TableColumn col = new TableColumn(0); 
			col.setHeaderValue(DEFAULT_COLUMN_NAME_CONTEXT); 
			col.setCellRenderer(new ContextRenderer()); 
			tableColumns.put(col.getHeaderValue(), col); 
		} 
*/ 
		{ 
			TableColumn col = new TableColumn(0);
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:getHeaderValue, setCellRenderer, setHeaderValue
			col.setHeaderValue(DEFAULT_COLUMN_NAME_NDC);
			col.setCellRenderer(new NdcRenderer());
			tableColumns.put(col.getHeaderValue(), col);
		} 
		{ 
			TableColumn col = new TableColumn(0);
			col.setHeaderValue(DEFAULT_COLUMN_NAME_APPLICATIION);
			col.setCellRenderer(new ApplicationRenderer());
			tableColumns.put(col.getHeaderValue(), col);
		} 
		{ 
			TableColumn col = new TableColumn(0);
			col.setHeaderValue(DEFAULT_COLUMN_NAME_CONTEXT);
			col.setCellRenderer(new ContextRenderer());
			tableColumns.put(col.getHeaderValue(), col);
		} 
		{ 
			TableColumn col = new TableColumn(0);
			col.setHeaderValue(DEFAULT_COLUMN_NAME_SOURCE);
			col.setCellRenderer(new SourceRenderer());
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:addPropertyChangeListener, getHeaderValue, setPreferredWidth
            } 
        } 
    } 
     
    private void addColumn(TableColumn tc) {
        String name = String.valueOf(tc.getHeaderValue());
        String preferredWidth = Preferences.getPreference(_key + "." + name + ".width");
        if (preferredWidth != null) {
            try { 
                int width = Integer.parseInt(preferredWidth);
                tc.setPreferredWidth(width);
            } catch (NumberFormatException nfe) {}
        } 
        tc.addPropertyChangeListener(this);
    } 
     
    public void columnAdded(TableColumnModelEvent e) {
        int index = e.getToIndex();
        TableColumnModel tcm = (TableColumnModel) e.getSource();
        TableColumn tc = tcm.getColumn(index);
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:
    public DataSheet() { 
        super(new BorderLayout());
        table = new DataTable();
        table.setAutoCreateRowSorter(true);
        table.setAutoResizeMode(JTable.AUTO_RESIZE_OFF);
        table.addColumn(new TableColumn(0));
        tableModel = new DataTableModel();
        table.setModel(tableModel);
        JScrollPane tableScroll = new JScrollPane(table);
        tableScroll.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
        add(tableScroll, BorderLayout.CENTER);
    } 
 
    public void setOutputValues(List<?> objects) {
        tableModel.setOutputValues(objects);
        table.setModel(tableModel);
    } 
 
    // Optimization techniques based on "Christmas Tree" article: 
    // http://java.sun.com/products/jfc/tsc/articles/ChristmasTree/ 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setCellRenderer, setHeaderValue
	public LoggingLevelColumnModel() 
	{ 
		super(); 
 
		{ 
			TableColumn col = new TableColumn(0);
			col.setHeaderValue(DEFAULT_COLUMN_NAME_INDEX);
			col.setCellRenderer(new IndexRenderer());
			addColumn(col);
		} 
 
		{ 
			TableColumn col = new TableColumn(0);
			col.setHeaderValue(DEFAULT_COLUMN_NAME_PREVIEW);
			previewRenderer = new LoggingLevelPreviewRenderer();
			col.setCellRenderer(previewRenderer);
			addColumn(col);
		} 
	} 
 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
This code example shows how to use the following methods:setCellRenderer, setHeaderValue
			col.setCellRenderer(new IndexRenderer());
			addColumn(col);
		} 
 
		{ 
			TableColumn col = new TableColumn(0);
			col.setHeaderValue(DEFAULT_COLUMN_NAME_PREVIEW);
			previewRenderer = new AccessStatusTypePreviewRenderer();
			col.setCellRenderer(previewRenderer);
			addColumn(col);
		} 
	} 
 
	public Map<HttpStatus.Type, ColorScheme> getSchemes()
	{ 
		return previewRenderer.getSchemes();
	} 
 
	public void setSchemes(Map<HttpStatus.Type, ColorScheme> schemes)
	{ 
6
CodeRank
Connect your IDE to all the code out there  Get Codota for Java
See Code Examples for Java 8 TableColumn Methods: