List of usage examples for javax.swing JMenuItem setText
@BeanProperty(preferred = true, visualUpdate = true, description = "The button's text.") public void setText(String text)
From source file:org.omegat.gui.scripting.ScriptingWindow.java
protected void buildSetsMenu(JMenuBar mb) { m_setsMenu.removeAll();//from ww w .j a va 2s . c o m Mnemonics.setLocalizedText(m_setsMenu, OStrings.getString("SCW_MENU_SETS")); JMenuItem item = new JMenuItem(); Mnemonics.setLocalizedText(item, OStrings.getString("SCW_MENU_SAVE_SET")); item.addActionListener(new SaveSetAction()); m_setsMenu.add(item); m_setsMenu.addSeparator(); if (m_scriptsDirectory == null) { return; } for (File script : m_scriptsDirectory.listFiles(new FileFilter() { @Override public boolean accept(File script) { return script.getName().endsWith(".set"); } })) { ScriptSet set = new ScriptSet(script); JMenuItem setMenuItem = new JMenuItem(); setMenuItem.setText(set.getTitle()); setMenuItem.putClientProperty("set", set); setMenuItem.addActionListener(new LoadSetAction()); m_setsMenu.add(setMenuItem); } mb.add(m_setsMenu); //m_scriptList.setListData(items.toArray(new ScriptItem[items.size()])); }
From source file:org.openmicroscopy.shoola.agents.fsimporter.ImporterAgent.java
/** Registers the agent with the tool bar.*/ private void register() { String description = "Open the Importer."; TaskBar tb = registry.getTaskBar();// w w w . j a va 2s . com IconManager icons = IconManager.getInstance(); JButton b = new JButton(icons.getIcon(IconManager.IMPORT)); b.setToolTipText(description); ActionListener l = new ActionListener() { /** Posts an event to start the agent.*/ public void actionPerformed(ActionEvent e) { EventBus bus = registry.getEventBus(); ExperimenterData exp = (ExperimenterData) registry.lookup(LookupNames.CURRENT_USER_DETAILS); if (exp == null) return; GroupData gp = null; try { gp = exp.getDefaultGroup(); } catch (Exception ex) { //No default group } long id = -1; if (gp != null) id = gp.getId(); if (groupId == -1) groupId = id; LoadImporter event = new LoadImporter(null, browserType); event.setGroup(groupId); event.setObjects(objects); bus.post(event); } }; b.addActionListener(l); tb.addToToolBar(TaskBar.AGENTS, b); JMenuItem item = new JMenuItem(icons.getIcon(IconManager.IMPORT)); item.setText("Import..."); item.setToolTipText(description); item.addActionListener(l); tb.addToMenu(TaskBar.FILE_MENU, item); }
From source file:org.openmicroscopy.shoola.agents.imviewer.view.ImViewerUI.java
/** * Helper method to create the controls menu. * /*www . jav a 2 s . c o m*/ * @param pref The user preferences. * @return The controls sub-menu. */ private JMenu createControlsMenu(ViewerPreferences pref) { JMenu menu = new JMenu("Controls"); menu.setMnemonic(KeyEvent.VK_C); ViewerAction action = controller.getAction(ImViewerControl.RENDERER); rndItem = new JCheckBoxMenuItem(); rndItem.setSelected(isRendererShown()); rndItem.setAction(action); rndItem.setText(action.getName()); if (pref != null) rndItem.setSelected(pref.isRenderer()); //menu.add(rndItem); action = controller.getAction(ImViewerControl.METADATA); metadataItem = new JCheckBoxMenuItem(); metadataItem.setSelected(isRendererShown()); metadataItem.setAction(action); metadataItem.setText(action.getName()); if (pref != null) metadataItem.setSelected(pref.isRenderer()); //menu.add(metadataItem); action = controller.getAction(ImViewerControl.HISTORY); historyItem = new JCheckBoxMenuItem(); historyItem.setSelected(isHistoryShown()); historyItem.setAction(action); historyItem.setText(action.getName()); if (pref != null) historyItem.setSelected(pref.isHistory()); //menu.add(historyItem); action = controller.getAction(ImViewerControl.MOVIE); JMenuItem item = new JMenuItem(action); item.setText(action.getName()); menu.add(item); action = controller.getAction(ImViewerControl.LENS); item = new JMenuItem(action); item.setText(action.getName()); menu.add(item); action = controller.getAction(ImViewerControl.MEASUREMENT_TOOL); item = new JMenuItem(action); item.setText(action.getName()); menu.add(item); menu.add(new JSeparator(JSeparator.HORIZONTAL)); //Color model colorModelGroup = new ButtonGroup(); action = controller.getAction(ImViewerControl.GREY_SCALE_MODEL); item = new JCheckBoxMenuItem(); String cm = model.getColorModel(); item.setSelected(cm.equals(ImViewer.GREY_SCALE_MODEL)); item.setAction(action); colorModelGroup.add(item); menu.add(item); action = controller.getAction(ImViewerControl.RGB_MODEL); item = new JCheckBoxMenuItem(); item.setAction(action); item.setSelected(cm.equals(ImViewer.RGB_MODEL)); colorModelGroup.add(item); menu.add(item); menu.add(new JSeparator()); action = controller.getAction(ImViewerControl.CHANNELS_ON); item = new JMenuItem(action); item.setText(action.getName()); menu.add(item); action = controller.getAction(ImViewerControl.CHANNELS_OFF); item = new JMenuItem(action); item.setText(action.getName()); menu.add(item); menu.add(new JSeparator()); action = controller.getAction(ImViewerControl.SAVE); item = new JMenuItem(action); item.setText(action.getName()); menu.add(item); action = controller.getAction(ImViewerControl.PREFERENCES); item = new JMenuItem(action); item.setText(action.getName()); //menu.add(item); return menu; }
From source file:org.openmicroscopy.shoola.agents.metadata.editor.PropertiesUI.java
/** * Creates or recycles the menu./*from w w w .j a va 2s .c o m*/ * * @param invoker The component invoking the menu. * @param loc The location of the mouse clicked. */ private void showViewMenu(JComponent invoker, Point loc) { if (viewMenu == null) { viewMenu = new JPopupMenu(); IconManager icons = IconManager.getInstance(); JMenuItem button = new JMenuItem(icons.getIcon(IconManager.VIEW)); button.setText(ViewAction.NAME); button.setToolTipText(ViewAction.DESCRIPTION); button.setActionCommand("" + EditorControl.VIEW_IMAGE); button.addActionListener(controller); viewMenu.add(button); button = new JMenuItem(icons.getIcon(IconManager.VIEWER_IJ)); button.setText(ViewAction.NAME_IJ); button.setToolTipText(ViewAction.DESCRIPTION_IJ); button.setActionCommand("" + EditorControl.VIEW_IMAGE_IN_IJ); button.addActionListener(controller); viewMenu.add(button); } viewMenu.show(invoker, loc.x, loc.y); }
From source file:org.openmicroscopy.shoola.agents.metadata.editor.ToolBar.java
/** Creates or recycles the save as menu. */ private JPopupMenu createSaveAsMenu() { saveAsMenu = new JPopupMenu(); IconManager icons = IconManager.getInstance(); downloadItem = new JMenuItem(icons.getIcon(IconManager.DOWNLOAD)); downloadItem.setToolTipText("Download the Archived File(s)."); downloadItem.setText("Download..."); downloadItem.addActionListener(controller); downloadItem.setActionCommand("" + EditorControl.DOWNLOAD); downloadItem.setBackground(UIUtilities.BACKGROUND_COLOR); List<DataObject> nodes = model.getSelectedObjects(); boolean b = false; if (!CollectionUtils.isEmpty(nodes)) { Iterator<DataObject> i = nodes.iterator(); while (i.hasNext()) { if (model.isArchived(i.next())) { b = true;/*from w ww.j a v a 2 s .c om*/ break; } } } downloadItem.setEnabled(b); saveAsMenu.add(downloadItem); downloadOriginalMetadataItem = new JMenuItem(icons.getIcon(IconManager.DOWNLOAD)); downloadOriginalMetadataItem.setToolTipText("Download the " + "metadata read from the image files."); downloadOriginalMetadataItem.setText("Download Original metadata..."); downloadOriginalMetadataItem.addActionListener(controller); downloadOriginalMetadataItem.setActionCommand("" + EditorControl.DOWNLOAD_METADATA); downloadOriginalMetadataItem.setBackground(UIUtilities.BACKGROUND_COLOR); downloadOriginalMetadataItem.setEnabled(model.hasOriginalMetadata()); saveAsMenu.add(downloadOriginalMetadataItem); exportAsOmeTiffItem = new JMenuItem(icons.getIcon(IconManager.EXPORT_AS_OMETIFF)); exportAsOmeTiffItem.setText("Export as OME-TIFF..."); exportAsOmeTiffItem.setToolTipText(EXPORT_AS_OME_TIFF_TOOLTIP); exportAsOmeTiffItem.addActionListener(controller); exportAsOmeTiffItem.setActionCommand("" + EditorControl.EXPORT_AS_OMETIFF); if (model.isMultiSelection()) b = false; else { b = model.getRefObject() instanceof ImageData && !model.isLargeImage(); } exportAsOmeTiffItem.setEnabled(b); saveAsMenu.add(exportAsOmeTiffItem); JMenu menu = new JMenu(); menu.setIcon(icons.getIcon(IconManager.SAVE_AS)); menu.setText("Save as..."); menu.setToolTipText("Save the images at full size as JPEG. PNG or" + "TIFF."); ActionListener l = new ActionListener() { public void actionPerformed(ActionEvent e) { int index = Integer.parseInt(e.getActionCommand()); controller.saveAs(index); } }; Map<Integer, String> formats = FigureParam.FORMATS; Entry<Integer, String> e; Iterator<Entry<Integer, String>> i = formats.entrySet().iterator(); JMenuItem item; Object ho = model.getRefObject(); boolean enabled = (ho instanceof ImageData || ho instanceof WellSampleData || ho instanceof DatasetData); while (i.hasNext()) { e = i.next(); item = new JMenuItem(); item.setText(e.getValue()); item.addActionListener(l); item.setActionCommand("" + e.getKey()); item.setEnabled(enabled); menu.add(item); } saveAsMenu.add(menu); setRootObject(); return saveAsMenu; }
From source file:org.openmicroscopy.shoola.agents.metadata.editor.ToolBar.java
/** * Creates or recycles the view menu./*www .j av a 2 s . c om*/ * * @param source The source of the mouse event. * @param p The location of the mouse pressed. */ private void showViewMenu(Component source, Point p) { JPopupMenu menu = new JPopupMenu(); IconManager icons = IconManager.getInstance(); JMenuItem item = new JMenuItem(icons.getIcon(IconManager.VIEWER)); item.setText("View..."); item.setActionCommand("" + EditorControl.VIEW_IMAGE); item.addActionListener(controller); menu.add(item); item = new JMenuItem(icons.getIcon(IconManager.VIEWER_IJ)); item.setText("View in ImageJ..."); item.setActionCommand("" + EditorControl.VIEW_IMAGE_IN_IJ); item.addActionListener(controller); menu.add(item); menu.show(source, p.x, p.y); }
From source file:org.openmicroscopy.shoola.agents.metadata.editor.ToolBar.java
/** * Builds the menu displaying the available scripts. * /*from w w w . j a v a 2 s . c o m*/ * @return See above. */ private JPopupMenu getScriptsMenu() { JPopupMenu menu = new JPopupMenu(); Collection<ScriptObject> scripts = model.getScripts(); //Scripts are sorted. if (scripts == null || scripts.size() == 0) return menu; IconManager icons = IconManager.getInstance(); JMenuItem refresh = new JMenuItem(icons.getIcon(IconManager.REFRESH)); refresh.setText("Reload Scripts"); refresh.setToolTipText("Reloads the existing scripts."); refresh.addActionListener(controller); refresh.setActionCommand("" + EditorControl.RELOAD_SCRIPT); menu.add(refresh); menu.add(new JSeparator()); Iterator<ScriptObject> i = scripts.iterator(); ScriptObject so; Map<String, ScriptSubMenu> menus = new HashMap<String, ScriptSubMenu>(); String path; ScriptSubMenu subMenu; List<ScriptSubMenu> others = new ArrayList<ScriptSubMenu>(); List<String> formattedName = new ArrayList<String>(); while (i.hasNext()) { so = i.next(); setScriptIcon(so); path = so.getPath(); subMenu = menus.get(path); if (subMenu == null) { subMenu = new ScriptSubMenu(path, formattedName); //formattedName.add(subMenu.getUnformattedText()); menus.put(path, subMenu); if (so.isOfficialScript()) menu.add(subMenu); else others.add(subMenu); } //if (!ScriptMenuItem.isScriptWithUI(so.getScriptLabel())) subMenu.addScript(so).addActionListener(controller); } if (others.size() > 0) { menu.add(new JSeparator()); JMenu uploadedMenu = new JMenu("User Scripts"); menu.add(uploadedMenu); Iterator<ScriptSubMenu> j = others.iterator(); while (j.hasNext()) uploadedMenu.add(j.next()); } return menu; }
From source file:org.openmicroscopy.shoola.agents.treeviewer.view.ToolBar.java
/** * Brings up the <code>Available Scripts</code> on top of the specified * component at the specified location./*from w w w. ja v a 2 s. c o m*/ * * @param c The component that requested the pop-pup menu. * @param p The point at which to display the menu, relative to the * <code>component</code>'s coordinates. */ void showAvailableScriptsMenu(Component c, Point p) { if (p == null) return; if (c == null) { c = scriptButton; } IconManager icons = IconManager.getInstance(); Collection<ScriptObject> scripts = model.getAvailableScripts(); if (CollectionUtils.isEmpty(scripts)) return; if (scriptsMenu == null) { scriptsMenu = new JPopupMenu(); JMenuItem refresh = new JMenuItem(icons.getIcon(IconManager.REFRESH)); refresh.setText("Reload Scripts"); refresh.setToolTipText("Reloads the existing scripts."); refresh.addMouseListener(new MouseAdapter() { /** * Launches the dialog when the user releases the mouse. * MouseAdapter#mouseReleased(MouseEvent) */ public void mouseReleased(MouseEvent e) { model.setAvailableScripts(null); scriptsMenu = null; controller.reloadAvailableScripts(e.getPoint()); } }); scriptsMenu.add(refresh); scriptsMenu.add(new JSeparator()); ScriptObject so; Map<String, JMenu> menus = new HashMap<String, JMenu>(); String path; Icon icon = icons.getIcon(IconManager.ANALYSIS); Icon largeIcon = icons.getIcon(IconManager.ANALYSIS_48); ActionListener listener = new ActionListener() { /** * Listens to the selection of a script. * @see ActionListener#actionPerformed(ActionEvent) */ public void actionPerformed(ActionEvent e) { ScriptMenuItem item = (ScriptMenuItem) e.getSource(); controller.handleScriptSelection(item.getScript()); } }; String name = ""; //loop twice to check if we need to add the first element String refString = null; int count = 0; Iterator<ScriptObject> i = scripts.iterator(); String sep; String[] values; String value; while (i.hasNext()) { so = i.next(); value = ""; path = so.getPath(); if (path != null) { sep = FilenameUtils.getPrefix(path); if (path.startsWith(sep)) path = path.substring(1, path.length()); values = UIUtilities.splitString(path); if (values != null && values.length > 0) value = values[0]; } if (refString == null) { refString = value; count++; } else if (refString.equals(value)) count++; } int index = 0; if (scripts.size() == count) index++; i = scripts.iterator(); List<JMenuItem> topMenus = new ArrayList<JMenuItem>(); JMenu ref = null; while (i.hasNext()) { so = i.next(); path = so.getPath(); if (path != null) { sep = FilenameUtils.getPrefix(path); if (path.startsWith(sep)) path = path.substring(1, path.length()); values = UIUtilities.splitString(path); if (values != null) { for (int j = index; j < values.length; j++) { value = values[j]; JMenu v; String text = name + value; if (menus.containsKey(text)) { v = menus.get(text); } else { value = value.replace(ScriptObject.PARAMETER_SEPARATOR, ScriptObject.PARAMETER_UI_SEPARATOR); v = new JMenu(value); } if (ref == null) topMenus.add(v); else ref.add(v); ref = v; name += values[j]; menus.put(name, v); } } } ScriptMenuItem item = new ScriptMenuItem(so); item.addActionListener(listener); if (ref != null) ref.add(item); else topMenus.add(item); name = ""; ref = null; if (so.getIcon() == null) { so.setIcon(icon); so.setIconLarge(largeIcon); } } Iterator<JMenuItem> j = topMenus.iterator(); while (j.hasNext()) { scriptsMenu.add(j.next()); } } scriptsMenu.show(c, p.x, p.y); }
From source file:org.openmicroscopy.shoola.env.ui.TaskBarView.java
/** * Makes and returns a copy of the specified item. * * @param original The item to handle.//from ww w .j a v a 2 s .com * @return See above. */ private JMenuItem copyItem(JMenuItem original) { JMenuItem item = new JMenuItem(original.getAction()); item.setIcon(original.getIcon()); item.setText(original.getText()); item.setToolTipText(original.getToolTipText()); ActionListener[] al = original.getActionListeners(); for (int j = 0; j < al.length; j++) item.addActionListener(al[j]); return item; }
From source file:org.pdfsam.guiclient.commons.panels.JVisualPdfPageSelectionPanel.java
/** * panel initialization/*from w w w. j a v a2s .com*/ */ private void init() { setLayout(new GridBagLayout()); thumbnailList.setDrawDeletedItems(drawDeletedItems); if (dndSupport == DND_SUPPORT_FILES) { thumbnailList.setTransferHandler(new VisualListExportTransferHandler(pdfLoader)); } else if (dndSupport == DND_SUPPORT_JAVAOBJECTS) { thumbnailList.setTransferHandler(new VisualListTransferHandler()); } else if (dndSupport == DND_SUPPORT_FILES_AND_JAVAOBJECTS) { thumbnailList.setTransferHandler(new VisualListTransferHandler(pdfLoader)); } else { thumbnailList.setTransferHandler(new VisualListExportTransferHandler(null)); } thumbnailList.setDragEnabled(true); thumbnailList.setDropMode(DropMode.INSERT); pagesWorker = new PagesWorker(thumbnailList); thumbnailList.addKeyListener(new VisualPdfSelectionKeyAdapter(pagesWorker)); thumbnailList.addMouseListener(new PageOpenerMouseAdapter(thumbnailList)); if (showButtonPanel) { initButtonPanel(pagesWorker); initKeyListener(); } //JList orientation if (HORIZONTAL_ORIENTATION == orientation) { thumbnailList.setLayoutOrientation(JList.HORIZONTAL_WRAP); } else { if (wrap) { thumbnailList.setLayoutOrientation(JList.VERTICAL_WRAP); } } topPanel.setLayout(new BoxLayout(topPanel, BoxLayout.LINE_AXIS)); topPanel.setPreferredSize(new Dimension(400, 30)); pdfSelectionActionListener = new VisualPdfSelectionActionListener(this, pdfLoader); if (topPanelStyle >= STYLE_TOP_PANEL_FULL) { //load button loadFileButton.setMargin(new Insets(1, 1, 1, 1)); loadFileButton.setText(GettextResource.gettext(config.getI18nResourceBundle(), "Open")); loadFileButton.setPreferredSize(new Dimension(100, 30)); loadFileButton .setToolTipText(GettextResource.gettext(config.getI18nResourceBundle(), "Load a pdf document")); loadFileButton.setIcon(new ImageIcon(this.getClass().getResource("/images/add.png"))); loadFileButton.addKeyListener(new EnterDoClickListener(loadFileButton)); loadFileButton.setAlignmentX(Component.CENTER_ALIGNMENT); loadFileButton.setAlignmentY(Component.CENTER_ALIGNMENT); loadFileButton.setActionCommand(VisualPdfSelectionActionListener.ADD); loadFileButton.addActionListener(pdfSelectionActionListener); } documentProperties.setIcon(new ImageIcon(this.getClass().getResource("/images/info.png"))); documentProperties.setVisible(false); if (topPanelStyle >= STYLE_TOP_PANEL_MEDIUM) { clearButton.setMargin(new Insets(1, 1, 1, 1)); clearButton.setMinimumSize(new Dimension(30, 30)); clearButton.setText(GettextResource.gettext(config.getI18nResourceBundle(), "Clear")); clearButton.setIcon(new ImageIcon(this.getClass().getResource("/images/clear.png"))); clearButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { resetPanel(); } }); } zoomInButton.setMargin(new Insets(1, 1, 1, 1)); zoomInButton.setMinimumSize(new Dimension(30, 30)); zoomInButton.setText(GettextResource.gettext(config.getI18nResourceBundle(), "Zoom in")); zoomInButton.setIcon(new ImageIcon(this.getClass().getResource("/images/zoomin.png"))); zoomInButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { thumbnailList.incZoomLevel(); zoomOutButton.setEnabled(true); if (thumbnailList.getCurrentZoomLevel() >= JVisualSelectionList.MAX_ZOOM_LEVEL) { zoomInButton.setEnabled(false); } ((VisualListModel) thumbnailList.getModel()).elementsChanged(); } catch (Exception ex) { log.error(GettextResource.gettext(config.getI18nResourceBundle(), "Error setting zoom level."), ex); } } }); zoomOutButton.setMargin(new Insets(1, 1, 1, 1)); zoomOutButton.setMinimumSize(new Dimension(30, 30)); zoomOutButton.setText(GettextResource.gettext(config.getI18nResourceBundle(), "Zoom out")); zoomOutButton.setIcon(new ImageIcon(this.getClass().getResource("/images/zoomout.png"))); zoomOutButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { try { thumbnailList.deincZoomLevel(); zoomInButton.setEnabled(true); if (thumbnailList.getCurrentZoomLevel() <= JVisualSelectionList.MIN_ZOOM_LEVEL) { zoomOutButton.setEnabled(false); } ((VisualListModel) thumbnailList.getModel()).elementsChanged(); } catch (Exception ex) { log.error(GettextResource.gettext(config.getI18nResourceBundle(), "Error setting zoom level."), ex); } } }); thumbnailList.setModel(new VisualListModel()); thumbnailList.setCellRenderer(new VisualListRenderer()); thumbnailList.setVisibleRowCount(-1); thumbnailList.setSelectionMode(selectionType); JScrollPane listScroller = new JScrollPane(thumbnailList); //preview item menuItemPreview.setIcon(new ImageIcon(this.getClass().getResource("/images/preview-viewer.png"))); menuItemPreview.setText(GettextResource.gettext(config.getI18nResourceBundle(), "Preview")); menuItemPreview.addMouseListener(new MouseAdapter() { public void mouseReleased(MouseEvent e) { int[] selection = thumbnailList.getSelectedIndices(); if (selection != null && selection.length == 1) { VisualPageListItem item = (VisualPageListItem) thumbnailList.getModel() .getElementAt(selection[0]); PagePreviewOpener.getInstance().openPreview(item.getParentFileCanonicalPath(), item.getDocumentPassword(), item.getPageNumber()); } } }); if (showContextMenu) { //popup final JMenuItem menuItemMoveUp = new JMenuItem(); menuItemMoveUp.setIcon(new ImageIcon(this.getClass().getResource("/images/up.png"))); menuItemMoveUp.setText(GettextResource.gettext(config.getI18nResourceBundle(), "Move Up")); menuItemMoveUp.addMouseListener(new VisualPdfSelectionMouseAdapter(PagesWorker.MOVE_UP, pagesWorker)); popupMenu.add(menuItemMoveUp); final JMenuItem menuItemMoveDown = new JMenuItem(); menuItemMoveDown.setIcon(new ImageIcon(this.getClass().getResource("/images/down.png"))); menuItemMoveDown.setText(GettextResource.gettext(config.getI18nResourceBundle(), "Move Down")); menuItemMoveDown .addMouseListener(new VisualPdfSelectionMouseAdapter(PagesWorker.MOVE_DOWN, pagesWorker)); popupMenu.add(menuItemMoveDown); final JMenuItem menuItemRemove = new JMenuItem(); menuItemRemove.setIcon(new ImageIcon(this.getClass().getResource("/images/remove.png"))); menuItemRemove.setText(GettextResource.gettext(config.getI18nResourceBundle(), "Delete")); menuItemRemove.addMouseListener(new VisualPdfSelectionMouseAdapter(PagesWorker.REMOVE, pagesWorker)); popupMenu.add(menuItemRemove); //if elements are physically deleted i don't need this item if (drawDeletedItems) { final JMenuItem menuItemUndelete = new JMenuItem(); menuItemUndelete.setIcon(new ImageIcon(this.getClass().getResource("/images/remove.png"))); menuItemUndelete.setText(GettextResource.gettext(config.getI18nResourceBundle(), "Undelete")); menuItemUndelete .addMouseListener(new VisualPdfSelectionMouseAdapter(PagesWorker.UNDELETE, pagesWorker)); popupMenu.add(menuItemUndelete); } //rotate item final JMenuItem menuItemRotate = new JMenuItem(); menuItemRotate.setIcon(new ImageIcon(this.getClass().getResource("/images/clockwise.png"))); menuItemRotate.setText(GettextResource.gettext(config.getI18nResourceBundle(), "Rotate clockwise")); menuItemRotate .addMouseListener(new VisualPdfSelectionMouseAdapter(PagesWorker.ROTATE_CLOCK, pagesWorker)); popupMenu.add(menuItemRotate); //rotate anticlock item final JMenuItem menuItemAntiRotate = new JMenuItem(); menuItemAntiRotate.setIcon(new ImageIcon(this.getClass().getResource("/images/anticlockwise.png"))); menuItemAntiRotate .setText(GettextResource.gettext(config.getI18nResourceBundle(), "Rotate anticlockwise")); menuItemAntiRotate.addMouseListener( new VisualPdfSelectionMouseAdapter(PagesWorker.ROTATE_ANTICLOCK, pagesWorker)); popupMenu.add(menuItemAntiRotate); //reverse item final JMenuItem menuItemReverse = new JMenuItem(); menuItemReverse.setIcon(new ImageIcon(this.getClass().getResource("/images/reverse.png"))); menuItemReverse.setText(GettextResource.gettext(config.getI18nResourceBundle(), "Reverse")); menuItemReverse.addMouseListener(new VisualPdfSelectionMouseAdapter(PagesWorker.REVERSE, pagesWorker)); popupMenu.add(menuItemReverse); enableSetOutputPathMenuItem(); addPopupShower(); } popupMenu.add(menuItemPreview); if (topPanelStyle >= STYLE_TOP_PANEL_FULL) { topPanel.add(Box.createRigidArea(new Dimension(5, 0))); topPanel.add(loadFileButton); } if (topPanelStyle >= STYLE_TOP_PANEL_MEDIUM) { topPanel.add(Box.createRigidArea(new Dimension(5, 0))); topPanel.add(clearButton); } topPanel.add(Box.createRigidArea(new Dimension(5, 0))); topPanel.add(documentProperties); topPanel.add(Box.createHorizontalGlue()); topPanel.add(zoomInButton); topPanel.add(Box.createRigidArea(new Dimension(5, 0))); topPanel.add(zoomOutButton); GridBagConstraints topConstraints = new GridBagConstraints(); topConstraints.fill = GridBagConstraints.BOTH; topConstraints.gridx = 0; topConstraints.gridy = 0; topConstraints.gridwidth = 3; topConstraints.gridheight = 1; topConstraints.insets = new Insets(5, 5, 5, 5); topConstraints.weightx = 1.0; topConstraints.weighty = 0.0; if (topPanelStyle > STYLE_TOP_PANEL_HIDE) { add(topPanel, topConstraints); } GridBagConstraints thumbConstraints = new GridBagConstraints(); thumbConstraints.fill = GridBagConstraints.BOTH; thumbConstraints.gridx = 0; thumbConstraints.gridy = 1; thumbConstraints.gridwidth = (showButtonPanel ? 2 : 3); thumbConstraints.gridheight = 2; thumbConstraints.insets = new Insets(5, 5, 5, 5); thumbConstraints.weightx = 1.0; thumbConstraints.weighty = 1.0; add(listScroller, thumbConstraints); if (showButtonPanel) { GridBagConstraints buttonsConstraints = new GridBagConstraints(); buttonsConstraints.fill = GridBagConstraints.BOTH; buttonsConstraints.gridx = 2; buttonsConstraints.gridy = 1; buttonsConstraints.gridwidth = 1; buttonsConstraints.gridheight = 2; buttonsConstraints.insets = new Insets(5, 5, 5, 5); buttonsConstraints.weightx = 0.0; buttonsConstraints.weighty = 1.0; add(buttonPanel, buttonsConstraints); } }