List of usage examples for javax.swing Action SMALL_ICON
String SMALL_ICON
To view the source code for javax.swing Action SMALL_ICON.
Click Source Link
Icon
, such as ImageIcon
. From source file:it.cnr.icar.eric.client.ui.swing.graph.JBGraph.java
/** * DOCUMENT ME!/*from w w w. j a v a 2 s . c om*/ * * @return DOCUMENT ME! */ public JToolBar createToolBar() { JButton button = null; JToolBar toolbar = new JToolBar(); toolbar.setFloatable(false); //TODO: SwingBoost: Localize this TreeNode tempTreeNode = new DefaultMutableTreeNode("loading object types..."); objectTypeCombo = new it.cnr.icar.eric.client.ui.swing.TreeCombo(new DefaultTreeModel(tempTreeNode)); toolbar.add(objectTypeCombo); // use a SwingWorker to get the real model, since it might not have been initialized yet final SwingWorker worker = new SwingWorker(this) { public Object doNonUILogic() { ConceptsTreeModel objectTypesTreeModel = BusinessQueryPanel.getObjectTypesTreeModel(); return objectTypesTreeModel; } public void doUIUpdateLogic() { ConceptsTreeModel objectTypesTreeModel = (ConceptsTreeModel) get(); objectTypeCombo.setModel(objectTypesTreeModel); } }; worker.start(); // Insert URL insertUrl = getClass().getClassLoader().getResource("icons/insert.gif"); ImageIcon insertIcon = new ImageIcon(insertUrl); button = toolbar.add(new AbstractAction("", insertIcon) { /** * */ private static final long serialVersionUID = 1L; public void actionPerformed(ActionEvent e) { insert(new Point(10, 10)); } }); button.setText(""); //an icon-only button button.setToolTipText("Insert"); // Toggle Connect Mode URL connectUrl = getClass().getClassLoader().getResource("icons/connecton.gif"); ImageIcon connectIcon = new ImageIcon(connectUrl); button = toolbar.add(new AbstractAction("", connectIcon) { /** * */ private static final long serialVersionUID = 657528648199915209L; public void actionPerformed(ActionEvent e) { setPortsVisible(!isPortsVisible()); URL connectUrl; if (isPortsVisible()) { connectUrl = getClass().getClassLoader().getResource("icons/connecton.gif"); } else { connectUrl = getClass().getClassLoader().getResource("icons/connectoff.gif"); } ImageIcon connectIcon = new ImageIcon(connectUrl); putValue(SMALL_ICON, connectIcon); } }); button.setText(""); //an icon-only button button.setToolTipText("Toggle Connect Mode"); // Undo toolbar.addSeparator(); URL undoUrl = getClass().getClassLoader().getResource("icons/undo.gif"); ImageIcon undoIcon = new ImageIcon(undoUrl); undo = new AbstractAction("", undoIcon) { /** * */ private static final long serialVersionUID = -740055667372297781L; public void actionPerformed(ActionEvent e) { undo(); } }; undo.setEnabled(false); button = toolbar.add(undo); button.setText(""); //an icon-only button button.setToolTipText("Undo"); // Redo URL redoUrl = getClass().getClassLoader().getResource("icons/redo.gif"); ImageIcon redoIcon = new ImageIcon(redoUrl); redo = new AbstractAction("", redoIcon) { /** * */ private static final long serialVersionUID = 5021485220988522968L; public void actionPerformed(ActionEvent e) { redo(); } }; redo.setEnabled(false); button = toolbar.add(redo); button.setText(""); //an icon-only button button.setToolTipText("Redo"); // // Edit Block // toolbar.addSeparator(); Action action; URL url; // Copy action = TransferHandler.getCopyAction(); url = getClass().getClassLoader().getResource("icons/copy.gif"); action.putValue(Action.SMALL_ICON, new ImageIcon(url)); //Commented out until we can figure out how to assign new id to copied objects //button = toolbar.add(copy = new EventRedirector(action)); button.setText(""); //an icon-only button button.setToolTipText("Copy"); // Paste action = TransferHandler.getPasteAction(); url = getClass().getClassLoader().getResource("icons/paste.gif"); action.putValue(Action.SMALL_ICON, new ImageIcon(url)); //Commented out until we can figure out how to assign new id to copied objects //button = toolbar.add(paste = new EventRedirector(action)); button.setText(""); //an icon-only button button.setToolTipText("Paste"); // Cut action = TransferHandler.getCutAction(); url = getClass().getClassLoader().getResource("icons/cut.gif"); action.putValue(Action.SMALL_ICON, new ImageIcon(url)); //Commented out until we can figure out how to assign new id to copied objects //button = toolbar.add(cut = new EventRedirector(action)); button.setText(""); //an icon-only button button.setToolTipText("Cut"); // Remove URL removeUrl = getClass().getClassLoader().getResource("icons/delete.gif"); ImageIcon removeIcon = new ImageIcon(removeUrl); remove = new AbstractAction("", removeIcon) { /** * */ private static final long serialVersionUID = 6889927067487680474L; public void actionPerformed(ActionEvent e) { if (!isSelectionEmpty()) { Object[] cells = getSelectionCells(); cells = getDescendants(cells); getModel().remove(cells); //Remove entry from map of cells on the graph for (int i = 0; i < cells.length; i++) { Object cell = cells[i]; if (cell instanceof JBGraphCell) { RegistryObject ro = ((JBGraphCell) cell).getRegistryObject(); registryObjectToCellMap.remove(ro); } } } } }; remove.setEnabled(false); button = toolbar.add(remove); button.setText(""); //an icon-only button button.setToolTipText(resourceBundle.getString("menu.graphPanel.removeFromView")); // Zoom Std toolbar.addSeparator(); URL zoomUrl = getClass().getClassLoader().getResource("icons/zoom.gif"); ImageIcon zoomIcon = new ImageIcon(zoomUrl); button = toolbar.add(new AbstractAction("", zoomIcon) { /** * */ private static final long serialVersionUID = -4404610379022823602L; public void actionPerformed(ActionEvent e) { setScale(1.0); } }); button.setText(""); //an icon-only button button.setToolTipText("Zoom"); // Zoom In URL zoomInUrl = getClass().getClassLoader().getResource("icons/zoomin.gif"); ImageIcon zoomInIcon = new ImageIcon(zoomInUrl); button = toolbar.add(new AbstractAction("", zoomInIcon) { /** * */ private static final long serialVersionUID = 6782766891458235321L; public void actionPerformed(ActionEvent e) { setScale(2 * getScale()); } }); button.setText(""); //an icon-only button button.setToolTipText("Zoom In"); // Zoom Out URL zoomOutUrl = getClass().getClassLoader().getResource("icons/zoomout.gif"); ImageIcon zoomOutIcon = new ImageIcon(zoomOutUrl); button = toolbar.add(new AbstractAction("", zoomOutIcon) { /** * */ private static final long serialVersionUID = -5480242207934335070L; public void actionPerformed(ActionEvent e) { setScale(getScale() / 2); } }); button.setText(""); //an icon-only button button.setToolTipText("Zoom Out"); // Group /* toolbar.addSeparator(); URL groupUrl = getClass().getClassLoader().getResource("icons/group.gif"); ImageIcon groupIcon = new ImageIcon(groupUrl); group = new AbstractAction("", groupIcon) { public void actionPerformed(ActionEvent e) { group(getSelectionCells()); } }; group.setEnabled(false); //button = toolbar.add(group); button.setText(""); //an icon-only button button.setToolTipText("Group"); // Ungroup URL ungroupUrl = getClass().getClassLoader().getResource("icons/ungroup.gif"); ImageIcon ungroupIcon = new ImageIcon(ungroupUrl); ungroup = new AbstractAction("", ungroupIcon) { public void actionPerformed(ActionEvent e) { ungroup(getSelectionCells()); } }; ungroup.setEnabled(false); //button = toolbar.add(ungroup); button.setText(""); //an icon-only button button.setToolTipText("Ungroup"); */ // To Front toolbar.addSeparator(); URL toFrontUrl = getClass().getClassLoader().getResource("icons/tofront.gif"); ImageIcon toFrontIcon = new ImageIcon(toFrontUrl); tofront = new AbstractAction("", toFrontIcon) { /** * */ private static final long serialVersionUID = -4901428890590828561L; public void actionPerformed(ActionEvent e) { if (!isSelectionEmpty()) { toFront(getSelectionCells()); } } }; tofront.setEnabled(false); button = toolbar.add(tofront); button.setText(""); //an icon-only button button.setToolTipText("To Front"); // To Back URL toBackUrl = getClass().getClassLoader().getResource("icons/toback.gif"); ImageIcon toBackIcon = new ImageIcon(toBackUrl); toback = new AbstractAction("", toBackIcon) { /** * */ private static final long serialVersionUID = -5942025518651424307L; public void actionPerformed(ActionEvent e) { if (!isSelectionEmpty()) { toBack(getSelectionCells()); } } }; toback.setEnabled(false); button = toolbar.add(toback); button.setText(""); //an icon-only button button.setToolTipText("To Back"); return toolbar; }
From source file:com.mirth.connect.client.ui.Frame.java
/** * Initializes the bound method call for the task pane actions and adds them to the * taskpane/popupmenu./*from w w w .ja va 2s . c o m*/ */ public int addTask(String callbackMethod, String displayName, String toolTip, String shortcutKey, ImageIcon icon, JXTaskPane pane, JPopupMenu menu, Object handler) { BoundAction boundAction = ActionFactory.createBoundAction(callbackMethod, displayName, shortcutKey); if (icon != null) { boundAction.putValue(Action.SMALL_ICON, icon); } boundAction.putValue(Action.SHORT_DESCRIPTION, toolTip); boundAction.registerCallback(handler, callbackMethod); Component component = pane.add(boundAction); getComponentTaskMap().put(component, callbackMethod); if (menu != null) { menu.add(boundAction); } return (pane.getContentPane().getComponentCount() - 1); }
From source file:edu.ku.brc.ui.UIRegistry.java
/** * @param action//from ww w . j a v a 2s. c o m * @param name * @param icon * @param toolTip * @param mnemonicKeyCode * @param acceleratorKey * @return */ public Action makeAction(Action action, String name, ImageIcon icon, String toolTip, Integer mnemonicKeyCode, KeyStroke acceleratorKey) { if (name != null) action.putValue(Action.NAME, name); if (icon != null) action.putValue(Action.SMALL_ICON, icon); if (toolTip != null) action.putValue(Action.SHORT_DESCRIPTION, toolTip); if (mnemonicKeyCode != null) action.putValue(Action.MNEMONIC_KEY, mnemonicKeyCode); if (acceleratorKey != null) action.putValue(Action.ACCELERATOR_KEY, acceleratorKey); return action; }
From source file:src.gui.ItSIMPLE.java
/** * This method should be called every time a project is opened or closed, * to update the items, like domains and problems, in the Petri Net view. *//*from w w w . j a va2s . c o m*/ private void updatePetriNetPanels() { projectPetriTaskPane.removeAll(); stateMachineJList.removeAll(); petriDetailsTextPane.setText("<html><font size='-1' face='Arial'>Select a project.<html>"); for (int i = 0; i < treeRoot.getChildCount(); i++) { ItTreeNode currentNode = (ItTreeNode) treeRoot.getChildAt(i); Element project = currentNode.getData(); //System.out.print(project); //Check if the project is a UML project (tag named project) if (project.getName().equals("project")) { Action action = new AbstractAction(project.getChildText("name")) { /** * */ private static final long serialVersionUID = -5069133020063854135L; public void actionPerformed(ActionEvent e) { Element projectElement = (Element) this.getValue("data"); selectedPetriNetProject = projectElement; if (projectElement != null) { String details = "<html><font size='-1' face='Arial'><b>" + projectElement.getChildText("name"); if (projectElement.getChildText("description").trim().equals("")) { details = details + "<br>No description...</font></html>"; } else { details = details + "<br>" + projectElement.getChildText("description") + "</font></html>"; } petriDetailsTextPane.setText(details); setStateMachineList(projectElement); } } }; action.putValue(Action.SMALL_ICON, new ImageIcon("resources/images/project.png")); //action.putValue(Action.SHORT_DESCRIPTION, project.getChild("description")); action.putValue("data", project); projectPetriTaskPane.add(action); } } }
From source file:net.sourceforge.msscodefactory.cflib.v1_11.CFLib.Swing.CFJReferenceEditor.java
public CFJReferenceEditor(Action pickReference, Action viewReference) { super();//from w ww . ja v a 2s .co m final String S_ProcName = "construct"; if (pickReference == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 1, "pickReference"); } if (viewReference == null) { throw CFLib.getDefaultExceptionFactory().newNullArgumentException(getClass(), S_ProcName, 2, "viewReference"); } actionPickReference = pickReference; actionPickReference.putValue(Action.NAME, null); actionPickReference.putValue(Action.SMALL_ICON, getPickIcon()); actionViewReference = viewReference; actionViewReference.putValue(Action.NAME, null); actionViewReference.putValue(Action.SMALL_ICON, getViewIcon()); referencedObject = null; JTextField textField = getTextFieldQualifiedName(); add(textField); textField.setBounds(0, 0, 100, 25); JButton button = getButtonPickReference(); add(button); button.setBounds(100, 0, 25, 25); button = getButtonViewReference(); add(button); button.setBounds(125, 0, 25, 25); Dimension min = new Dimension(150, 25); this.setMinimumSize(min); }
From source file:org.colombbus.tangara.commons.resinject.ActionInjecter.java
private void injectSmallIcon() { String smallIconKey = actionKey + SMALL_ICON_SUFFIX; if (classResource.containsKey(smallIconKey)) { Icon smallIconValue = classResource.getImageIcon(smallIconKey); action.putValue(Action.SMALL_ICON, smallIconValue); }/*www . j av a2s . c om*/ }
From source file:org.executequery.gui.browser.FindAction.java
public FindAction() { super("Incremental Search"); putValue(Action.ACCELERATOR_KEY, INVOKE_KEY_STROKE); putValue(Action.SMALL_ICON, GUIUtilities.loadIcon("Zoom16.png")); init();/*from ww w. j a v a2 s . c om*/ }
From source file:org.jivesoftware.sparkimpl.plugin.viewer.PluginViewer.java
public void initialize() { // Add Plugins Menu JMenuBar menuBar = SparkManager.getMainWindow().getJMenuBar(); // Get last menu which is help JMenu sparkMenu = menuBar.getMenu(0); JMenuItem viewPluginsMenu = new JMenuItem(); Action viewAction = new AbstractAction() { private static final long serialVersionUID = 6518407602062984752L; public void actionPerformed(ActionEvent e) { invokeViewer();//ww w .j av a 2 s .c om } }; viewAction.putValue(Action.NAME, Res.getString("menuitem.plugins")); viewAction.putValue(Action.SMALL_ICON, SparkRes.getImageIcon(SparkRes.PLUGIN_IMAGE)); viewPluginsMenu.setAction(viewAction); sparkMenu.insert(viewPluginsMenu, 2); }
From source file:org.kineticsystem.commons.data.view.actions.MoveBackAction.java
/** * Default constructor./*w w w . ja v a 2 s. c o m*/ * @param controller The navigation controller associate to the action. */ public MoveBackAction(Navigator navigator) { this.navigator = navigator; putValue(Action.SMALL_ICON, ResourceLoader.getIcon(NAVIGATOR_RESOURCE + "Previous16.png")); putValue(Action.NAME, Localizer.localizeString(NAVIGATOR_BUNDLE, "MoveBackAction")); putValue(Action.SHORT_DESCRIPTION, Localizer.localizeString(NAVIGATOR_BUNDLE, "MoveBackAction_Description")); setEnabled(false); }
From source file:org.kineticsystem.commons.data.view.actions.MoveBackMouseAction.java
/** * Constructor.// w w w. jav a 2 s . co m * @param navigator The navigator instance. */ public MoveBackMouseAction(Navigator navigator) { this.navigator = navigator; putValue(Action.SMALL_ICON, ResourceLoader.getIcon(NAVIGATOR_RESOURCE + "Previous16.png")); putValue(Action.NAME, Localizer.localizeString(NAVIGATOR_BUNDLE, "MoveBackAction")); putValue(Action.SHORT_DESCRIPTION, Localizer.localizeString(NAVIGATOR_BUNDLE, "MoveBackAction_Description")); setEnabled(false); }