1 /*
2 * JScroll - the scrollable desktop pane for Java.
3 * Copyright (C) 2003 Tom Tessier
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 *
19 */
20
21 package org.jscroll.widgets;
22
23 import org.jscroll.components.*;
24
25 import java.awt.Dimension;
26 import java.awt.event.ActionEvent;
27 import java.awt.event.ActionListener;
28
29
30 /***
31 * This class provides the resizable toolbar for the scrollable desktop.
32 *
33 * @author <a href="mailto:tessier@gabinternet.com">Tom Tessier</a>
34 * @version 1.0 11-Aug-2001
35 */
36 public class DesktopResizableToolBar extends ResizableToolBar
37 implements DesktopConstants, ActionListener {
38 private DesktopMediator desktopMediator;
39
40 /***
41 * creates the DesktopResizableToolBar object
42 *
43 * @param desktopMediator a reference to the DesktopMediator object
44 */
45 public DesktopResizableToolBar(DesktopMediator desktopMediator) {
46 super(MINIMUM_BUTTON_WIDTH, MAXIMUM_BUTTON_WIDTH);
47
48 this.desktopMediator = desktopMediator;
49
50 // prepare test button
51 RootToggleButton testButton = new RootToggleButton("test");
52
53 // now add a button-sized separator to the toolBar so that
54 // the layout manager can properly setup
55 addSeparator(new Dimension(0, testButton.getMinimumSize().height));
56 }
57
58 /***
59 * creates a RootToggleButton and adds it to the toolbar
60 *
61 * @param title the title of the toggle button
62 *
63 * @return the toggle button that was created
64 */
65 public RootToggleButton add(String title) {
66 RootToggleButton toolButton = new RootToggleButton(" " + title + " ");
67 toolButton.addActionListener(this);
68
69 super.add(toolButton);
70
71 return toolButton;
72 }
73
74 /***
75 * propogates actionPerformed button event to DesktopMediator
76 *
77 * @param e the ActionEvent to propogate
78 */
79 public void actionPerformed(ActionEvent e) {
80 desktopMediator.actionPerformed(e);
81 }
82 }
This page was automatically generated by Maven