1
2
3
4
5
6
7
8
9
10
11
12
13 package com.eviware.soapui.support.components;
14
15 import java.awt.Component;
16 import java.awt.Dimension;
17
18 import javax.swing.Box;
19 import javax.swing.JButton;
20 import javax.swing.JComponent;
21 import javax.swing.JLabel;
22 import javax.swing.JToolBar;
23
24 import com.eviware.soapui.support.UISupport;
25
26 public class JXToolBar extends JToolBar
27 {
28 public void addFixed( JComponent component )
29 {
30 if( !(component instanceof JButton) )
31 UISupport.setPreferredHeight( component, 18 );
32
33 Dimension preferredSize = component.getPreferredSize();
34 component.setMinimumSize( preferredSize );
35 component.setMaximumSize( preferredSize );
36
37 add( component );
38 }
39
40 public Component add(Component component)
41 {
42 if( !(component instanceof JButton) )
43 UISupport.setPreferredHeight( component, 18 );
44
45 return super.add(component);
46 }
47
48 public void addGlue()
49 {
50 add( Box.createHorizontalGlue() );
51 }
52
53 public void addRelatedGap()
54 {
55 addSpace( 3 );
56 }
57
58 public void addUnrelatedGap()
59 {
60 addSeparator();
61 }
62
63 public void addLabeledFixed(String string, JComponent component)
64 {
65 addFixed( new JLabel( string ));
66 addSeparator( new Dimension( 3, 3 ));
67 addFixed( component );
68 }
69
70 public void addSpace(int i)
71 {
72 addSeparator( new Dimension( i, 1 ));
73 }
74 }