* Added shadowborder from jgoodies demo

* Facelift for AMenu and VTreePanel
* Facelift for Preference dialog
- Pending messages and rework of theme selection.
- Please email me or post in SF if you don't like the changes.
This commit is contained in:
Heng Sin Low 2006-11-24 08:05:56 +00:00
parent ac6ce4b999
commit 91151a1f67
1 changed files with 76 additions and 0 deletions

View File

@ -0,0 +1,76 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
package org.compiere.swing;
import java.awt.Color;
import java.awt.Component;
import java.awt.Graphics;
import java.awt.Insets;
import javax.swing.UIManager;
import javax.swing.border.AbstractBorder;
/**
* A border with a drop shadow.
* Extracted from JGoodies look demo.
* @author Low Heng Sin
* @version 2006-11-24
*/
public class ShadowBorder extends AbstractBorder {
private static final Insets INSETS = new Insets(1, 1, 3, 3);
public Insets getBorderInsets(Component c) { return INSETS; }
public void paintBorder(Component c, Graphics g,
int x, int y, int w, int h) {
Color shadow = UIManager.getColor("controlShadow");
if (shadow == null) {
shadow = Color.GRAY;
}
Color lightShadow = new Color(shadow.getRed(),
shadow.getGreen(),
shadow.getBlue(),
170);
Color lighterShadow = new Color(shadow.getRed(),
shadow.getGreen(),
shadow.getBlue(),
70);
g.translate(x, y);
g.setColor(shadow);
g.fillRect(0, 0, w - 3, 1);
g.fillRect(0, 0, 1, h - 3);
g.fillRect(w - 3, 1, 1, h - 3);
g.fillRect(1, h - 3, w - 3, 1);
// Shadow line 1
g.setColor(lightShadow);
g.fillRect(w - 3, 0, 1, 1);
g.fillRect(0, h - 3, 1, 1);
g.fillRect(w - 2, 1, 1, h - 3);
g.fillRect(1, h - 2, w - 3, 1);
// Shadow line2
g.setColor(lighterShadow);
g.fillRect(w - 2, 0, 1, 1);
g.fillRect(0, h - 2, 1, 1);
g.fillRect(w-2, h-2, 1, 1);
g.fillRect(w - 1, 1, 1, h - 2);
g.fillRect(1, h - 1, w - 2, 1);
g.translate(-x, -y);
}
}