2
* JScroll - the scrollable desktop pane for Java.
3
* Copyright (C) 2003 Tom Tessier
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.
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.
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.
21
package org.jscroll.widgets;
25
import java.awt.event.*;
29
* This class constructs the "Window" menu items for use by
30
* {@link org.jscroll.widgets.DesktopMenu DesktopMenu}.
32
* @author <a href="mailto:tessier@gabinternet.com">Tom Tessier</a>
33
* @version 1.0 11-Aug-2001
35
public class ConstructWindowMenu implements ActionListener {
36
private DesktopMediator desktopMediator;
39
* creates the ConstructWindowMenu object.
41
* @param sourceMenu the source menu to apply the menu items
42
* @param desktopMediator a reference to the DesktopMediator
43
* @param tileMode the current tile mode (tile or cascade)
45
public ConstructWindowMenu(JMenu sourceMenu,
46
DesktopMediator desktopMediator, boolean tileMode) {
47
this.desktopMediator = desktopMediator;
48
constructMenuItems(sourceMenu, tileMode);
52
* constructs the actual menu items.
54
* @param sourceMenu the source menu to apply the menu items
55
* @param tileMode the current tile mode
57
private void constructMenuItems(JMenu sourceMenu, boolean tileMode) {
58
sourceMenu.add(new RootMenuItem(this, "Tile", KeyEvent.VK_T, -1));
59
sourceMenu.add(new RootMenuItem(this, "Cascade", KeyEvent.VK_C, -1));
60
sourceMenu.addSeparator();
62
JMenu autoMenu = new JMenu("Auto");
63
autoMenu.setMnemonic(KeyEvent.VK_U);
65
ButtonGroup autoMenuGroup = new ButtonGroup();
66
JRadioButtonMenuItem radioItem = new RootRadioButtonMenuItem(this,
67
"Tile", KeyEvent.VK_T, -1, tileMode);
68
autoMenu.add(radioItem);
69
autoMenuGroup.add(radioItem);
71
radioItem = new RootRadioButtonMenuItem(this, "Cascade", KeyEvent.VK_C,
73
autoMenu.add(radioItem);
74
autoMenuGroup.add(radioItem);
76
sourceMenu.add(autoMenu);
77
sourceMenu.addSeparator();
79
sourceMenu.add(new RootMenuItem(this, "Close", KeyEvent.VK_S,
81
sourceMenu.addSeparator();
85
* propogates actionPerformed menu event to the DesktopMediator reference
87
* @param e the ActionEvent to propogate
89
public void actionPerformed(ActionEvent e) {
90
desktopMediator.actionPerformed(e);