KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > compiere > plaf > CompiereTableHeaderUI


1 /******************************************************************************
2  * The contents of this file are subject to the Compiere License Version 1.1
3  * ("License"); You may not use this file except in compliance with the License
4  * You may obtain a copy of the License at http://www.compiere.org/license.html
5  * Software distributed under the License is distributed on an "AS IS" basis,
6  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
7  * the specific language governing rights and limitations under the License.
8  * The Original Code is Compiere ERP & CRM Business Solution
9  * The Initial Developer of the Original Code is Jorg Janke and ComPiere, Inc.
10  * Portions created by Jorg Janke are Copyright (C) 1999-2001 Jorg Janke, parts
11  * created by ComPiere are Copyright (C) ComPiere, Inc.; All Rights Reserved.
12  * Contributor(s): ______________________________________.
13  *****************************************************************************/

14 package org.compiere.plaf;
15
16 import java.awt.Graphics JavaDoc;
17 import java.awt.Graphics2D JavaDoc;
18
19 import javax.swing.JComponent JavaDoc;
20 import javax.swing.plaf.ComponentUI JavaDoc;
21 import javax.swing.plaf.basic.BasicTableHeaderUI JavaDoc;
22
23 /**
24  * Table Header UI
25  * 3D effect
26  *
27  * @author Jorg Janke
28  * @version $Id: CompiereTableHeaderUI.java,v 1.7 2003/09/27 11:08:52 jjanke Exp $
29  */

30 public class CompiereTableHeaderUI extends BasicTableHeaderUI JavaDoc
31 {
32     /**
33      * Static Create UI
34      * @param c Component
35      * @return Compiere TableHeader UI
36      */

37     public static ComponentUI JavaDoc createUI(JComponent JavaDoc c)
38     {
39         return new CompiereTableHeaderUI();
40     } // createUI
41

42
43     /**
44      * Install UI - set not Opaque
45      * @param c
46      */

47     public void installUI(JComponent JavaDoc c)
48     {
49         super.installUI(c);
50         // TableHeader is in JViewpoiunt, which is Opaque
51
// When UI created, TableHeader not added to viewpoint
52
c.setOpaque(true);
53         c.putClientProperty(CompierePLAF.BACKGROUND_FILL, "Y");
54     } // installUI
55

56     /*************************************************************************/
57
58     /**
59      * Update -
60      * This method is invoked by <code>JComponent</code> when the specified
61      * component is being painted.
62      *
63      * By default this method will fill the specified component with
64      * its background color (if its <code>opaque</code> property is
65      * <code>true</code>) and then immediately call <code>paint</code>.
66      *
67      * @param g the <code>Graphics</code> context in which to paint
68      * @param c the component being painted
69      *
70      * @see #paint
71      * @see javax.swing.JComponent#paintComponent
72      */

73     public void update(Graphics JavaDoc g, JComponent JavaDoc c)
74     {
75     // CompiereUtils.printParents (c); // Parent is JViewpoint
76
if (c.isOpaque()) // flat
77
CompiereUtils.fillRectange((Graphics2D JavaDoc)g, c, CompiereLookAndFeel.ROUND);
78         //
79
paint (g, c);
80     } // update
81

82     /**
83      * Paint 3D box
84      * @param g
85      * @param c
86      */

87     public void paint(Graphics JavaDoc g, JComponent JavaDoc c)
88     {
89         super.paint( g, c);
90         CompiereUtils.paint3Deffect((Graphics2D JavaDoc)g, c, CompiereLookAndFeel.ROUND, true);
91     } // paint
92

93 } // CompiereTableHeader
94
Popular Tags