org.jdesktop.swingx.decorator.ColorHighlighter Java Examples

The following examples show how to use org.jdesktop.swingx.decorator.ColorHighlighter. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ParametersPanel.java    From nextreports-designer with Apache License 2.0 5 votes vote down vote up
private void createTable() {
	model = new ParametersTableModel();
	table = new JXTable(model);
       table.setSortable(false);
       //table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
       table.setRolloverEnabled(true);
       table.addHighlighter(new ColorHighlighter(HighlightPredicate.ROLLOVER_ROW, null, Color.RED)); 
}
 
Example #2
Source File: BaseForm.java    From CodenameOne with GNU General Public License v2.0 4 votes vote down vote up
public EditorTable() {
    setSortable(true);
    addHighlighter(HighlighterFactory.createSimpleStriping());
    addHighlighter(new ColorHighlighter(HighlightPredicate.ROLLOVER_ROW, null, Color.RED));  
    setColumnControlVisible(true);
}
 
Example #3
Source File: DesignerTablePanel.java    From nextreports-designer with Apache License 2.0 4 votes vote down vote up
private void createTable() {
        // create the table
        model = new MyTableModel();
        table = new JXTable(model) {

            private Map<Integer, ComboBoxEditor> editors = new HashMap<Integer, ComboBoxEditor>();

            public boolean getScrollableTracksViewportHeight() {
                return getPreferredSize().height < getParent().getHeight();
            }

            public void changeSelection(int rowIndex, int columnIndex,
                                        boolean toggle, boolean extend) {
                if (!dndRecognizer.isDragged()) {
                    super.changeSelection(rowIndex, columnIndex, toggle, extend);
                }
            }

            public TableCellEditor getCellEditor(int row, int column) {
                if (column != 6) {
                    return super.getCellEditor(row, column);
                }
                ComboBoxEditor editor = editors.get(row);
                if (editor == null) {
                    editor = new ComboBoxEditor(new String[]{"", GROUP_BY, SUM, AVG, MIN, MAX, COUNT});
                    editors.put(row, editor);
                }
                return editor;
            }
        };
        tableRowHeader = TableUtil.setRowHeader(table);
        table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
        TableColumn col = table.getColumnModel().getColumn(3);
//        col.setCellRenderer(TableCellRenderers.getNewDefaultRenderer(Boolean.class));
        col.setCellRenderer(table.getDefaultRenderer(Boolean.class));
        col.setCellEditor(table.getDefaultEditor(Boolean.class));
        table.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE);
        // no border
        JTextField tf = new JTextField();
        tf.setBorder(BorderFactory.createEmptyBorder());
        table.setDefaultEditor(Object.class, new DefaultCellEditor(tf));

        col = table.getColumnModel().getColumn(4);
//        col.setCellRenderer(TableCellRenderers.getNewDefaultRenderer(Boolean.class));
        JComboBox sortCombo = new JComboBox(new String[]{"", ASC, DESC});
        sortCombo.setBorder(BorderFactory.createEmptyBorder());
        col.setCellEditor(new ComboBoxEditor(sortCombo));

        col = table.getColumnModel().getColumn(5);
        sortOrderCombo = new JComboBox();
        sortOrderCombo.setBorder(BorderFactory.createEmptyBorder());
        col.setCellEditor(new ComboBoxEditor(sortOrderCombo));

        col = table.getColumnModel().getColumn(6);

        table.setSortable(false);
        table.setColumnControlVisible(true);
        table.getTableHeader().setReorderingAllowed(false);
        table.setHorizontalScrollEnabled(true);

        // highlight table
        table.setHighlighters(HighlighterFactory.createAlternateStriping(Color.WHITE, ColorUtil.PANEL_BACKROUND_COLOR));

        table.getTableHeader().setReorderingAllowed(false);
        
        table.setRolloverEnabled(true);
        table.addHighlighter(new ColorHighlighter(HighlightPredicate.ROLLOVER_ROW, null, Color.RED)); 
    }