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.pmedv.blackboard.commands.AddDiodeCommand.java

public AddDiodeCommand() {
    putValue(Action.NAME, resources.getResourceByKey("AddDiodeCommand.name"));
    putValue(Action.SMALL_ICON, resources.getIcon("icon.diode"));
    putValue(Action.SHORT_DESCRIPTION, resources.getResourceByKey("AddDiodeCommand.description"));
    putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_O, InputEvent.CTRL_DOWN_MASK));
    setEnabled(false);/*from   www .jav  a  2 s  .co  m*/
}

From source file:net.sf.firemox.ui.component.task.TaskAction.java

/**
 * @param dbStream/*from   w w  w  .java 2 s .c  o m*/
 *          the stream containg the definition of this action.
 * @throws IOException
 *           if error occurred during the reading process from the specified
 *           input stream
 */
protected TaskAction(final InputStream dbStream) throws IOException {
    super();
    this.title = LanguageManagerMDB.getString(MToolKit.readString(dbStream));
    super.putValue(Action.NAME, "<html><b>" + title + "<b> : -");
    this.propertyKey = MToolKit.readString(dbStream);
}

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

public PasteCommand() {
    putValue(Action.NAME, resources.getResourceByKey("PasteCommand.name"));
    putValue(Action.SMALL_ICON, resources.getIcon("icon.paste"));
    putValue(Action.SHORT_DESCRIPTION, resources.getResourceByKey("PasteCommand.description"));
    putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_V, InputEvent.CTRL_DOWN_MASK));
    setEnabled(false);//from w w w . j av a  2s.  c o  m
}

From source file:net.pandoragames.far.ui.swing.component.listener.CommandRename.java

public CommandRename(UIFace uiBean, Localizer localizer, JFrame root) {
    super(uiBean);
    properties.put(Action.ACTION_COMMAND_KEY, OperationType.RENAME.name());
    properties.put(Action.NAME, localizer.localize("button.rename"));
    this.localizer = localizer;
    rootWindow = root;// ww w  . j  a v  a2  s  .  co  m
}

From source file:pl.otros.logview.gui.actions.search.SearchAction.java

public SearchAction(OtrosApplication otrosApplication, SearchDirection searchDirection) {
    super(otrosApplication);
    this.searchDirection = searchDirection;
    if (searchDirection.equals(SearchDirection.FORWARD)) {
        this.putValue(Action.NAME, "Next");
        this.putValue(Action.SMALL_ICON, Icons.ARROW_DOWN);
    } else {// w ww . jav a2  s  .  com
        this.putValue(Action.NAME, "Previous");
        this.putValue(Action.SMALL_ICON, Icons.ARROW_UP);
    }
    searchEngine = new SearchEngine();
}

From source file:eu.ggnet.dwoss.redtape.action.StateTransitionAction.java

public StateTransitionAction(Window parent, RedTapeController controller, CustomerDocument cdoc,
        StateTransition<CustomerDocument> transition) {
    this.parent = parent;
    this.cdoc = cdoc;
    this.transition = transition;
    this.controller = controller;
    putValue(Action.NAME, transition.getDescription());
    putValue(Action.SHORT_DESCRIPTION, transition.getToolTip());
    if (((RedTapeStateTransition) transition).getHints()
            .contains(RedTapeStateTransition.Hint.CHANGES_PAYMENT_METHOD_TO_DIRECT_DEBIT)
            && cdoc.getPaymentMethod() != PaymentMethod.DIRECT_DEBIT) {
        this.setEnabled(false);
    }/*from w w  w  .jav a2s .  co m*/
    if (((RedTapeStateTransition) transition).getHints()
            .contains(RedTapeStateTransition.Hint.CHANGES_PAYMENT_METHOD_TO_INVOICE)
            && cdoc.getPaymentMethod() != PaymentMethod.INVOICE) {
        this.setEnabled(false);
    }
}

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

public ConnectToSocketHubAppenderAction(OtrosApplication otrosApplication) {
    super(otrosApplication);
    putValue(Action.NAME, "Connect to Log4j socket hub");
    putValue(Action.SHORT_DESCRIPTION, "Connect to Log4j SocketHubAppender");
    putValue(Action.LONG_DESCRIPTION, "Connect to Log4j SocketHubAppender");
    putValue(SMALL_ICON, Icons.PLUGIN_CONNECT);

}

From source file:net.sf.jabref.importer.ImportFormats.java

/**
 * Create an AbstractAction for performing an Import operation.
 * @param frame The JabRefFrame of this JabRef instance.
 * @param openInNew Indicate whether the action should open into a new database or
 *  into the currently open one./* w  w  w . j a va  2  s.c  o m*/
 * @return The action.
 */
public static AbstractAction getImportAction(JabRefFrame frame, boolean openInNew) {

    class ImportAction extends MnemonicAwareAction {

        private final JabRefFrame frame;
        private final boolean openInNew;

        public ImportAction(JabRefFrame frame, boolean openInNew) {
            this.frame = frame;
            this.openInNew = openInNew;

            putValue(Action.NAME, openInNew ? Localization.menuTitle("Import into new database")
                    : Localization.menuTitle("Import into current database"));
            putValue(Action.ACCELERATOR_KEY,
                    openInNew ? Globals.getKeyPrefs().getKey(KeyBinding.IMPORT_INTO_NEW_DATABASE)
                            : Globals.getKeyPrefs().getKey(KeyBinding.IMPORT_INTO_CURRENT_DATABASE));
        }

        @Override
        public void actionPerformed(ActionEvent e) {
            JFileChooser fileChooser = createImportFileChooser(
                    Globals.prefs.get(JabRefPreferences.IMPORT_WORKING_DIRECTORY));
            int result = fileChooser.showOpenDialog(frame);

            if (result != JFileChooser.APPROVE_OPTION) {
                return;
            }

            File file = fileChooser.getSelectedFile();
            if (file == null) {
                return;
            }

            FileFilter ff = fileChooser.getFileFilter();
            ImportFormat format = null;
            if (ff instanceof ImportFileFilter) {
                format = ((ImportFileFilter) ff).getImportFormat();
            }

            try {
                if (!file.exists()) {
                    // Warn that the file doesn't exists:
                    JOptionPane.showMessageDialog(frame,
                            Localization.lang("File not found") + ": '" + file.getName() + "'.",
                            Localization.lang("Import"), JOptionPane.ERROR_MESSAGE);
                    return;
                }
                ImportMenuItem imi = new ImportMenuItem(frame, openInNew, format);
                imi.automatedImport(Collections.singletonList(file.getAbsolutePath()));

                // Make sure we remember which filter was used, to set the default
                // for next time:
                if (format == null) {
                    Globals.prefs.put(JabRefPreferences.LAST_USED_IMPORT, "__all");
                } else {
                    Globals.prefs.put(JabRefPreferences.LAST_USED_IMPORT, format.getFormatName());
                }
                Globals.prefs.put(JabRefPreferences.IMPORT_WORKING_DIRECTORY, file.getParent());
            } catch (Exception ex) {
                LOGGER.warn("Problem with import format", ex);
            }

        }
    }

    return new ImportAction(frame, openInNew);
}

From source file:com.floreantpos.actions.ClockInOutAction.java

public ClockInOutAction(boolean showText, boolean showIcon) {
    if (showText) {
        putValue(Action.NAME, Messages.getString("ClockInOutAction.1")); //$NON-NLS-1$
    }//  www  .j  av a  2  s .co m
    if (showIcon) {
        putValue(Action.SMALL_ICON, IconFactory.getIcon("/ui_icons/", "clock_out.png")); //$NON-NLS-1$ //$NON-NLS-2$
    }
}

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

public ConvertToSymbolCommand() {
    putValue(Action.NAME, resources.getResourceByKey("ConvertToSymbolCommand.name"));
    putValue(Action.SMALL_ICON, resources.getIcon("icon.converttosymbol"));
    putValue(Action.SHORT_DESCRIPTION, resources.getResourceByKey("ConvertToSymbolCommand.description"));
    putValue(Action.ACCELERATOR_KEY,
            KeyStroke.getKeyStroke(KeyEvent.VK_S, InputEvent.ALT_DOWN_MASK | InputEvent.SHIFT_DOWN_MASK));
    setEnabled(false);/* w  ww. jav a  2s. co m*/
}