javax.swing.plaf.TableHeaderUI Java Examples

The following examples show how to use javax.swing.plaf.TableHeaderUI. 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: SortedTable.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
public void setUI(TableHeaderUI ui) {
    /*
     * It fixes the bug by reseting the renderer to the default (non-sorting)
     * renderer before the UI is changed.
     * Thanks to this change (the reset), method
     * WindowsTableHeaderUI.uninstallUI(JComponent) then resets the
     * renderer to the default Windows L&F renderer which is the
     * renderer used when the Windows Classic theme is used.
     */
    if (ui != this.ui) {
        unsetSortingRenderer();
        super.setUI(ui);
        setSortingRenderer();
        repaint();
    }
}
 
Example #2
Source File: SubstanceScrollPaneUI.java    From radiance with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Installs a corner filler that matches the table header. This is done to provide a continuous
 * appearance for tables with table headers placed in scroll panes.
 *
 * @param scrollpane Scroll pane.
 */
private void installTableHeaderCornerFiller(JScrollPane scrollpane) {
    // install custom scroll pane corner filler
    // for continuous painting of table headers
    JViewport columnHeader = scrollpane.getColumnHeader();
    // System.out.println("Column header " + columnHeader);
    if (columnHeader == null) {
        return;
    }
    Component columnHeaderComp = columnHeader.getView();
    // System.out.println("Column header comp " + columnHeaderComp);
    if (!(columnHeaderComp instanceof JTableHeader)) {
        return;
    }
    JTableHeader tableHeader = (JTableHeader) columnHeaderComp;
    TableHeaderUI tableHeaderUI = tableHeader.getUI();
    if (!(tableHeaderUI instanceof SubstanceTableHeaderUI)) {
        return;
    }
    SubstanceTableHeaderUI ui = (SubstanceTableHeaderUI) tableHeaderUI;
    JComponent scrollPaneCornerFiller = ui.getScrollPaneCornerFiller();
    String cornerKey = scrollpane.getComponentOrientation().isLeftToRight()
            ? JScrollPane.UPPER_RIGHT_CORNER
            : JScrollPane.UPPER_LEFT_CORNER;
    Component cornerComp = scrollpane.getCorner(cornerKey);
    // Corner component can be replaced when the current one is null or
    // UIResource
    boolean canReplace = (cornerComp == null) || (cornerComp instanceof UIResource);
    // System.out.println(canReplace + ":" + cornerComp);
    if (canReplace) {
        scrollpane.setCorner(cornerKey, scrollPaneCornerFiller);
    }
}
 
Example #3
Source File: SubstanceTableUI.java    From radiance with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Handles various mouse move events and initiates the fade animation if necessary.
 * 
 * @param e
 *            Mouse event.
 */
private void handleMoveForHeader(MouseEvent e) {
    if (!SubstanceTableUI.this.table.getColumnSelectionAllowed())
        return;
    JTableHeader header = SubstanceTableUI.this.table.getTableHeader();
    if ((header == null) || (!header.isVisible()))
        return;

    TableHeaderUI ui = header.getUI();
    if (!(ui instanceof SubstanceTableHeaderUI))
        return;

    SubstanceTableHeaderUI sthui = (SubstanceTableHeaderUI) ui;

    // synchronized (SubstanceTableUI.this.table) {
    int row = SubstanceTableUI.this.table.rowAtPoint(e.getPoint());
    int column = SubstanceTableUI.this.table.columnAtPoint(e.getPoint());
    if ((row < 0) || (row >= SubstanceTableUI.this.table.getRowCount()) || (column < 0)
            || (column >= SubstanceTableUI.this.table.getColumnCount())) {
        this.fadeOutTableHeader();
        // System.out.println("Nulling RO column index");
        SubstanceTableUI.this.rolledOverColumn = -1;
    } else {
        // check if this is the same column
        if (SubstanceTableUI.this.rolledOverColumn == column)
            return;

        this.fadeOutTableHeader();

        TableColumnModel columnModel = header.getColumnModel();
        StateTransitionTracker columnTransitionTracker = sthui.getTracker(column, false,
                columnModel.getColumnSelectionAllowed()
                        && columnModel.getSelectionModel().isSelectedIndex(column));
        columnTransitionTracker.getModel().setRollover(true);

        SubstanceTableUI.this.rolledOverColumn = column;
    }
    // }
}
 
Example #4
Source File: JTableHeaderOperator.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Maps {@code JTableHeader.getUI()} through queue
 */
public TableHeaderUI getUI() {
    return (runMapping(new MapAction<TableHeaderUI>("getUI") {
        @Override
        public TableHeaderUI map() {
            return ((JTableHeader) getSource()).getUI();
        }
    }));
}
 
Example #5
Source File: JTableHeaderOperator.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Maps {@code JTableHeader.setUI(TableHeaderUI)} through queue
 */
public void setUI(final TableHeaderUI tableHeaderUI) {
    runMapping(new MapVoidAction("setUI") {
        @Override
        public void map() {
            ((JTableHeader) getSource()).setUI(tableHeaderUI);
        }
    });
}
 
Example #6
Source File: TaskListTable.java    From netbeans with Apache License 2.0 4 votes vote down vote up
@Override
public void setUI(TableHeaderUI ui) {
    super.setUI(ui);
}
 
Example #7
Source File: GroupableTableHeader.java    From ramus with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void setUI(TableHeaderUI ui) {
    super.setUI(new GroupableTableHeaderUI());
}