Example usage for javax.swing Action SMALL_ICON

List of usage examples for javax.swing Action SMALL_ICON

Introduction

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

Prototype

String SMALL_ICON

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

Click Source Link

Document

The key used for storing a small Icon, such as ImageIcon.

Usage

From source file:ca.sfu.federation.action.CreateComponentAction.java

public CreateComponentAction() {
    super("Create Componnet", null);
    Icon icon = ImageIconUtils.loadIconById("model-create-component");
    this.putValue(Action.LONG_DESCRIPTION, "Create Component");
    this.putValue(Action.MNEMONIC_KEY, KeyEvent.VK_C);
    this.putValue(Action.SHORT_DESCRIPTION, "Create Component");
    this.putValue(Action.SMALL_ICON, icon);
}

From source file:Main.java

protected void makeActionsPretty() {
    Action a;// w  w w .  j  a v  a 2  s.c om
    a = textComp.getActionMap().get(DefaultEditorKit.cutAction);
    a.putValue(Action.SMALL_ICON, new ImageIcon("cut.gif"));
    a.putValue(Action.NAME, "Cut");

    a = textComp.getActionMap().get(DefaultEditorKit.copyAction);
    a.putValue(Action.SMALL_ICON, new ImageIcon("copy.gif"));
    a.putValue(Action.NAME, "Copy");

    a = textComp.getActionMap().get(DefaultEditorKit.pasteAction);
    a.putValue(Action.SMALL_ICON, new ImageIcon("paste.gif"));
    a.putValue(Action.NAME, "Paste");

    a = textComp.getActionMap().get(DefaultEditorKit.selectAllAction);
    a.putValue(Action.NAME, "Select All");
}

From source file:com.sshtools.sshterm.FullScreenAction.java

public FullScreenAction(SshToolsApplication application, SshToolsApplicationContainer container) {
    this.application = application;
    this.container = container;
    putValue(Action.NAME, NAME_FULL_SCREEN);
    putValue(Action.SMALL_ICON, getIcon(SMALL_ICON_FULL_SCREEN));
    putValue(LARGE_ICON, getIcon(LARGE_ICON_FULL_SCREEN));
    putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_F, KeyEvent.ALT_MASK));
    putValue(Action.SHORT_DESCRIPTION, SHORT_DESCRIPTION_FULL_SCREEN);
    putValue(Action.LONG_DESCRIPTION, LONG_DESCRIPTION_FULL_SCREEN);
    putValue(Action.MNEMONIC_KEY, new Integer(MNEMONIC_KEY_FULL_SCREEN));
    putValue(Action.ACTION_COMMAND_KEY, ACTION_COMMAND_KEY_FULL_SCREEN);
    putValue(StandardAction.ON_MENUBAR, new Boolean(true));
    putValue(StandardAction.MENU_NAME, "View");
    putValue(StandardAction.MENU_ITEM_GROUP, new Integer(20));
    putValue(StandardAction.MENU_ITEM_WEIGHT, new Integer(20));
    putValue(StandardAction.ON_TOOLBAR, new Boolean(true));
    putValue(StandardAction.TOOLBAR_GROUP, new Integer(5));
    putValue(StandardAction.TOOLBAR_WEIGHT, new Integer(30));
}

From source file:com.sshtools.powervnc.VncFullScreenAction.java

public VncFullScreenAction(SshToolsApplication application, SshToolsApplicationContainer container) {
    this.application = application;
    this.container = container;
    putValue(Action.NAME, NAME_FULL_SCREEN);
    putValue(Action.SMALL_ICON, getIcon(SMALL_ICON_FULL_SCREEN));
    putValue(LARGE_ICON, getIcon(LARGE_ICON_FULL_SCREEN));
    putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_F, KeyEvent.ALT_MASK));
    putValue(Action.SHORT_DESCRIPTION, SHORT_DESCRIPTION_FULL_SCREEN);
    putValue(Action.LONG_DESCRIPTION, LONG_DESCRIPTION_FULL_SCREEN);
    putValue(Action.MNEMONIC_KEY, new Integer(MNEMONIC_KEY_FULL_SCREEN));
    putValue(Action.ACTION_COMMAND_KEY, ACTION_COMMAND_KEY_FULL_SCREEN);
    putValue(StandardAction.ON_MENUBAR, new Boolean(true));
    putValue(StandardAction.MENU_NAME, "View");
    putValue(StandardAction.MENU_ITEM_GROUP, new Integer(20));
    putValue(StandardAction.MENU_ITEM_WEIGHT, new Integer(20));
    putValue(StandardAction.ON_TOOLBAR, new Boolean(true));
    putValue(StandardAction.TOOLBAR_GROUP, new Integer(5));
    putValue(StandardAction.TOOLBAR_WEIGHT, new Integer(30));
}

From source file:MainClass.java

public ShowAction(Component parentComponent) {
    super("About");
    putValue(Action.MNEMONIC_KEY, new Integer(KeyEvent.VK_A));
    putValue(Action.SMALL_ICON, MetalIconFactory.getFileChooserHomeFolderIcon());

    this.parentComponent = parentComponent;
}

From source file:ca.sfu.federation.action.CreateProjectAction.java

/**
 * CreateProjectAction default constructor.
 *//*from   ww  w . ja  v  a2s  .c o  m*/
public CreateProjectAction() {
    super("New Project", null);
    Icon icon = ImageIconUtils.loadIconById("file-new-project-icon");
    this.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke("control shift N"));
    this.putValue(Action.LONG_DESCRIPTION, "Create a new project");
    this.putValue(Action.MNEMONIC_KEY, KeyEvent.VK_N);
    this.putValue(Action.SHORT_DESCRIPTION, "Create a new project");
    this.putValue(Action.SMALL_ICON, icon);
}

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$
    }//from  w  w w .ja v a  2s . c o m
    if (showIcon) {
        putValue(Action.SMALL_ICON, IconFactory.getIcon("/ui_icons/", "clock_out.png")); //$NON-NLS-1$ //$NON-NLS-2$
    }
}

From source file:ca.sfu.federation.action.CreateProjectAction.java

/**
 * CreateProjectAction constructor./*from   ww w  .  j  av a 2s. c  om*/
 * @param Name Action name that will appear in menus.
 * @param MyIcon Action icon.
 * @param ToolTip Action description that will appear in Tool Tip.
 * @param MnemonicId Key mnemonic.
 */
public CreateProjectAction(String Name, Icon MyIcon, String ToolTip, Integer MnemonicId) {
    super(Name, MyIcon);
    this.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke("control N"));
    this.putValue(Action.LONG_DESCRIPTION, ToolTip);
    this.putValue(Action.MNEMONIC_KEY, MnemonicId);
    this.putValue(Action.SHORT_DESCRIPTION, ToolTip);
    this.putValue(Action.SMALL_ICON, MyIcon);
}

From source file:MenuTest.java

public MenuFrame() {
    setTitle("MenuTest");
    setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);

    JMenu fileMenu = new JMenu("File");
    fileMenu.add(new TestAction("New"));

    // demonstrate accelerators

    JMenuItem openItem = fileMenu.add(new TestAction("Open"));
    openItem.setAccelerator(KeyStroke.getKeyStroke("ctrl O"));

    fileMenu.addSeparator();/*from w ww  .  ja va 2s. c om*/

    saveAction = new TestAction("Save");
    JMenuItem saveItem = fileMenu.add(saveAction);
    saveItem.setAccelerator(KeyStroke.getKeyStroke("ctrl S"));

    saveAsAction = new TestAction("Save As");
    fileMenu.add(saveAsAction);
    fileMenu.addSeparator();

    fileMenu.add(new AbstractAction("Exit") {
        public void actionPerformed(ActionEvent event) {
            System.exit(0);
        }
    });

    // demonstrate check box and radio button menus

    readonlyItem = new JCheckBoxMenuItem("Read-only");
    readonlyItem.addActionListener(new ActionListener() {
        public void actionPerformed(ActionEvent event) {
            boolean saveOk = !readonlyItem.isSelected();
            saveAction.setEnabled(saveOk);
            saveAsAction.setEnabled(saveOk);
        }
    });

    ButtonGroup group = new ButtonGroup();

    JRadioButtonMenuItem insertItem = new JRadioButtonMenuItem("Insert");
    insertItem.setSelected(true);
    JRadioButtonMenuItem overtypeItem = new JRadioButtonMenuItem("Overtype");

    group.add(insertItem);
    group.add(overtypeItem);

    // demonstrate icons

    Action cutAction = new TestAction("Cut");
    cutAction.putValue(Action.SMALL_ICON, new ImageIcon("cut.gif"));
    Action copyAction = new TestAction("Copy");
    copyAction.putValue(Action.SMALL_ICON, new ImageIcon("copy.gif"));
    Action pasteAction = new TestAction("Paste");
    pasteAction.putValue(Action.SMALL_ICON, new ImageIcon("paste.gif"));

    JMenu editMenu = new JMenu("Edit");
    editMenu.add(cutAction);
    editMenu.add(copyAction);
    editMenu.add(pasteAction);

    // demonstrate nested menus

    JMenu optionMenu = new JMenu("Options");

    optionMenu.add(readonlyItem);
    optionMenu.addSeparator();
    optionMenu.add(insertItem);
    optionMenu.add(overtypeItem);

    editMenu.addSeparator();
    editMenu.add(optionMenu);

    // demonstrate mnemonics

    JMenu helpMenu = new JMenu("Help");
    helpMenu.setMnemonic('H');

    JMenuItem indexItem = new JMenuItem("Index");
    indexItem.setMnemonic('I');
    helpMenu.add(indexItem);

    // you can also add the mnemonic key to an action
    Action aboutAction = new TestAction("About");
    aboutAction.putValue(Action.MNEMONIC_KEY, new Integer('A'));
    helpMenu.add(aboutAction);

    // add all top-level menus to menu bar

    JMenuBar menuBar = new JMenuBar();
    setJMenuBar(menuBar);

    menuBar.add(fileMenu);
    menuBar.add(editMenu);
    menuBar.add(helpMenu);

    // demonstrate pop-ups

    popup = new JPopupMenu();
    popup.add(cutAction);
    popup.add(copyAction);
    popup.add(pasteAction);

    JPanel panel = new JPanel();
    panel.setComponentPopupMenu(popup);
    add(panel);

    // the following line is a workaround for bug 4966109
    panel.addMouseListener(new MouseAdapter() {
    });
}

From source file:maltcms.ui.nb.pipelineRunner.actions.RunMaltcmsPipelinesAction.java

@Override
public Action createContextAwareInstance(Lookup lkp) {
    MaltcmsPipelinesContextPopupMenuAction cpma = new MaltcmsPipelinesContextPopupMenuAction(
            NbBundle.getMessage(RunMaltcmsPipelinesAction.class, "CTL_RunMaltcmsPipelinesAction"),
            (Icon) getValue(Action.SMALL_ICON), lkp);
    cpma.setActions(buildActions(lkp));//from   ww w . ja  v  a2  s .  c  om
    return cpma;
}