1 28 37 38 package org.planetamessenger.ui; 39 40 import javax.swing.*; 41 import java.awt.*; 42 43 public class JExtendedPanel extends JPanel { 44 45 50 public void paintComponent( Graphics g ) { 51 52 super.paintComponent( g ); 53 54 if( !isOpaque() ) { 55 return; 56 } 57 58 Color control = UIManager.getColor( "control" ); 59 int nWidth = getWidth(); 60 int nHeight = getHeight(); 61 Graphics2D g2 = ( Graphics2D ) g; 62 Paint storedPaint = g2.getPaint(); 63 64 g2.setPaint( new GradientPaint( 0, 0, getBackground(), nWidth, 0, control ) ); 65 g2.fillRect( 0, 0, nWidth, nHeight ); 66 g2.setPaint( storedPaint ); 67 g2.setFont( getFont() ); 68 g2.setColor( getForeground() ); 69 } 70 } 71 | Popular Tags |