Java Swing Menu constructViewMenu(ActionListener act, boolean showUMLOption, boolean showShortenedSourceOption, boolean showJavadocsOption, boolean showSourceOption)

Here you can find the source of constructViewMenu(ActionListener act, boolean showUMLOption, boolean showShortenedSourceOption, boolean showJavadocsOption, boolean showSourceOption)

Description

Constructs a JMenu holding options to view a SingleUMLGUI, ShortenedSourceGUI, JavadocsGUI, or SourceCodeGUI for an Interface object.

License

Open Source License

Parameter

Parameter Description
act The object that will be listening for ActionEvents.
showUMLOption True if the option to view a SingleUMLGUI should be given.
showShortenedSourceOption True if the option to view a ShortenedSourceGUI should be given.
showJavadocsOption True if the option to view a JavadocsGUI should be given.
showSourceOption True if the option to view a SourceCodeGUI should be given.

Return

The corresponding JMenu.

Declaration

public static JMenu constructViewMenu(ActionListener act, boolean showUMLOption,
        boolean showShortenedSourceOption, boolean showJavadocsOption, boolean showSourceOption) 

Method Source Code

//package com.java2s;
/*/*  w  ww .java2s  .  co m*/
 * File:  InternalFrameUtilities.java
 *
 * Copyright (C) 2004 Dominic Kramer
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this library; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307, USA.
 *
 * Contact : Dennis Mikkelson <mikkelsond@uwstout.edu>
 *           Dominic Kramer <kramerd@uwstout.edu>
 *           Department of Mathematics, Statistics and Computer Science
 *           University of Wisconsin-Stout
 *           Menomonie, WI 54751, USA
 *
 * This work was supported by the Intense Pulsed Neutron Source Division
 * of Argonne National Laboratory, Argonne, IL 60439-4845, USA and by
 * the National Science Foundation under grant number DMR-0218882.
 *
 * For further information, see <http://www.pns.anl.gov/ISAW/>
 *
 * Modified:
 *
 * $Log$
 * Revision 1.2  2004/05/26 19:46:46  kramer
 * Added Javadoc documentation.
 *
 * Revision 1.1  2004/03/12 19:47:40  bouzekc
 * Added to CVS.
 *
 */

import java.awt.event.ActionListener;

import javax.swing.JMenu;
import javax.swing.JMenuItem;

public class Main {
    /**
     * Constructs a JMenu holding options to view a SingleUMLGUI, ShortenedSourceGUI, JavadocsGUI, or SourceCodeGUI for an Interface object.
     * @param act The object that will be listening for ActionEvents.
     * @param showUMLOption True if the option to view a SingleUMLGUI should be given.
     * @param showShortenedSourceOption True if the option to view a ShortenedSourceGUI should be given.
     * @param showJavadocsOption True if the option to view a JavadocsGUI should be given.
     * @param showSourceOption True if the option to view a SourceCodeGUI should be given.
     * @return The corresponding JMenu.
     */
    public static JMenu constructViewMenu(ActionListener act, boolean showUMLOption,
            boolean showShortenedSourceOption, boolean showJavadocsOption, boolean showSourceOption) {
        JMenu viewMenu = new JMenu("View");
        if (showUMLOption) {
            JMenuItem viewUML = new JMenuItem("Single UML");
            viewUML.setActionCommand("view.uml");
            viewUML.addActionListener(act);
            viewMenu.add(viewUML);
        }
        if (showShortenedSourceOption) {
            JMenuItem viewShortenedSource = new JMenuItem("Shortened Source Code");
            viewShortenedSource.setActionCommand("view.shortenedSource");
            viewShortenedSource.addActionListener(act);
            viewMenu.add(viewShortenedSource);
        }
        if (showJavadocsOption) {
            JMenuItem viewJavadocs = new JMenuItem("Javadocs");
            viewJavadocs.setActionCommand("view.javadocs");
            viewJavadocs.addActionListener(act);
            viewMenu.add(viewJavadocs);
        }
        if (showSourceOption) {
            JMenuItem viewSource = new JMenuItem("Source Code");
            viewSource.setActionCommand("view.sourceCode");
            viewSource.addActionListener(act);
            viewMenu.add(viewSource);
        }
        return viewMenu;
    }
}

Related

  1. addHoverEffect4MenuAbout(final Component component, final Color overbgcolor, final Color overfgcolor, final Color outbgcolor, final Color outfgcolor)
  2. addRCMenuMouseListener(final JTextComponent text)
  3. appendMenuSubElements(MenuElement element, StringBuilder builder, String indent)
  4. applyContextMenuFontRecurse(MenuElement item, Font font)
  5. buildManualsMenu(File appDir)
  6. createActionMenu(JTextComponent text, boolean includeModifying)
  7. createMenu(final String label, final String mnemonic, final String accessibleDescription)
  8. createMenu(final String name, final int mnemonic)
  9. createMenu(final String text)