1 package org.wcb.gui.component; 2 3 import javax.swing.JPanel; 4 import java.awt.Color; 5 import java.awt.Graphics; 6 import java.awt.Graphics2D; 7 import java.awt.Point; 8 import java.awt.GradientPaint; 9 10 /** 11 * <small> 12 * <p/> 13 * Copyright (c) 2006 wbogaardt. 14 * This library is free software; you can redistribute it and/or 15 * modify it under the terms of the GNU Lesser General Public 16 * License as published by the Free Software Foundation; either 17 * version 2.1 of the License, or (at your option) any later version. 18 * 19 * This library is distributed in the hope that it will be useful, 20 * but WITHOUT ANY WARRANTY; without even the implied warranty of 21 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22 * Lesser General Public License for more details. 23 * 24 * You should have received a copy of the GNU Lesser General Public 25 * License along with this library; if not, write to the Free Software 26 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 27 * <p/> 28 * $File: $ <br> 29 * $Change: $ submitted by $Author: wbogaardt $ at $DateTime: Sep 21, 2006 3:22:40 PM $ <br> 30 * </small> 31 * 32 * @author wbogaardt 33 * Simple pane with gradient paint of darker blue color from top to lighter 34 * bluish color towards the bottom of the pane. 35 */ 36 37 public class JCloudPane extends JPanel { 38 39 /** 40 * Paints a bluish horizion background. 41 * @param g reference to the graphics object for overloading. 42 */ 43 protected void paintComponent(Graphics g) { 44 super.paintComponent(g); 45 Color barColor = new Color(0x3794f2); 46 Graphics2D g2 = (Graphics2D) g; 47 Color gradEnd = barColor.brighter(); 48 Color gradStart = barColor.darker(); 49 GradientPaint bg = new GradientPaint(new Point(0, 0), gradStart, new Point(0, this.getHeight()), gradEnd); 50 g2.setPaint(bg); 51 int scale = 2; 52 g2.fillRoundRect(0, 0, getWidth(), getHeight(), scale, scale); 53 54 } 55 }