~ubuntu-branches/ubuntu/vivid/drmips/vivid-backports

« back to all changes in this revision

Viewing changes to src/pc/DrMIPS/src/org/jscroll/widgets/ConstructWindowMenu.java

  • Committer: Package Import Robot
  • Author(s): Micah Gersten
  • Date: 2015-06-09 14:15:06 UTC
  • mfrom: (2.2.1 sid)
  • Revision ID: package-import@ubuntu.com-20150609141506-up1gbfgqxgmj7e7a
Tags: 1.3.0-2~ubuntu15.04.1
No-change backport to vivid (LP: #1458035)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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 javax.swing.*;
 
24
 
 
25
import java.awt.event.*;
 
26
 
 
27
 
 
28
/**
 
29
 * This class constructs the "Window" menu items for use by
 
30
 * {@link org.jscroll.widgets.DesktopMenu DesktopMenu}.
 
31
 *
 
32
 * @author <a href="mailto:tessier@gabinternet.com">Tom Tessier</a>
 
33
 * @version 1.0  11-Aug-2001
 
34
 */
 
35
public class ConstructWindowMenu implements ActionListener {
 
36
    private DesktopMediator desktopMediator;
 
37
 
 
38
    /**
 
39
     * creates the ConstructWindowMenu object.
 
40
     *
 
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)
 
44
     */
 
45
    public ConstructWindowMenu(JMenu sourceMenu,
 
46
        DesktopMediator desktopMediator, boolean tileMode) {
 
47
        this.desktopMediator = desktopMediator;
 
48
        constructMenuItems(sourceMenu, tileMode);
 
49
    }
 
50
 
 
51
    /**
 
52
     * constructs the actual menu items.
 
53
     *
 
54
     * @param sourceMenu the source menu to apply the menu items
 
55
     * @param tileMode the current tile mode
 
56
     */
 
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();
 
61
 
 
62
        JMenu autoMenu = new JMenu("Auto");
 
63
        autoMenu.setMnemonic(KeyEvent.VK_U);
 
64
 
 
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);
 
70
 
 
71
        radioItem = new RootRadioButtonMenuItem(this, "Cascade", KeyEvent.VK_C,
 
72
                -1, !tileMode);
 
73
        autoMenu.add(radioItem);
 
74
        autoMenuGroup.add(radioItem);
 
75
 
 
76
        sourceMenu.add(autoMenu);
 
77
        sourceMenu.addSeparator();
 
78
 
 
79
        sourceMenu.add(new RootMenuItem(this, "Close", KeyEvent.VK_S,
 
80
                KeyEvent.VK_Z));
 
81
        sourceMenu.addSeparator();
 
82
    }
 
83
 
 
84
    /**
 
85
     * propogates actionPerformed menu event to the DesktopMediator reference
 
86
     *
 
87
     * @param e the ActionEvent to propogate
 
88
     */
 
89
    public void actionPerformed(ActionEvent e) {
 
90
        desktopMediator.actionPerformed(e);
 
91
    }
 
92
}