CellRendererPane.java revision 2362
2362N/A * Copyright (c) 1997, 2003, 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 * This class is inserted in between cell renderers and the components that 0N/A * use them. It just exists to thwart the repaint() and invalidate() methods 0N/A * which would otherwise propagate up the tree when the renderer was configured. 0N/A * It's used by the implementations of JTable, JTree, and JList. For example, 0N/A * here's how CellRendererPane is used in the code the paints each row 0N/A * cellRendererPane = new CellRendererPane(); 0N/A * Component rendererComponent = renderer.getListCellRendererComponent(); 0N/A * cellRendererPane.paintComponent(g, rendererComponent, this, x, y, w, h); 0N/A * A renderer component must override isShowing() and unconditionally return 0N/A * true to work correctly because the Swing paint does nothing for components 0N/A * with isShowing false. 0N/A * <strong>Warning:</strong> 0N/A * Serialized objects of this class will not be compatible with 0N/A * future Swing releases. The current serialization support is 0N/A * appropriate for short term storage or RMI between applications running 0N/A * the same version of Swing. As of 1.4, support for long term storage 0N/A * of all JavaBeans<sup><font size="-2">TM</font></sup> 0N/A * has been added to the <code>java.beans</code> package. 0N/A * @author Hans Muller 0N/A * Construct a CellRendererPane object. 0N/A * Overridden to avoid propagating a invalidate up the tree when the 0N/A * cell renderer child is configured. 0N/A * Shouldn't be called. 0N/A * Shouldn't be called. 0N/A * If the specified component is already a child of this then we don't 0N/A * bother doing anything - stacking order doesn't matter for cell 0N/A * renderer components (CellRendererPane doesn't paint anyway).< 0N/A * Paint a cell renderer component c on graphics object g. Before the component 0N/A * is drawn it's reparented to this (if that's necessary), it's bounds 0N/A * are set to w,h and the graphics object is (effectively) translated to x,y. 0N/A * If it's a JComponent, double buffering is temporarily turned off. After 0N/A * the component is painted it's bounds are reset to -w, -h, 0, 0 so that, if 0N/A * it's the last renderer component painted, it will not start consuming input. 0N/A * The Container p is the component we're actually drawing on, typically it's 0N/A * equal to this.getParent(). If shouldValidate is true the component c will be 0N/A * validated before painted. 0N/A * Calls this.paintComponent(g, c, p, x, y, w, h, false). 0N/A * Calls this.paintComponent() with the rectangles x,y,width,height fields. 0N/A// Accessibility support 0N/A * Gets the AccessibleContext associated with this CellRendererPane. 0N/A * For CellRendererPanes, the AccessibleContext takes the form of an 0N/A * AccessibleCellRendererPane. 0N/A * A new AccessibleCellRendererPane instance is created if necessary. 0N/A * @return an AccessibleCellRendererPane that serves as the 0N/A * AccessibleContext of this CellRendererPane 0N/A * This class implements accessibility support for the 0N/A * <code>CellRendererPane</code> class. 0N/A // AccessibleContext methods 0N/A * Get the role of this object. 0N/A * @return an instance of AccessibleRole describing the role of the 0N/A * @see AccessibleRole 0N/A }
// inner class AccessibleCellRendererPane