3909N/A * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved. 0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 0N/A * This code is free software; you can redistribute it and/or modify it 0N/A * under the terms of the GNU General Public License version 2 only, as 2362N/A * published by the Free Software Foundation. Oracle designates this 0N/A * particular file as subject to the "Classpath" exception as provided 2362N/A * by Oracle in the LICENSE file that accompanied this code. 0N/A * This code is distributed in the hope that it will be useful, but WITHOUT 0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 0N/A * version 2 for more details (a copy is included in the LICENSE file that 0N/A * accompanied this code). 0N/A * You should have received a copy of the GNU General Public License version 0N/A * 2 along with this work; if not, write to the Free Software Foundation, 0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 2362N/A * or visit www.oracle.com if you need additional information or have any 0N/A * BasicTableHeaderUI implementation 0N/A * @author Alan Chung 0N/A * @author Philip Milne 0N/A// Instance Variables 0N/A /** The JTableHeader that is delegating the painting to this UI. */ 0N/A // Listeners that are attached to the JTable 0N/A // The column header over which the mouse currently is. 0N/A // The column that should be highlighted when the table header has the focus. 0N/A * This class should be treated as a "protected" inner class. 0N/A * Instantiate it only within subclasses of {@code BasicTableHeaderUI}. 0N/A // First find which header cell was hit 0N/A // The last 3 pixels + 3 pixels of next column are for resizing 0N/A //Cache the selected column. 2350N/A //Update the selected index. 0N/A// Protected & Private Methods 0N/A// Factory methods for the Listeners 0N/A * Creates the mouse listener for the JTableHeader. 0N/A * Initializes JTableHeader properties such as font, foreground, and background. 0N/A * The font, foreground, and background properties are only set if their 0N/A * current value is either null or a UIResource, other properties are set 0N/A * if the current value is null. 0N/A "TableHeader.foreground",
"TableHeader.font");
0N/A * Attaches listeners to the JTableHeader. 0N/A * Register all keyboard actions on the JTableHeader. 0N/A "TableHeader.ancestorInputMap");
0N/A "TableHeader.actionMap");
0N/A * Unregisters default key actions. 0N/A * Populates TableHeader's actions. 0N/A// Support for mouse rollover 0N/A * Returns the index of the column header over which the mouse 0N/A * currently is. When the mouse is not over the table header, 0N/A * @see #rolloverColumnUpdated(int, int) 0N/A * @return the index of the current rollover column 0N/A * This method gets called every time when a rollover column in the table 0N/A * header is updated. Every look and feel that supports a rollover effect 0N/A * in a table header should override this method and repaint the header. 0N/A * @param oldColumn the index of the previous rollover column or -1 if the 0N/A * mouse was not over a column 0N/A * @param newColumn the index of the new rollover column or -1 if the mouse 0N/A * is not over a column 0N/A * @see #getRolloverColumn() 0N/A * @see JTableHeader#getHeaderRect(int) 0N/A// Support for keyboard and mouse access 0N/A * Selects the specified column in the table header. Repaints the 0N/A * affected header cells and makes sure the newly selected one is visible. 0N/A * Used by selectColumn to scroll horizontally, if necessary, 0N/A * to ensure that the newly selected column is visible. 0N/A //Test whether the header is in a scroll pane and has a table. 0N/A //Now scroll, if necessary. 0N/A /* Resize a table */ 0N/A /* If this table is in AUTO_RESIZE_OFF mode and 0N/A * has a horizontal scrollbar, we need to update 0N/A * a view's position. 0N/A * Returns the baseline. 0N/A * @throws NullPointerException {@inheritDoc} 0N/A * @throws IllegalArgumentException {@inheritDoc} 0N/A * @see javax.swing.JComponent#getBaseline(int, int) 0N/A// Paint Methods and support 0N/A // This should never happen. 0N/A // If the table does not have enough columns to fill the view we'll get -1. 0N/A // Replace this with the index of the last column. 0N/A // Paint the dragged column if we are dragging. 0N/A // Draw a gray well in place of the moving column. 0N/A // Fill the background. 0N/A // Remove all components in the rendererPane. 0N/A // Configuring the header renderer to calculate its preferred size 0N/A // is expensive. Optimise this by assuming the default renderer 0N/A // always has the same height as the first non-zero height that 0N/A // None of the callers include the intercell spacing, do it here. 0N/A * Return the minimum size of the header. The minimum width is the sum 0N/A * of the minimum widths of each column (plus inter-cell spacing). 0N/A * Return the preferred size of the header. The preferred height is the 0N/A * maximum of the preferred heights of all of the components provided 0N/A * by the header renderers. The preferred width is the sum of the 0N/A * preferred widths of each column (plus inter-cell spacing). 0N/A * Return the maximum size of the header. The maximum width is the sum 0N/A * of the maximum widths of each column (plus inter-cell spacing). 0N/A "selectColumnToLeft";
0N/A "selectColumnToRight";
0N/A return true;
// we'd do the move if asked 0N/A}
// End of Class BasicTableHeaderUI