1173N/A/*
2362N/A * Copyright (c) 2005, 2006, Oracle and/or its affiliates. All rights reserved.
1173N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1173N/A *
1173N/A * This code is free software; you can redistribute it and/or modify it
1173N/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
1173N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
1173N/A *
1173N/A * This code is distributed in the hope that it will be useful, but WITHOUT
1173N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
1173N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
1173N/A * version 2 for more details (a copy is included in the LICENSE file that
1173N/A * accompanied this code).
1173N/A *
1173N/A * You should have received a copy of the GNU General Public License version
1173N/A * 2 along with this work; if not, write to the Free Software Foundation,
1173N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
1173N/A *
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
2362N/A * questions.
1173N/A */
1173N/Apackage javax.swing.plaf.nimbus;
1173N/A
1173N/Aimport javax.swing.Painter;
1173N/A
1173N/Aimport javax.swing.JComponent;
1173N/Aimport javax.swing.UIManager;
1173N/Aimport javax.swing.plaf.UIResource;
1173N/Aimport java.awt.Graphics;
1173N/Aimport java.awt.Graphics2D;
1173N/Aimport java.awt.Color;
1173N/Aimport java.awt.image.BufferedImage;
1173N/A
1173N/A/**
1173N/A * TableScrollPaneCorner - A simple component that paints itself using the table
1173N/A * header background painter. It is used to fill the top right corner of
1173N/A * scrollpane.
1173N/A *
1173N/A * @author Created by Jasper Potts (Jan 28, 2008)
1173N/A */
1173N/Aclass TableScrollPaneCorner extends JComponent implements UIResource{
1173N/A
1173N/A /**
1173N/A * Paint the component using the Nimbus Table Header Background Painter
1173N/A */
1173N/A @Override protected void paintComponent(Graphics g) {
1173N/A Painter painter = (Painter) UIManager.get(
1173N/A "TableHeader:\"TableHeader.renderer\"[Enabled].backgroundPainter");
1173N/A if (painter != null){
1173N/A if (g instanceof Graphics2D){
1173N/A painter.paint((Graphics2D)g,this,getWidth()+1,getHeight());
1173N/A } else {
1173N/A // paint using image to not Graphics2D to support
1173N/A // Java 1.1 printing API
1173N/A BufferedImage img = new BufferedImage(getWidth(),getHeight(),
1173N/A BufferedImage.TYPE_INT_ARGB);
1173N/A Graphics2D g2 = (Graphics2D)img.getGraphics();
1173N/A painter.paint(g2,this,getWidth()+1,getHeight());
1173N/A g2.dispose();
1173N/A g.drawImage(img,0,0,null);
1173N/A img = null;
1173N/A }
1173N/A }
1173N/A }
1173N/A}