01: /*
02: * Gruntspud
03: *
04: * Copyright (C) 2002 Brett Smith.
05: *
06: * Written by: Brett Smith <t_magicthize@users.sourceforge.net>
07: *
08: * This program is free software; you can redistribute it and/or
09: * modify it under the terms of the GNU Library General Public License
10: * as published by the Free Software Foundation; either version 2 of
11: * the License, or (at your option) any later version.
12: * This program is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15: * GNU Library General Public License for more details.
16: *
17: * You should have received a copy of the GNU Library General Public
18: * License along with this program; if not, write to the Free Software
19: * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20: */
21:
22: package gruntspud.ui;
23:
24: import java.awt.Dimension;
25:
26: import javax.swing.JSeparator;
27: import javax.swing.JToolBar;
28:
29: /**
30: * Description of the Class
31: *
32: *@author magicthize
33: *@created 26 May 2002
34: */
35: public class ToolBarSeparator extends JSeparator {
36: /**
37: * Constructor for the ToolBarSeparator object
38: */
39: public ToolBarSeparator() {
40: super (JSeparator.VERTICAL);
41: }
42:
43: /**
44: * Description of the Method
45: */
46: public void doLayout() {
47: setOrientation((((JToolBar) getParent()).getOrientation() == JToolBar.HORIZONTAL) ? JSeparator.VERTICAL
48: : JSeparator.HORIZONTAL);
49: }
50:
51: /**
52: * Gets the maximumSize attribute of the ToolBarSeparator object
53: *
54: *@return The maximumSize value
55: */
56: public Dimension getMaximumSize() {
57: return (((JToolBar) getParent()).getOrientation() == JToolBar.HORIZONTAL) ? new Dimension(
58: 4, super .getMaximumSize().height)
59: : new Dimension(super .getMaximumSize().width, 4);
60: }
61:
62: /**
63: * Gets the maximumSize attribute of the ToolBarSeparator object
64: *
65: *@return The maximumSize value
66: */
67: public Dimension getxPreferredSize() {
68: return (((JToolBar) getParent()).getOrientation() == JToolBar.HORIZONTAL) ? new Dimension(
69: 4, super .getPreferredSize().height)
70: : new Dimension(super .getPreferredSize().width, 4);
71: }
72:
73: /**
74: * Gets the maximumSize attribute of the ToolBarSeparator object
75: *
76: *@return The maximumSize value
77: */
78: public Dimension getxMinimumSize() {
79: return (((JToolBar) getParent()).getOrientation() == JToolBar.HORIZONTAL) ? new Dimension(
80: 4, super .getMinimumSize().height)
81: : new Dimension(super .getMinimumSize().width, 4);
82: }
83: }
|