List of usage examples for javax.swing Action NAME
String NAME
To view the source code for javax.swing Action NAME.
Click Source Link
String
name for the action, used for a menu or button. From source file:net.sf.jhylafax.addressbook.AddressBook.java
public void updateLabels() { setTitle(i18n.tr("JHylaFAX Address Book")); addressBookMenu.setText(i18n.tr("Address Book")); newAction.putValue(Action.NAME, i18n.tr("New Contact...")); editAction.putValue(Action.NAME, i18n.tr("Edit Contact...")); deleteAction.putValue(Action.NAME, i18n.tr("Delete Contact")); importAction.putValue(Action.NAME, i18n.tr("Import...")); exportAction.putValue(Action.NAME, i18n.tr("Export...")); closeAction.putValue(Action.NAME, i18n.tr("Close")); filterLabel.setText(i18n.tr("Search for")); filterAction.putValue(Action.NAME, i18n.tr("Go")); contactTableLayoutManager.getTableLayout() .setColumnNames(new String[] { i18n.tr("Name"), i18n.tr("Company"), i18n.tr("Fax"), }); GUIHelper.setMnemonics(getJMenuBar()); }
From source file:ca.phon.app.project.ProjectWindow.java
private MultiActionButton createNewCorpusButton() { MultiActionButton retVal = new MultiActionButton(); ImageIcon folderNewIcn = IconManager.getInstance().getIcon("places/folder", IconSize.SMALL); ImageIcon newIcnL = IconManager.getInstance().getIcon("actions/list-add", IconSize.MEDIUM); ImageIcon removeIcnL = IconManager.getInstance().getIcon("actions/list-remove", IconSize.MEDIUM); ImageIcon renameIcnL = IconManager.getInstance().getIcon("actions/edit-rename", IconSize.MEDIUM); String s1 = "Corpus"; retVal.getTopLabel().setText(WorkspaceTextStyler.toHeaderText(s1)); retVal.getTopLabel().setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0)); retVal.getTopLabel().setFont(FontPreferences.getTitleFont()); retVal.getTopLabel().setIcon(folderNewIcn); retVal.setOpaque(false);//from w ww.j ava 2 s.co m PhonUIAction newAct = new PhonUIAction(this, "onSwapNewAndCreateCorpus", retVal); newAct.putValue(Action.LARGE_ICON_KEY, newIcnL); newAct.putValue(Action.SMALL_ICON, folderNewIcn); newAct.putValue(Action.NAME, "New corpus"); newAct.putValue(Action.SHORT_DESCRIPTION, "Create a new corpus folder"); DeleteCorpusAction deleteCurrentAct = new DeleteCorpusAction(this); deleteCurrentAct.putValue(Action.LARGE_ICON_KEY, removeIcnL); PhonUIAction renameCurrentAct = new PhonUIAction(this, "onRenameCorpus"); renameCurrentAct.putValue(Action.LARGE_ICON_KEY, renameIcnL); renameCurrentAct.putValue(Action.NAME, "Rename corpus"); renameCurrentAct.putValue(Action.SHORT_DESCRIPTION, "Rename selected corpus"); retVal.setDisplayDefaultAction(true); retVal.addAction(deleteCurrentAct); retVal.addAction(renameCurrentAct); retVal.setDefaultAction(newAct); retVal.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR)); return retVal; }
From source file:com.frostwire.gui.bittorrent.BTDownloadMediator.java
/** * Handles the selection of the specified row in the download window, * enabling or disabling buttons and chat menu items depending on * the values in the row./*w w w . j a v a 2s.com*/ * * @param row the selected row */ public void handleSelection(int row) { BTDownloadDataLine dataLine = DATA_MODEL.get(row); boolean pausable = dataLine.getInitializeObject().isPausable(); boolean resumable = dataLine.getInitializeObject().isResumable(); boolean isTransferFinished = dataLine.getInitializeObject().isCompleted(); File saveLocation = dataLine.getInitializeObject().getSaveLocation(); boolean hasAudioFiles = selectionHasAudioFiles(dataLine.getInitializeObject()); boolean hasMP4s = selectionHasMP4s(saveLocation); boolean isSingleFile = selectionIsSingleFile(saveLocation); removeAction.putValue(Action.NAME, I18n.tr("Cancel Download")); removeAction.putValue(LimeAction.SHORT_NAME, I18n.tr("Cancel")); removeAction.putValue(Action.SHORT_DESCRIPTION, I18n.tr("Cancel Selected Downloads")); BTDownload dl = dataLine.getInitializeObject(); exploreAction.setEnabled(dl.isCompleted()); showInLibraryAction.setEnabled(dl.isCompleted()); removeAction.setEnabled(true); resumeAction.setEnabled(resumable); pauseAction.setEnabled(pausable); copyMagnetAction.setEnabled(!isHttpTransfer(dataLine.getInitializeObject())); copyHashAction.setEnabled(!isHttpTransfer(dataLine.getInitializeObject())); sendToItunesAction.setEnabled(isTransferFinished && (hasAudioFiles || hasMP4s)); shareTorrentAction .setEnabled(getSelectedDownloaders().length == 1 && dataLine.getInitializeObject().isPausable()); playSingleAudioFileAction.setEnabled(getSelectedDownloaders().length == 1 && hasAudioFiles && isSingleFile); removeYouTubeAction.setEnabled(isYouTubeTransfer(dataLine.getInitializeObject())); BTDownloadActions.REMOVE_TORRENT_ACTION.setEnabled(!isHttpTransfer(dataLine.getInitializeObject())); BTDownloadActions.REMOVE_TORRENT_AND_DATA_ACTION .setEnabled(!isHttpTransfer(dataLine.getInitializeObject())); }
From source file:net.sf.jhylafax.JHylaFAX.java
public void updateLabels() { fileMenu.setText(i18n.tr("File")); helpMenu.setText(i18n.tr("Help")); for (int i = 0; i < mainTabbedPane.getTabCount(); i++) { AbstractQueuePanel panel = (AbstractQueuePanel) mainTabbedPane.getComponent(i); panel.updateLabels();//w w w. j a v a 2 s . c o m String queueName = panel.getQueueName(); if (queueName.equals("recvq")) { mainTabbedPane.setTitleAt(i, i18n.tr("Received")); } else if (queueName.equals("sendq")) { mainTabbedPane.setTitleAt(i, i18n.tr("Sending")); } else if (queueName.equals("pollq")) { mainTabbedPane.setTitleAt(i, i18n.tr("Pollable")); } else if (queueName.equals("doneq")) { mainTabbedPane.setTitleAt(i, i18n.tr("Done")); } else if (queueName.equals("docq")) { mainTabbedPane.setTitleAt(i, i18n.tr("Documents")); } } sendAction.putValue(Action.NAME, i18n.tr("Send Fax...")); sendAction.putValue(Action.SHORT_DESCRIPTION, i18n.tr("Opens a dialog for sending a fax")); pollAction.putValue(Action.NAME, i18n.tr("Poll Fax...")); pollAction.putValue(Action.SHORT_DESCRIPTION, i18n.tr("Opens a dialog for polling a fax")); addressBookAction.putValue(Action.NAME, i18n.tr("Address Book")); updateStatusAction.putValue(Action.NAME, i18n.tr("Update Status")); updateStatusAction.putValue(Action.SHORT_DESCRIPTION, i18n.tr("Queries the status from the server")); settingsDialogAction.putValue(Action.NAME, i18n.tr("Settings...")); settingsDialogAction.putValue(Action.SHORT_DESCRIPTION, i18n.tr("Displays the settings dialog")); settingsDialogAction.updateLabels(); settingsWizardAction.putValue(Action.NAME, i18n.tr("Setup Wizard...")); settingsWizardAction.putValue(Action.SHORT_DESCRIPTION, i18n.tr("Displays the settings wizard")); settingsWizardAction.updateLabels(); exitAction.putValue(Action.NAME, i18n.tr("Exit")); exitAction.putValue(Action.SHORT_DESCRIPTION, i18n.tr("Closes the application")); aboutAction.putValue(Action.NAME, i18n.tr("About...")); aboutAction.putValue(Action.SHORT_DESCRIPTION, i18n.tr("Opens a dialog that displays funny information")); GUIHelper.setMnemonics(getJMenuBar()); }
From source file:com.googlecode.vfsjfilechooser2.filepane.VFSFilePane.java
/** * @param map/* w ww. ja v a 2s . c om*/ * @param actions */ public static void addActionsToMap(ActionMap map, Action[] actions) { if ((map != null) && (actions != null)) { for (Action a : actions) { String cmd = (String) a.getValue(Action.ACTION_COMMAND_KEY); if (cmd == null) { cmd = (String) a.getValue(Action.NAME); } map.put(cmd, a); } } }
From source file:ca.phon.app.project.ProjectWindow.java
private MultiActionButton createCorpusButton() { MultiActionButton retVal = new MultiActionButton(); ImageIcon newIcn = IconManager.getInstance().getIcon("places/folder", IconSize.SMALL); String s1 = "Corpus"; String s2 = "Enter corpus name and press enter. Press escape to cancel."; retVal.getTopLabel().setText(WorkspaceTextStyler.toHeaderText(s1)); retVal.getTopLabel().setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0)); retVal.getTopLabel().setFont(FontPreferences.getTitleFont()); retVal.getTopLabel().setIcon(newIcn); retVal.setAlwaysDisplayActions(true); retVal.setOpaque(false);// ww w . j av a 2s.c om ImageIcon cancelIcn = IconManager.getInstance().getIcon("actions/button_cancel", IconSize.SMALL); ImageIcon cancelIcnL = cancelIcn; PhonUIAction btnSwapAct = new PhonUIAction(this, "onSwapNewAndCreateCorpus", retVal); btnSwapAct.putValue(Action.ACTION_COMMAND_KEY, "CANCEL_CREATE_ITEM"); btnSwapAct.putValue(Action.NAME, "Cancel create"); btnSwapAct.putValue(Action.SHORT_DESCRIPTION, "Cancel create"); btnSwapAct.putValue(Action.SMALL_ICON, cancelIcn); btnSwapAct.putValue(Action.LARGE_ICON_KEY, cancelIcnL); retVal.addAction(btnSwapAct); JPanel corpusNamePanel = new JPanel(new BorderLayout()); corpusNamePanel.setOpaque(false); final JTextField corpusNameField = new JTextField(); corpusNameField.setDocument(new NameDocument()); corpusNameField.setText("Corpus Name"); corpusNamePanel.add(corpusNameField, BorderLayout.CENTER); ActionMap actionMap = retVal.getActionMap(); actionMap.put(btnSwapAct.getValue(Action.ACTION_COMMAND_KEY), btnSwapAct); InputMap inputMap = retVal.getInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT); KeyStroke ks = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0, false); inputMap.put(ks, btnSwapAct.getValue(Action.ACTION_COMMAND_KEY)); retVal.setActionMap(actionMap); retVal.setInputMap(JComponent.WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, inputMap); PhonUIAction createNewCorpusAct = new PhonUIAction(this, "onCreateCorpus", corpusNameField); createNewCorpusAct.putValue(Action.SHORT_DESCRIPTION, "Create new corpus folder"); createNewCorpusAct.putValue(Action.SMALL_ICON, IconManager.getInstance().getIcon("actions/list-add", IconSize.SMALL)); JButton createBtn = new JButton(createNewCorpusAct); corpusNamePanel.add(createBtn, BorderLayout.EAST); corpusNameField.setAction(createNewCorpusAct); // swap bottom component in new project button retVal.setBottomLabelText(WorkspaceTextStyler.toDescText(s2)); retVal.add(corpusNamePanel, BorderLayout.CENTER); retVal.addFocusListener(new FocusListener() { @Override public void focusLost(FocusEvent e) { } @Override public void focusGained(FocusEvent e) { corpusNameField.requestFocus(); } }); return retVal; }
From source file:org.openconcerto.task.TodoListPanel.java
void initPopUp() { TablePopupMouseListener.add(this.t, new ITransformer<MouseEvent, JPopupMenu>() { @Override//from w w w.java 2 s . c om public JPopupMenu transformChecked(MouseEvent evt) { final JTable table = (JTable) evt.getSource(); final int modelIndex = TodoListPanel.this.sorter.modelIndex(table.getSelectedRow()); final JPopupMenu res = new JPopupMenu(); // Avancer d'un jour Action act = new AbstractAction() { public void actionPerformed(ActionEvent e) { final TodoListElement element = TodoListPanel.this.model.getTaskAtRow(modelIndex); if (element != null) { final Date ts = element.getExpectedDate(); final Calendar cal = Calendar.getInstance(); cal.setTimeInMillis(ts.getTime()); cal.add(Calendar.DAY_OF_YEAR, 1); SwingUtilities.invokeLater(new Runnable() { public void run() { ts.setTime(cal.getTimeInMillis()); element.setExpectedDate(ts); element.commitChangesAndWait(); table.repaint(); } }); } } }; act.putValue(Action.NAME, TM.tr("moveOneDay")); res.add(act); // Marquer comme ralis act = new AbstractAction() { public void actionPerformed(ActionEvent e) { TodoListElement element = TodoListPanel.this.model.getTaskAtRow(modelIndex); if (element != null) { element.setDone(true); element.commitChangesAndWait(); table.repaint(); } } }; act.putValue(Action.NAME, TM.tr("markDone")); res.add(act); // Suppression act = new AbstractAction() { public void actionPerformed(ActionEvent e) { TodoListPanel.this.model.deleteTaskAtIndex(modelIndex); table.repaint(); } }; act.putValue(Action.NAME, TM.tr("delete")); res.add(act); final TodoListElement element = TodoListPanel.this.model.getTaskAtRow(modelIndex); SQLRowValues rowTache = element.getRowValues(); List<AbstractAction> actions = TacheActionManager.getInstance().getActionsForTaskRow(rowTache); for (AbstractAction abstractAction : actions) { res.add(abstractAction); } return res; } }); }
From source file:tvbrowser.extras.reminderplugin.ReminderPlugin.java
/** * Updates the plugin tree entry for this plugin. * <p>/*from ww w .j a v a2 s . co m*/ * * @param save * <code>True</code> if the reminder entries should be saved. */ public void updateRootNode(boolean save) { mRootNode.removeAllActions(); mRootNode.getMutableTreeNode() .setIcon(IconLoader.getInstance().getIconFromTheme("apps", "appointment", 16)); Action editReminders = new AbstractAction() { public void actionPerformed(ActionEvent e) { ReminderListDialog dlg = new ReminderListDialog(MainFrame.getInstance(), mReminderList); UiUtilities.centerAndShow(dlg); } }; editReminders.putValue(Action.SMALL_ICON, IconLoader.getInstance().getIconFromTheme("apps", "appointment", 16)); editReminders.putValue(Action.NAME, mLocalizer.ellipsisMsg("buttonText", "Edit reminder list")); Action openSettings = new AbstractAction() { public void actionPerformed(ActionEvent e) { MainFrame.getInstance().showSettingsDialog(SettingsItem.REMINDER); } }; openSettings.putValue(Action.SMALL_ICON, TVBrowserIcons.preferences(TVBrowserIcons.SIZE_SMALL)); openSettings.putValue(Action.NAME, Localizer.getLocalization(Localizer.I18N_SETTINGS)); mRootNode.addAction(editReminders); mRootNode.addAction(null); mRootNode.addAction(openSettings); mRootNode.removeAllChildren(); ReminderListItem[] items = mReminderList.getReminderItems(); ArrayList<Program> listNewPrograms = new ArrayList<Program>(items.length); for (ReminderListItem reminderItem : items) { listNewPrograms.add(reminderItem.getProgram()); } mRootNode.addPrograms(listNewPrograms); mRootNode.update(); if (save && mHasRightToSave) { saveReminders(); } }
From source file:tvbrowser.extras.reminderplugin.ReminderPlugin.java
protected static ActionMenu getButtonAction() { AbstractAction action = new AbstractAction() { public void actionPerformed(ActionEvent evt) { getInstance().showManageRemindersDialog(); }/* w ww .j a va2 s .c o m*/ }; action.putValue(Action.NAME, getName()); action.putValue(Action.SMALL_ICON, IconLoader.getInstance().getIconFromTheme("apps", "appointment", 16)); action.putValue(Plugin.BIG_ICON, IconLoader.getInstance().getIconFromTheme("apps", "appointment", 22)); action.putValue(Action.SHORT_DESCRIPTION, mLocalizer.msg("description", "Reminds you of programs to not miss them.")); return new ActionMenu(action); }
From source file:org.languagetool.gui.Main.java
private JMenuBar createMenuBar() { JMenuBar menuBar = new JMenuBar(); JMenu fileMenu = new JMenu(getLabel("guiMenuFile")); fileMenu.setMnemonic(getMnemonic("guiMenuFile")); JMenu editMenu = new JMenu(getLabel("guiMenuEdit")); editMenu.setMnemonic(getMnemonic("guiMenuEdit")); JMenu grammarMenu = new JMenu(getLabel("guiMenuGrammar")); grammarMenu.setMnemonic(getMnemonic("guiMenuGrammar")); JMenu helpMenu = new JMenu(getLabel("guiMenuHelp")); helpMenu.setMnemonic(getMnemonic("guiMenuHelp")); fileMenu.add(openAction);//from w w w . j av a 2 s. c o m fileMenu.add(saveAction); fileMenu.add(saveAsAction); recentFilesMenu = new JMenu(getLabel("guiMenuRecentFiles")); recentFilesMenu.setMnemonic(getMnemonic("guiMenuRecentFiles")); fileMenu.add(recentFilesMenu); updateRecentFilesMenu(); fileMenu.addSeparator(); fileMenu.add(new HideAction()); fileMenu.addSeparator(); fileMenu.add(new QuitAction()); grammarMenu.add(checkAction); JCheckBoxMenuItem item = new JCheckBoxMenuItem(autoCheckAction); grammarMenu.add(item); JCheckBoxMenuItem showResult = new JCheckBoxMenuItem(showResultAction); grammarMenu.add(showResult); grammarMenu.add(new CheckClipboardAction()); grammarMenu.add(new TagTextAction()); grammarMenu.add(new AddRulesAction()); grammarMenu.add(new OptionsAction()); grammarMenu.add(new SelectFontAction()); JMenu lafMenu = new JMenu(messages.getString("guiLookAndFeelMenu")); UIManager.LookAndFeelInfo[] lafInfo = UIManager.getInstalledLookAndFeels(); ButtonGroup buttonGroup = new ButtonGroup(); for (UIManager.LookAndFeelInfo laf : lafInfo) { if (!"Nimbus".equals(laf.getName())) { continue; } addLookAndFeelMenuItem(lafMenu, laf, buttonGroup); } for (UIManager.LookAndFeelInfo laf : lafInfo) { if ("Nimbus".equals(laf.getName())) { continue; } addLookAndFeelMenuItem(lafMenu, laf, buttonGroup); } grammarMenu.add(lafMenu); helpMenu.add(new AboutAction()); undoRedo.undoAction.putValue(Action.NAME, getLabel("guiMenuUndo")); undoRedo.undoAction.putValue(Action.MNEMONIC_KEY, getMnemonic("guiMenuUndo")); undoRedo.redoAction.putValue(Action.NAME, getLabel("guiMenuRedo")); undoRedo.redoAction.putValue(Action.MNEMONIC_KEY, getMnemonic("guiMenuRedo")); editMenu.add(undoRedo.undoAction); editMenu.add(undoRedo.redoAction); editMenu.addSeparator(); Action cutAction = new DefaultEditorKit.CutAction(); cutAction.putValue(Action.SMALL_ICON, getImageIcon("sc_cut.png")); cutAction.putValue(Action.LARGE_ICON_KEY, getImageIcon("lc_cut.png")); cutAction.putValue(Action.NAME, getLabel("guiMenuCut")); cutAction.putValue(Action.MNEMONIC_KEY, KeyEvent.VK_T); editMenu.add(cutAction); Action copyAction = new DefaultEditorKit.CopyAction(); copyAction.putValue(Action.SMALL_ICON, getImageIcon("sc_copy.png")); copyAction.putValue(Action.LARGE_ICON_KEY, getImageIcon("lc_copy.png")); copyAction.putValue(Action.NAME, getLabel("guiMenuCopy")); copyAction.putValue(Action.MNEMONIC_KEY, KeyEvent.VK_C); editMenu.add(copyAction); Action pasteAction = new DefaultEditorKit.PasteAction(); pasteAction.putValue(Action.SMALL_ICON, getImageIcon("sc_paste.png")); pasteAction.putValue(Action.LARGE_ICON_KEY, getImageIcon("lc_paste.png")); pasteAction.putValue(Action.NAME, getLabel("guiMenuPaste")); pasteAction.putValue(Action.MNEMONIC_KEY, KeyEvent.VK_P); editMenu.add(pasteAction); editMenu.addSeparator(); editMenu.add(new SelectAllAction()); menuBar.add(fileMenu); menuBar.add(editMenu); menuBar.add(grammarMenu); menuBar.add(helpMenu); return menuBar; }