01: /*
02: * The contents of this file are subject to the
03: * Mozilla Public License Version 1.1 (the "License");
04: * you may not use this file except in compliance with the License.
05: * You may obtain a copy of the License at http://www.mozilla.org/MPL/
06: *
07: * Software distributed under the License is distributed on an "AS IS"
08: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
09: * 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: * Self rendering {@link javax.swing.JComboBox} cell for add paths
31: * to the search in list.
32: *
33: * @author Matthew Large
34: * @version $Revision: 1.1 $
35: *
36: */
37: public class OtherPathCell implements SelfRenderListCell {
38:
39: /**
40: * Selected colour.
41: */
42: private Color m_selectedColor = new Color(173, 169, 143);
43:
44: /**
45: *
46: */
47: public OtherPathCell() {
48: super ();
49: }
50:
51: /* (non-Javadoc)
52: * @see com.simulacramedia.contentmanager.window.swing.SelfRenderListCell#getRenderComponent()
53: */
54: public Component getRenderComponent(boolean bIsSelected,
55: boolean bHasFocus) {
56:
57: JLabel label = new JLabel("Add path...");
58:
59: String fontName = "Dialog";
60: int fontSize = 11;
61: Font font = new Font(fontName, Font.PLAIN, fontSize);
62:
63: label.setFont(font);
64: label
65: .setIcon(IconManager.getInstance().getIcon(
66: "16-blank.gif"));
67:
68: label.setOpaque(true);
69: label.setBackground(Color.WHITE);
70: label.setBorder(BorderFactory.createLineBorder(Color.WHITE));
71: label.setBorder(BorderFactory.createLineBorder(Color.WHITE));
72:
73: if (bIsSelected) {
74: label.setBackground(m_selectedColor);
75: label
76: .setBorder(BorderFactory
77: .createLineBorder(Color.BLACK));
78: }
79:
80: if (bHasFocus) {
81: label
82: .setBorder(BorderFactory
83: .createLineBorder(Color.BLACK));
84: }
85:
86: return label;
87: }
88:
89: }
|