Example usage for javax.swing Action NAME

List of usage examples for javax.swing Action NAME

Introduction

In this page you can find the example usage for javax.swing Action NAME.

Prototype

String NAME

To view the source code for javax.swing Action NAME.

Click Source Link

Document

The key used for storing the String name for the action, used for a menu or button.

Usage

From source file:org.jdal.swing.IconAction.java

public String getName() {
    return (String) getValue(Action.NAME);
}

From source file:Main.java

public void actionPerformed(ActionEvent e) {
    System.out.println("Selected: " + getValue(Action.NAME));
}

From source file:org.pmedv.blackboard.commands.SaveNetlistCommand.java

public SaveNetlistCommand() {
    putValue(Action.NAME, resources.getResourceByKey("SaveNetlistCommand.name"));
    putValue(Action.SMALL_ICON, resources.getIcon("icon.save"));
    putValue(Action.SHORT_DESCRIPTION, resources.getResourceByKey("SaveNetlistCommand.description"));
}

From source file:MainClass.java

public MainClass() {
    JFrame frame = new JFrame();
    JTextPane textPane = new JTextPane();
    JScrollPane scrollPane = new JScrollPane(textPane);

    JPanel north = new JPanel();

    JMenuBar menu = new JMenuBar();
    JMenu styleMenu = new JMenu();
    styleMenu.setText("Style");

    Action boldAction = new BoldAction();
    boldAction.putValue(Action.NAME, "Bold");
    styleMenu.add(boldAction);/*  ww w.  j a va2s .c o  m*/

    Action italicAction = new ItalicAction();
    italicAction.putValue(Action.NAME, "Italic");
    styleMenu.add(italicAction);

    Action foregroundAction = new ForegroundAction();
    foregroundAction.putValue(Action.NAME, "Color");
    styleMenu.add(foregroundAction);

    Action formatTextAction = new FontAndSizeAction();
    formatTextAction.putValue(Action.NAME, "Font and Size");
    styleMenu.add(formatTextAction);

    menu.add(styleMenu);

    north.add(menu);
    frame.getContentPane().setLayout(new BorderLayout());
    frame.getContentPane().add(north, BorderLayout.NORTH);
    frame.getContentPane().add(scrollPane, BorderLayout.CENTER);
    frame.setSize(800, 500);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setVisible(true);
}

From source file:com.sshtools.common.ui.NewWindowAction.java

/**
 * Creates a new NewWindowAction object.
 *
 * @param application/*w  w w .  j  a va2 s  .c  om*/
 */
public NewWindowAction(SshToolsApplication application) {
    this.application = application;

    putValue(Action.NAME, "New Window");
    putValue(Action.SMALL_ICON, getIcon("/com/sshtools/common/ui/newwindow.png"));
    putValue(LARGE_ICON, getIcon("/com/sshtools/common/ui/largenewwindow.png"));
    putValue(Action.SHORT_DESCRIPTION, "Create new window");
    putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_W, KeyEvent.ALT_MASK));
    putValue(Action.LONG_DESCRIPTION, "Create a new SSHTerm window");
    putValue(Action.MNEMONIC_KEY, new Integer('w'));
    putValue(Action.ACTION_COMMAND_KEY, "new-window");
    putValue(StandardAction.ON_MENUBAR, new Boolean(true));
    putValue(StandardAction.MENU_NAME, "File");
    putValue(StandardAction.MENU_ITEM_GROUP, new Integer(0));
    putValue(StandardAction.MENU_ITEM_WEIGHT, new Integer(90));
    putValue(StandardAction.ON_TOOLBAR, new Boolean(true));
    putValue(StandardAction.TOOLBAR_GROUP, new Integer(0));
    putValue(StandardAction.TOOLBAR_WEIGHT, new Integer(90));
}

From source file:ro.nextreports.designer.action.tools.RestoreDockingAction.java

public RestoreDockingAction() {
    putValue(Action.NAME, I18NSupport.getString("restore.docking.action.name"));
    putValue(Action.SMALL_ICON, ImageUtil.getImageIcon("docking_restore"));
    putValue(Action.MNEMONIC_KEY, ShortcutsUtil.getMnemonic("layout.reset.mnemonic", new Integer('L')));
    putValue(Action.ACCELERATOR_KEY,
            KeyStroke.getKeyStroke(ShortcutsUtil.getShortcut("layout.reset.accelerator", "control L")));
    putValue(Action.SHORT_DESCRIPTION, I18NSupport.getString("restore.docking.action.name"));
    putValue(Action.LONG_DESCRIPTION, I18NSupport.getString("restore.docking.action.name"));
}

From source file:org.pentaho.reporting.designer.core.actions.global.LaunchHelpAction.java

public LaunchHelpAction() {
    putValue(Action.NAME, ActionMessages.getString("LaunchHelpAction.Text"));
    putValue(Action.SHORT_DESCRIPTION, ActionMessages.getString("LaunchHelpAction.Description"));
    putValue(Action.MNEMONIC_KEY, ActionMessages.getOptionalMnemonic("LaunchHelpAction.Mnemonic"));
    putValue(Action.ACCELERATOR_KEY, ActionMessages.getOptionalKeyStroke("LaunchHelpAction.Accelerator"));
}

From source file:State.java

/**
 * @param process the process to set//w w w  .  j a  v  a2s.  c o m
 */
public void setProcess(int process) {
    this.process = process;
    if (process == 100) {
        setState(Uploaded);
        apkItem.putValue(Action.NAME, "?");
        apkItem.setEnabled(true);
    } else {
        setState(Uploading);
        apkItem.putValue(Action.NAME, "");
        apkItem.setEnabled(false);
    }
}

From source file:pl.otros.logview.gui.actions.StartSocketListener.java

public StartSocketListener(OtrosApplication otrosApplication, Collection<SocketLogReader> logReaders) {
    super(otrosApplication);
    this.logReaders = logReaders;
    putValue(Action.NAME, "Start socket listener");
    putValue(Action.SHORT_DESCRIPTION, "Start socket listener on port.");
    putValue(Action.LONG_DESCRIPTION, "Start socket listener on port.");
    putValue(SMALL_ICON, Icons.PLUGIN_PLUS);

}

From source file:com.sshtools.appframework.api.ui.ToolsBuilder.java

public void rebuildActionComponents() {
    log.debug("Rebuilding action components");

    // Determine which actions are available
    List<AppAction> enabledActions = new ArrayList<AppAction>();
    for (AppAction action : listActions()) {
        try {//from  w  w  w  . j  a  v a2  s .  co m
            String n = (String) action.getValue(Action.NAME);
            if (isActionVisible(n)) {
                enabledActions.add(action);
            }
        } catch (NullPointerException npe) {
        }
    }
    log.debug("There are " + enabledActions.size() + " actions enabled");

    rebuildForActions(enabledActions);

    // Done
    resetActionState();
    log.debug("Rebuilt action components");
}