KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sshtools > ui > swing > ToolBarSeparator


1 /*
2  * SSHTools - Java SSH2 API
3  *
4  * Copyright (C) 2002 Lee David Painter.
5  *
6  * This program is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Library General Public License
8  * as published by the Free Software Foundation; either version 2 of
9  * the License, or (at your option) any later version.
10  *
11  * You may also distribute it and/or modify it under the terms of the
12  * Apache style J2SSH Software License. A copy of which should have
13  * been provided with the distribution.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  * License document supplied with your distribution for more details.
19  *
20  */

21
22 package com.sshtools.ui.swing;
23
24 import java.awt.Dimension JavaDoc;
25 import javax.swing.JSeparator JavaDoc;
26 import javax.swing.JToolBar JavaDoc;
27
28 /**
29  *
30  *
31  * @author $author$
32  */

33
34 public class ToolBarSeparator
35
36 extends JSeparator JavaDoc {
37
38     /**
39      * Creates a new ToolBarSeparator object.
40      */

41
42     public ToolBarSeparator() {
43         super(JSeparator.VERTICAL);
44
45     }
46
47     /**
48      * Creates a new ToolBarSeparator object.
49      */

50
51     public ToolBarSeparator(int orientation) {
52         super(orientation);
53
54     }
55
56     /**
57      *
58      *
59      * @return
60      */

61
62     public Dimension JavaDoc getMaximumSize() {
63         return (((JToolBar JavaDoc) getParent()).getOrientation() == JToolBar.HORIZONTAL) ? new Dimension JavaDoc(4, super.getMaximumSize().height)
64             : new Dimension JavaDoc(super.getMaximumSize().width, 4);
65
66     }
67
68     /**
69      *
70      */

71
72     public void doLayout() {
73         setOrientation((((JToolBar JavaDoc) getParent()).getOrientation() == JToolBar.HORIZONTAL) ? JSeparator.VERTICAL
74             : JSeparator.HORIZONTAL);
75
76     }
77
78 }
79
Popular Tags