Package javax.swing.table

Examples of javax.swing.table.DefaultTableCellRenderer


        TableColumn column = paramTable.getColumnModel().getColumn(columnIndex);

        TableCellRenderer cellRenderer = column.getCellRenderer();

        if(cellRenderer == null) {
            cellRenderer = new DefaultTableCellRenderer();
        }

        for(int row = 0; row < paramTable.getModel().getRowCount(); row++) {
            Component rendererComponent = cellRenderer.getTableCellRendererComponent(paramTable,
                paramTable.getModel().getValueAt(row, columnIndex),
View Full Code Here


        table.getColumnModel().getColumn(1).setPreferredWidth(30);
        table.getColumnModel().getColumn(2).setPreferredWidth(50);
        table.getColumnModel().getColumn(3).setPreferredWidth(50);
        table.getColumnModel().getColumn(4).setPreferredWidth(20);

        table.getColumn(model.getColumnName(0)).setCellRenderer(new DefaultTableCellRenderer() {
            public Component getTableCellRendererComponent(final JTable table,
                                                           final Object value,
                                                           final boolean isSelected,
                                                           final boolean hasFocus,
                                                           final int row,
                                                           final int column) {

                File renderingFile = (File)getModel().getElementAt(row);
                String displayValue = getFileChooser().getName(renderingFile);

                JLabel result = (JLabel)super.getTableCellRendererComponent(table, displayValue, isSelected, hasFocus, row, column);
                result.setIcon(getFileChooser().getIcon(renderingFile));

                return result;
            }
        });
        table.getColumn(model.getColumnName(1)).setCellRenderer(new DefaultTableCellRenderer() {
            public Component getTableCellRendererComponent(final JTable table,
                                                           final Object value,
                                                           final boolean isSelected,
                                                           final boolean hasFocus,
                                                           final int row,
                                                           final int column) {

                JLabel result = (JLabel)super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
                result.setHorizontalAlignment(SwingConstants.RIGHT);
                return result;
            }
        });
        table.getColumn(model.getColumnName(3)).setCellRenderer(new DefaultTableCellRenderer() {
            public Component getTableCellRendererComponent(final JTable table,
                                                           final Object value,
                                                           final boolean isSelected,
                                                           final boolean hasFocus,
                                                           final int row,
View Full Code Here

        defaultRenderersByColumnClass.put(Icon.class, new IconTableCellRenderer());
        defaultRenderersByColumnClass.put(Float.class, new NumberTableCellRenderer());
        defaultRenderersByColumnClass.put(Double.class, new NumberTableCellRenderer());
        defaultRenderersByColumnClass.put(Number.class, new NumberTableCellRenderer());
        defaultRenderersByColumnClass.put(Boolean.class, new BooleanTableCellRenderer());
        defaultRenderersByColumnClass.put(Object.class, new DefaultTableCellRenderer());
    }
View Full Code Here

            panel.add(new JLabel(resources.getString("Prompt")),
                    BorderLayout.NORTH);
            setDefaultCloseOperation(DISPOSE_ON_CLOSE);

            table = new JTable(notifications);
            DefaultTableCellRenderer r = new DefaultTableCellRenderer();
            r.setVerticalAlignment(JLabel.TOP);
            table.getColumnModel().getColumn(0).setCellRenderer(r);
            table.getColumnModel().getColumn(0).setMaxWidth(15);
            table.getColumnModel().getColumn(1).setCellRenderer(
                    new WrappedTextTableCellRenderer(table));
            table.setTableHeader(null);
View Full Code Here

        toolsTable.getColumnModel().getColumn(6).setCellRenderer(new CheckBoxCellRenderer());
        toolsTable.getColumnModel().getColumn(6).setCellEditor(new DefaultCellEditor(booleanEditor));

        // Index column
        TableColumn indexColumn = toolsTable.getColumnModel().getColumn(7);
        indexColumn.setCellRenderer(new DefaultTableCellRenderer() {
            public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
                Component c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
                Integer index = (Integer) value;
                if (index == -1)
                    setText("No Index");
View Full Code Here

        toolsTable.getColumnModel().getColumn(6).setCellRenderer(new CheckBoxCellRenderer());
        toolsTable.getColumnModel().getColumn(6).setCellEditor(new DefaultCellEditor(booleanEditor));

        // Index column
        TableColumn indexColumn = toolsTable.getColumnModel().getColumn(7);
        indexColumn.setCellRenderer(new DefaultTableCellRenderer() {
            public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
                Component c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
                Integer index = (Integer) value;
                if (index == -1)
                    setText("No Index");
View Full Code Here

        toolsTable.getColumnModel().getColumn(8).setCellRenderer(new CheckBoxCellRenderer());
        toolsTable.getColumnModel().getColumn(8).setCellEditor(new DefaultCellEditor(booleanEditor));

        // Index column
        TableColumn indexColumn = toolsTable.getColumnModel().getColumn(7);
        indexColumn.setCellRenderer(new DefaultTableCellRenderer() {
            public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
                Component c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
                Integer index = (Integer) value;
                if (index == -1)
                    setText("No Index");
View Full Code Here

        toolsTable.getColumnModel().getColumn(9).setCellRenderer(new CheckBoxCellRenderer());
        toolsTable.getColumnModel().getColumn(9).setCellEditor(new DefaultCellEditor(booleanEditor));

        // Index column
        TableColumn indexColumn = toolsTable.getColumnModel().getColumn(7);
        indexColumn.setCellRenderer(new DefaultTableCellRenderer() {
            public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
                Component c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
                Integer index = (Integer) value;
                if (index == -1)
                    setText("No Index");
View Full Code Here

        toolsTable.getColumnModel().getColumn(10).setCellRenderer(new CheckBoxCellRenderer());
        toolsTable.getColumnModel().getColumn(10).setCellEditor(new DefaultCellEditor(booleanEditor));

        // Index column
        TableColumn indexColumn = toolsTable.getColumnModel().getColumn(7);
        indexColumn.setCellRenderer(new DefaultTableCellRenderer() {
            public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
                Component c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
                Integer index = (Integer) value;
                if (index == -1)
                    setText("No Index");
View Full Code Here

        toolsTable.getColumnModel().getColumn(6).setCellRenderer(new CheckBoxCellRenderer());
        toolsTable.getColumnModel().getColumn(6).setCellEditor(new DefaultCellEditor(booleanEditor));

        // Index column
        TableColumn indexColumn = toolsTable.getColumnModel().getColumn(7);
        indexColumn.setCellRenderer(new DefaultTableCellRenderer() {
            public Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, boolean hasFocus, int row, int column) {
                Component c = super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
                Integer index = (Integer) value;
                if (index == -1)
                    setText("No Index");
View Full Code Here

TOP

Related Classes of javax.swing.table.DefaultTableCellRenderer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.