View Javadoc

1   /*
2    * $Id: TitleBar.java,v 1.1 2006/03/25 22:50:25 edankert Exp $
3    *
4    * The contents of this file are subject to the Mozilla Public License 
5    * Version 1.1 (the "License"); you may not use this file except in 
6    * compliance with the License. You may obtain a copy of the License at 
7    * http://www.mozilla.org/MPL/ 
8    *
9    * Software distributed under the License is distributed on an "AS IS" basis, 
10   * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License 
11   * for the specific language governing rights and limitations under the License.
12   *
13   * The Original Code is XML Hammer code. (org.xmlhammer.*)
14   *
15   * The Initial Developer of the Original Code is Edwin Dankert. Portions created 
16   * by the Initial Developer are Copyright (C) 2002 - 2006 the Initial Developer. 
17   * All Rights Reserved.
18   *
19   * Contributor(s): Edwin Dankert <edankert@gmail.com>
20   */
21  
22  
23  package org.xmlhammer.gui.util;
24  
25  import java.awt.Dimension;
26  
27  import javax.swing.Box;
28  import javax.swing.JComboBox;
29  import javax.swing.JLabel;
30  import javax.swing.JToolBar;
31  
32  /***
33   * Put comment...
34   * 
35   * @version $Revision: 1.1 $, $Date: 2006/03/25 22:50:25 $
36   * @author Edwin Dankert <edankert@gmail.com>
37   */
38  
39  public class TitleBar extends JToolBar {
40  
41  	private static final long serialVersionUID = 1L;
42  
43  	/***
44  	 * 
45  	 * @param label
46  	 * @param combo
47  	 * @param background
48  	 */
49  	public TitleBar( String label, JComboBox combo) {
50  		super();
51  
52  		setRollover( true);
53  		setFloatable( false);
54  		
55  		JLabel l = new JLabel( label);
56  		
57  		add( Box.createHorizontalStrut( 2));
58  		
59  		if ( combo == null) { 
60  			JComboBox c = new JComboBox();
61  			l.setPreferredSize( new Dimension( l.getPreferredSize().width, c.getPreferredSize().height));
62  		}
63  		
64  		add( l);
65  		
66  		if ( combo != null) {
67  			addSeparator();
68  			combo.setMaximumSize( combo.getPreferredSize());
69  			add( combo);
70  		}
71  		
72  		add( Box.createHorizontalGlue());
73  	}
74  
75  	public TitleBar( String label) {
76  		this( label, null);
77  	}
78  }