KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openharmonise > him > displaycomponents > search > OtherPathCell


1 /*
2  * The contents of this file are subject to the
3  * Mozilla Public License Version 1.1 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at http://www.mozilla.org/MPL/
6  *
7  * Software distributed under the License is distributed on an "AS IS"
8  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
9  * See the License for the specific language governing rights and
10  * limitations under the License.
11  *
12  * The Initial Developer of the Original Code is Simulacra Media Ltd.
13  * Portions created by Simulacra Media Ltd are Copyright (C) Simulacra Media Ltd, 2004.
14  *
15  * All Rights Reserved.
16  *
17  * Contributor(s):
18  */

19
20 package org.openharmonise.him.displaycomponents.search;
21
22 import java.awt.*;
23
24 import javax.swing.*;
25
26 import org.openharmonise.him.window.swing.SelfRenderListCell;
27 import org.openharmonise.vfs.gui.*;
28
29
30 /**
31  * Self rendering {@link javax.swing.JComboBox} cell for add paths
32  * to the search in list.
33  *
34  * @author Matthew Large
35  * @version $Revision: 1.1 $
36  *
37  */

38 public class OtherPathCell implements SelfRenderListCell {
39
40     /**
41      * Selected colour.
42      */

43     private Color m_selectedColor = new Color(173,169,143);
44
45     /**
46      *
47      */

48     public OtherPathCell() {
49         super();
50     }
51
52     /* (non-Javadoc)
53      * @see com.simulacramedia.contentmanager.window.swing.SelfRenderListCell#getRenderComponent()
54      */

55     public Component getRenderComponent(boolean bIsSelected, boolean bHasFocus) {
56         
57         JLabel label = new JLabel("Add path...");
58         
59         String JavaDoc fontName = "Dialog";
60         int fontSize = 11;
61         Font font = new Font(fontName, Font.PLAIN, fontSize);
62         
63         label.setFont(font);
64         label.setIcon( IconManager.getInstance().getIcon("16-blank.gif") );
65
66         label.setOpaque(true);
67         label.setBackground(Color.WHITE);
68         label.setBorder(BorderFactory.createLineBorder(Color.WHITE));
69         label.setBorder(BorderFactory.createLineBorder(Color.WHITE));
70         
71         if(bIsSelected) {
72             label.setBackground(m_selectedColor);
73             label.setBorder(BorderFactory.createLineBorder(Color.BLACK));
74         }
75             
76         if(bHasFocus) {
77             label.setBorder(BorderFactory.createLineBorder(Color.BLACK));
78         }
79         
80         return label;
81     }
82
83 }
84
Popular Tags