List of usage examples for javax.swing Action SHORT_DESCRIPTION
String SHORT_DESCRIPTION
To view the source code for javax.swing Action SHORT_DESCRIPTION.
Click Source Link
String
description for the action, used for tooltip text. From source file:com.intuit.tank.tools.debugger.ActionProducer.java
/** * /*from w w w. j av a 2 s .c om*/ * @return */ public Action getReloadAction() { Action ret = actionMap.get(ACTION_RELOAD); if (ret == null) { ret = new AbstractAction(ACTION_RELOAD, getIcon("refresh.png", IconSize.SMALL)) { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent event) { try { final ScriptSource scriptSource = debuggerFrame.getScriptSource(); if (scriptSource != null) { debuggerFrame.startWaiting(); setFromString(null); // get script in thread new Thread(new Runnable() { public void run() { try { String scriptXml = null; if (scriptSource.getSource() == SourceType.file) { scriptXml = FileUtils.readFileToString(new File(scriptSource.getId())); } else if (scriptSource.getSource() == SourceType.script) { scriptXml = scriptServiceClient .downloadHarnessXml(Integer.parseInt(scriptSource.getId())); } else if (scriptSource.getSource() == SourceType.project) { scriptXml = projectServiceClient.downloadTestScriptForProject( Integer.parseInt(scriptSource.getId())); } if (scriptXml != null) { setFromString(scriptXml); } } catch (Exception e1) { e1.printStackTrace(); debuggerFrame.stopWaiting(); showError("Error opening from source: " + e1); } finally { debuggerFrame.stopWaiting(); } } }).start(); } else { JOptionPane.showMessageDialog(debuggerFrame, "Scripts can only be reloaded if they have been loaded first.", "Load Script from source", JOptionPane.ERROR_MESSAGE); } } catch (HeadlessException e) { showError("Error opening file: " + e); } } }; ret.putValue(Action.SHORT_DESCRIPTION, "Reload scrpt from source."); ret.putValue(Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke('R', menuActionMods)); ret.putValue(Action.MNEMONIC_KEY, new Integer('R')); ret.setEnabled(false); actionMap.put(ACTION_RELOAD, ret); } return ret; }
From source file:com.intuit.tank.tools.debugger.ActionProducer.java
/** * // www .j av a 2 s . c om * @return */ public Action getSelectTankAction() { Action ret = actionMap.get(ACTION_SELECT_TANK); if (ret == null) { ret = new AbstractAction(ACTION_SELECT_TANK) { private static final long serialVersionUID = 1L; final JComboBox cb = getComboBox(); @Override public void actionPerformed(ActionEvent event) { try { int selected = JOptionPane.showConfirmDialog(debuggerFrame, cb, "Enter the base URL to Tank:", JOptionPane.OK_CANCEL_OPTION, JOptionPane.QUESTION_MESSAGE); if (selected == JOptionPane.OK_OPTION) { String url = (String) cb.getSelectedItem(); if (url != null) { int startInd = url.indexOf('('); int endInd = url.indexOf(')'); if (startInd != -1 && endInd != -1) { url = url.substring(startInd + 1, endInd); } url = StringUtils.removeEndIgnoreCase(url, "/"); if (!url.startsWith("http")) { url = "http://" + url; } try { new ScriptServiceClient(url).ping(); setServiceUrl(url); } catch (Exception e) { showError("Cannot connect to Tank at the url " + url + ". \nExample: http://tank.mysite.com/"); } } } } catch (HeadlessException e) { showError("Error opening file: " + e); } } }; ret.putValue(Action.SHORT_DESCRIPTION, "Enter a Tank URL."); actionMap.put(ACTION_SELECT_TANK, ret); } return ret; }
From source file:com.diversityarrays.kdxplore.field.FieldViewDialog.java
private void initialiseAction(Action action, String resourceName, String tooltip) { action.putValue(Action.SHORT_DESCRIPTION, tooltip); InputStream is = getClass().getResourceAsStream(resourceName); if (is != null) { try {//from www . j av a2s . co m BufferedImage img = ImageIO.read(is); action.putValue(Action.SMALL_ICON, new ImageIcon(img)); } catch (IOException ignore) { } } }
From source file:com.intuit.tank.proxy.ProxyApp.java
/** * // www . j a va 2 s . co m */ @SuppressWarnings("serial") private void createActions() { startAction = new AbstractAction("Start Recording", loadImage("icons/16/control_play_blue.png")) { public void actionPerformed(ActionEvent arg0) { try { start(); } catch (Exception e) { JOptionPane.showMessageDialog(ProxyApp.this, "Error statrting proxy: " + e.toString(), "Error", JOptionPane.ERROR_MESSAGE); } } }; startAction.putValue(javax.swing.Action.SHORT_DESCRIPTION, "Start Recording"); stopAction = new AbstractAction("Stop Recording", loadImage("icons/16/control_stop_blue.png")) { public void actionPerformed(ActionEvent arg0) { try { stop(); } catch (Exception e) { JOptionPane.showMessageDialog(ProxyApp.this, "Error stopping proxy: " + e.toString(), "Error", JOptionPane.ERROR_MESSAGE); } } }; stopAction.setEnabled(false); stopAction.putValue(javax.swing.Action.SHORT_DESCRIPTION, "Stop Recording"); pauseAction = new AbstractAction("Pause Recording", loadImage("icons/16/control_pause_blue.png")) { public void actionPerformed(ActionEvent arg0) { pause(); } }; pauseAction.setEnabled(false); pauseAction.putValue(javax.swing.Action.SHORT_DESCRIPTION, "Pause Recording"); settingsAction = new AbstractAction("Settings", loadImage("icons/16/cog.png")) { public void actionPerformed(ActionEvent arg0) { showSettings(); } }; settingsAction.putValue(javax.swing.Action.SHORT_DESCRIPTION, "Settings"); filterAction = new AbstractAction("Run Filters", loadImage("icons/16/filter.png")) { public void actionPerformed(ActionEvent arg0) { filter(); } }; filterAction.putValue(javax.swing.Action.SHORT_DESCRIPTION, "Run Filters"); filterAction.setEnabled(false); saveAction = new AbstractAction("Save", loadImage("icons/16/save_as.png")) { public void actionPerformed(ActionEvent arg0) { save(); } }; saveAction.setEnabled(false); saveAction.putValue(javax.swing.Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_S, keyMask)); saveAction.putValue(javax.swing.Action.SHORT_DESCRIPTION, "Save"); openAction = new AbstractAction("Open Recording...", loadImage("icons/16/folder_go.png")) { public void actionPerformed(ActionEvent arg0) { openRecording(); } }; openAction.putValue(javax.swing.Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_O, keyMask)); openAction.putValue(javax.swing.Action.SHORT_DESCRIPTION, "Open Recording..."); showHostsAction = new AbstractAction("Hosts...", loadImage("icons/16/page_add.png")) { public void actionPerformed(ActionEvent arg0) { showHosts(); } }; showHostsAction.putValue(javax.swing.Action.ACCELERATOR_KEY, KeyStroke.getKeyStroke(KeyEvent.VK_H, keyMask)); showHostsAction.putValue(javax.swing.Action.SHORT_DESCRIPTION, "Show Hosts..."); fileChooser = new JFileChooser(new File(".")); fileChooser.setDialogTitle("Open Recording..."); fileChooser.setFileFilter(new XmlFileFilter()); }
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);/* w w w.ja v a2 s .c om*/ 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 va 2 s . c om*/ * * @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 . jav a 2s.co 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: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);//from w w w . j ava 2 s. co m 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:com.intuit.tank.tools.debugger.ActionProducer.java
/** * /* w w w.j a v a 2 s . c om*/ * @return */ public Action getOpenScriptAction() { Action ret = actionMap.get(ACTION_CHOOSE_SCRIPT); if (ret == null) { ret = new AbstractAction(ACTION_CHOOSE_SCRIPT, getIcon("script_lightning.png", IconSize.SMALL)) { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent e) { try { ScriptDescriptionContainer scriptDescriptions = scriptServiceClient.getScriptDescriptions(); List<ScriptDescription> scripts = scriptDescriptions.getScripts(); Collections.sort(scripts, new Comparator<ScriptDescription>() { @Override public int compare(ScriptDescription o1, ScriptDescription o2) { return o2.getCreated().compareTo(o1.getCreated()); } }); SelectDialog<ScriptDescription> selectDialog = new SelectDialog<ScriptDescription>( debuggerFrame, scripts, "script"); selectDialog.setVisible(true); final ScriptDescription scriptSelected = selectDialog.getSelectedObject(); if (scriptSelected != null) { debuggerFrame.startWaiting(); setFromString(null); // get script in thread new Thread(new Runnable() { public void run() { try { String scriptXml = scriptServiceClient .downloadHarnessXml(scriptSelected.getId()); setFromString(scriptXml); debuggerFrame .setCurrentTitle("Selected Script: " + scriptSelected.getName()); debuggerFrame.setScriptSource(new ScriptSource( scriptSelected.getId().toString(), SourceType.script)); } catch (Exception e1) { debuggerFrame.stopWaiting(); showError("Error downloading script: " + e1); } finally { debuggerFrame.stopWaiting(); } } }).start(); } } catch (Exception e1) { showError("Error downloading script: " + e1); } } }; ret.putValue(Action.SHORT_DESCRIPTION, "Choose Script from Tank."); actionMap.put(ACTION_CHOOSE_SCRIPT, ret); } return ret; }
From source file:com.intuit.tank.tools.debugger.ActionProducer.java
/** * /*from w w w . j a v a 2 s.c om*/ * @return */ public Action getSelectDataFileAction() { Action ret = actionMap.get(ACTION_CHOOSE_DATAFILE); if (ret == null) { ret = new AbstractAction(ACTION_CHOOSE_DATAFILE, getIcon("table_lightning.png", IconSize.SMALL)) { private static final long serialVersionUID = 1L; @Override public void actionPerformed(ActionEvent e) { try { List<DataFileDescriptor> dataFiles = dataFileClient.getDataFiles(); Collections.sort(dataFiles, new Comparator<DataFileDescriptor>() { public int compare(DataFileDescriptor o1, DataFileDescriptor o2) { return o2.getName().compareTo(o1.getName()); } }); SelectDialog<DataFileDescriptor> selectDialog = new SelectDialog<DataFileDescriptor>( debuggerFrame, dataFiles, "datafiles", false); selectDialog.setVisible(true); List<DataFileDescriptor> selectedObjects = selectDialog.getSelectedObjects(); if (!selectedObjects.isEmpty()) { debuggerFrame.setDataFiles(selectedObjects); } } catch (Exception e1) { showError("Error downloading datafiles: " + e1); } } }; ret.putValue(Action.SHORT_DESCRIPTION, "Choose Datafiles from Tank."); actionMap.put(ACTION_CHOOSE_DATAFILE, ret); } return ret; }