1 7 package com.sun.java.swing.plaf.nimbus; 8 9 import com.sun.java.swing.Painter; 10 11 import javax.swing.JComponent ; 12 import javax.swing.UIManager ; 13 import javax.swing.plaf.UIResource ; 14 import java.awt.Graphics ; 15 import java.awt.Graphics2D ; 16 import java.awt.Color ; 17 import java.awt.image.BufferedImage ; 18 19 26 public class TableScrollPaneCorner extends JComponent implements UIResource { 27 28 31 @Override protected void paintComponent(Graphics g) { 32 Painter painter = (Painter) UIManager.get( 33 "TableHeader:\"TableHeader.renderer\"[Enabled].backgroundPainter"); 34 if (painter != null){ 35 if (g instanceof Graphics2D ){ 36 painter.paint((Graphics2D )g,this,getWidth()+1,getHeight()); 37 } else { 38 BufferedImage img = new BufferedImage (getWidth(),getHeight(), 41 BufferedImage.TYPE_INT_ARGB); 42 Graphics2D g2 = (Graphics2D )img.getGraphics(); 43 painter.paint(g2,this,getWidth()+1,getHeight()); 44 g2.dispose(); 45 g.drawImage(img,0,0,null); 46 img = null; 47 } 48 } 49 } 50 } 51 | Popular Tags |