001: /*
002: * The contents of this file are subject to the
003: * Mozilla Public License Version 1.1 (the "License");
004: * you may not use this file except in compliance with the License.
005: * You may obtain a copy of the License at http://www.mozilla.org/MPL/
006: *
007: * Software distributed under the License is distributed on an "AS IS"
008: * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied.
009: * See the License for the specific language governing rights and
010: * limitations under the License.
011: *
012: * The Initial Developer of the Original Code is Simulacra Media Ltd.
013: * Portions created by Simulacra Media Ltd are Copyright (C) Simulacra Media Ltd, 2004.
014: *
015: * All Rights Reserved.
016: *
017: * Contributor(s):
018: */
019: package org.openharmonise.him.metadata.range.swing.domain;
020:
021: import java.awt.Color;
022: import java.awt.Component;
023: import java.awt.Container;
024: import java.awt.Dimension;
025: import java.awt.Font;
026: import java.awt.LayoutManager;
027:
028: import javax.swing.BorderFactory;
029: import javax.swing.JLabel;
030: import javax.swing.JPanel;
031:
032: /**
033: * @author Matthew Large
034: * @version $Revision: 1.1 $
035: *
036: */
037: public class DomainSelectionHeader extends JPanel implements
038: LayoutManager {
039:
040: private JLabel m_resourceLabel = null;
041:
042: private JLabel m_typeLabel = null;
043:
044: private JLabel m_minLabel = null;
045:
046: private JLabel m_maxLabel = null;
047:
048: /**
049: *
050: */
051: public DomainSelectionHeader() {
052: super ();
053: this .setup();
054: }
055:
056: private void setup() {
057: this .setLayout(this );
058:
059: String fontName = "Dialog";
060: int fontSize = 11;
061: Font boldFont = new Font(fontName, Font.BOLD, fontSize);
062:
063: this .m_resourceLabel = new JLabel(" Collection");
064: this .m_resourceLabel.setBackground(Color.WHITE);
065: this .m_resourceLabel.setBorder(BorderFactory
066: .createLineBorder(Color.BLACK));
067: this .m_resourceLabel.setFont(boldFont);
068: this .add(m_resourceLabel);
069:
070: this .m_typeLabel = new JLabel(" Type");
071: this .m_typeLabel.setBackground(Color.WHITE);
072: this .m_typeLabel.setBorder(BorderFactory
073: .createLineBorder(Color.BLACK));
074: this .m_typeLabel.setFont(boldFont);
075: this .add(m_typeLabel);
076:
077: this .m_minLabel = new JLabel(" Min");
078: this .m_minLabel.setBackground(Color.WHITE);
079: this .m_minLabel.setBorder(BorderFactory
080: .createLineBorder(Color.BLACK));
081: this .m_minLabel.setFont(boldFont);
082: this .add(m_minLabel);
083:
084: this .m_maxLabel = new JLabel(" Max");
085: this .m_maxLabel.setBackground(Color.WHITE);
086: this .m_maxLabel.setBorder(BorderFactory
087: .createLineBorder(Color.BLACK));
088: this .m_maxLabel.setFont(boldFont);
089: this .add(m_maxLabel);
090:
091: }
092:
093: /* (non-Javadoc)
094: * @see java.awt.Component#getPreferredSize()
095: */
096: public Dimension getPreferredSize() {
097: return new Dimension(300, 20);
098: }
099:
100: /* (non-Javadoc)
101: * @see java.awt.LayoutManager#layoutContainer(java.awt.Container)
102: */
103: public void layoutContainer(Container arg0) {
104: this .m_resourceLabel.setSize(100, 20);
105: this .m_resourceLabel.setLocation(0, 0);
106:
107: this .m_typeLabel.setSize(100, 20);
108: this .m_typeLabel.setLocation(100, 0);
109:
110: this .m_minLabel.setSize(50, 20);
111: this .m_minLabel.setLocation(200, 0);
112:
113: this .m_maxLabel.setSize(50, 20);
114: this .m_maxLabel.setLocation(250, 0);
115: }
116:
117: /* (non-Javadoc)
118: * @see java.awt.LayoutManager#removeLayoutComponent(java.awt.Component)
119: */
120: public void removeLayoutComponent(Component arg0) {
121: }
122:
123: /* (non-Javadoc)
124: * @see java.awt.LayoutManager#addLayoutComponent(java.lang.String, java.awt.Component)
125: */
126: public void addLayoutComponent(String arg0, Component arg1) {
127: }
128:
129: /* (non-Javadoc)
130: * @see java.awt.LayoutManager#minimumLayoutSize(java.awt.Container)
131: */
132: public Dimension minimumLayoutSize(Container arg0) {
133: return this .getPreferredSize();
134: }
135:
136: /* (non-Javadoc)
137: * @see java.awt.LayoutManager#preferredLayoutSize(java.awt.Container)
138: */
139: public Dimension preferredLayoutSize(Container arg0) {
140: return this .getPreferredSize();
141: }
142:
143: /**
144: * @param arg0
145: */
146: public DomainSelectionHeader(boolean arg0) {
147: super (arg0);
148: }
149:
150: /**
151: * @param arg0
152: */
153: public DomainSelectionHeader(LayoutManager arg0) {
154: super (arg0);
155: }
156:
157: /**
158: * @param arg0
159: * @param arg1
160: */
161: public DomainSelectionHeader(LayoutManager arg0, boolean arg1) {
162: super(arg0, arg1);
163: }
164:
165: }
|