KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openharmonise > him > metadata > range > swing > domain > DomainSelectionHeader


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 package org.openharmonise.him.metadata.range.swing.domain;
20
21 import java.awt.Color JavaDoc;
22 import java.awt.Component JavaDoc;
23 import java.awt.Container JavaDoc;
24 import java.awt.Dimension JavaDoc;
25 import java.awt.Font JavaDoc;
26 import java.awt.LayoutManager JavaDoc;
27
28 import javax.swing.BorderFactory JavaDoc;
29 import javax.swing.JLabel JavaDoc;
30 import javax.swing.JPanel JavaDoc;
31
32 /**
33  * @author Matthew Large
34  * @version $Revision: 1.1 $
35  *
36  */

37 public class DomainSelectionHeader extends JPanel JavaDoc implements LayoutManager JavaDoc {
38
39     private JLabel JavaDoc m_resourceLabel = null;
40     
41     private JLabel JavaDoc m_typeLabel = null;
42     
43     private JLabel JavaDoc m_minLabel = null;
44     
45     private JLabel JavaDoc m_maxLabel = null;
46
47     /**
48      *
49      */

50     public DomainSelectionHeader() {
51         super();
52         this.setup();
53     }
54     
55     private void setup() {
56         this.setLayout(this);
57
58         String JavaDoc fontName = "Dialog";
59         int fontSize = 11;
60         Font JavaDoc boldFont = new Font JavaDoc(fontName, Font.BOLD, fontSize);
61         
62         this.m_resourceLabel = new JLabel JavaDoc(" Collection");
63         this.m_resourceLabel.setBackground(Color.WHITE);
64         this.m_resourceLabel.setBorder( BorderFactory.createLineBorder(Color.BLACK) );
65         this.m_resourceLabel.setFont(boldFont);
66         this.add(m_resourceLabel);
67         
68         this.m_typeLabel = new JLabel JavaDoc(" Type");
69         this.m_typeLabel.setBackground(Color.WHITE);
70         this.m_typeLabel.setBorder( BorderFactory.createLineBorder(Color.BLACK) );
71         this.m_typeLabel.setFont(boldFont);
72         this.add(m_typeLabel);
73         
74         this.m_minLabel = new JLabel JavaDoc(" Min");
75         this.m_minLabel.setBackground(Color.WHITE);
76         this.m_minLabel.setBorder( BorderFactory.createLineBorder(Color.BLACK) );
77         this.m_minLabel.setFont(boldFont);
78         this.add(m_minLabel);
79         
80         this.m_maxLabel = new JLabel JavaDoc(" Max");
81         this.m_maxLabel.setBackground(Color.WHITE);
82         this.m_maxLabel.setBorder( BorderFactory.createLineBorder(Color.BLACK) );
83         this.m_maxLabel.setFont(boldFont);
84         this.add(m_maxLabel);
85         
86     }
87
88     /* (non-Javadoc)
89      * @see java.awt.Component#getPreferredSize()
90      */

91     public Dimension JavaDoc getPreferredSize() {
92         return new Dimension JavaDoc(300, 20);
93     }
94
95     /* (non-Javadoc)
96      * @see java.awt.LayoutManager#layoutContainer(java.awt.Container)
97      */

98     public void layoutContainer(Container JavaDoc arg0) {
99         this.m_resourceLabel.setSize(100, 20);
100         this.m_resourceLabel.setLocation(0, 0);
101         
102         this.m_typeLabel.setSize(100, 20);
103         this.m_typeLabel.setLocation(100, 0);
104         
105         this.m_minLabel.setSize(50, 20);
106         this.m_minLabel.setLocation(200, 0);
107         
108         this.m_maxLabel.setSize(50, 20);
109         this.m_maxLabel.setLocation(250, 0);
110     }
111
112     /* (non-Javadoc)
113      * @see java.awt.LayoutManager#removeLayoutComponent(java.awt.Component)
114      */

115     public void removeLayoutComponent(Component JavaDoc arg0) {
116     }
117
118     /* (non-Javadoc)
119      * @see java.awt.LayoutManager#addLayoutComponent(java.lang.String, java.awt.Component)
120      */

121     public void addLayoutComponent(String JavaDoc arg0, Component JavaDoc arg1) {
122     }
123
124     /* (non-Javadoc)
125      * @see java.awt.LayoutManager#minimumLayoutSize(java.awt.Container)
126      */

127     public Dimension JavaDoc minimumLayoutSize(Container JavaDoc arg0) {
128         return this.getPreferredSize();
129     }
130
131     /* (non-Javadoc)
132      * @see java.awt.LayoutManager#preferredLayoutSize(java.awt.Container)
133      */

134     public Dimension JavaDoc preferredLayoutSize(Container JavaDoc arg0) {
135         return this.getPreferredSize();
136     }
137
138     /**
139      * @param arg0
140      */

141     public DomainSelectionHeader(boolean arg0) {
142         super(arg0);
143     }
144
145     /**
146      * @param arg0
147      */

148     public DomainSelectionHeader(LayoutManager JavaDoc arg0) {
149         super(arg0);
150     }
151
152     /**
153      * @param arg0
154      * @param arg1
155      */

156     public DomainSelectionHeader(LayoutManager JavaDoc arg0, boolean arg1) {
157         super(arg0, arg1);
158     }
159
160 }
161
Popular Tags