List of usage examples for javax.swing JSeparator JSeparator
public JSeparator(int orientation)
From source file:org.openmicroscopy.shoola.agents.imviewer.view.ImViewerUI.java
/** * Helper method to create the view menu. * //from w w w . j av a 2 s .c o m * @param pref The user preferences. * @return The controls sub-menu. */ private JMenu createViewMenu(ViewerPreferences pref) { JMenu menu = new JMenu("Display"); menu.setMnemonic(KeyEvent.VK_V); unitBarItem = new JCheckBoxMenuItem(); unitBarItem.setSelected(model.isUnitBar()); unitBarItem.setAction(controller.getAction(ImViewerControl.UNIT_BAR)); menu.add(unitBarItem); menu.add(createScaleBarLengthSubMenu(pref)); menu.add(createScaleBarColorSubMenu(pref)); menu.add(new JSeparator(JSeparator.HORIZONTAL)); menu.add(createBackgroundColorSubMenu(pref)); //menu.add(new JSeparator(JSeparator.HORIZONTAL)); return menu; }
From source file:org.openmicroscopy.shoola.agents.imviewer.view.ImViewerUI.java
/** * Helper method to create the controls menu. * /* w w w .j av a 2s . 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.util.FilesetInfoDialog.java
/** * Sets the data to display//from w w w. j a v a 2s . c o m * * @param set * The fileset which paths should be shown * @param importType * The import type */ public void setData(Set<FilesetData> set, ImportType importType) { if (set == null) return; JPanel content = new JPanel(); content.setLayout(new GridBagLayout()); content.setBackground(UIUtilities.BACKGROUND_COLOR); GridBagConstraints c = new GridBagConstraints(); c.gridx = 0; c.gridy = 0; c.weightx = 1; c.weighty = 0; c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.NORTHEAST; if (CollectionUtils.isEmpty(set)) { JLabel l = new JLabel("No information available."); l.setBackground(UIUtilities.BACKGROUND_COLOR); content.add(l, c); } else { int size = 0; FilesetData fsd = set.iterator().next(); if (Fileset.class.isAssignableFrom(fsd.asIObject().getClass())) { size = ((Fileset) fsd.asIObject()).sizeOfUsedFiles(); } String txt = size <= 1 ? "Image file" : "Image files"; JLabel l = new JLabel(size + " " + txt); l.setBackground(UIUtilities.BACKGROUND_COLOR); content.add(l, c); c.gridy++; JSeparator sep = new JSeparator(JSeparator.HORIZONTAL); sep.setBackground(UIUtilities.BACKGROUND_COLOR); content.add(sep, c); c.gridy++; String header = (importType == ImportType.HARDLINK || importType == ImportType.SOFTLINK) ? "Imported with <b>--transfer=" + importType.getSymbol() + "</b> from:" : "Imported from:"; ExpandableTextPane t1 = new ExpandableTextPane(); t1.setBackground(UIUtilities.BACKGROUND_COLOR); t1.setText(header + "<br/>" + getOriginPaths(set)); content.add(t1, c); c.gridy++; JSeparator sep2 = new JSeparator(JSeparator.HORIZONTAL); sep2.setBackground(UIUtilities.BACKGROUND_COLOR); content.add(sep2, c); c.gridy++; ExpandableTextPane t2 = new ExpandableTextPane(); t2.setBackground(UIUtilities.BACKGROUND_COLOR); t2.setText("Path on server:<br/>" + getServerPaths(set)); content.add(t2, c); } setCanvas(new JScrollPane(content)); }
From source file:org.openmicroscopy.shoola.agents.treeviewer.view.ToolBar.java
/** * Helper method to create the tool bar hosting the management items. * // w w w. ja v a2s . com * @return See above. */ private JComponent createManagementBar() { bar = new JToolBar(); bar.setFloatable(false); bar.setRollover(true); bar.setBorder(null); JToggleButton button = new JToggleButton(controller.getAction(TreeViewerControl.INSPECTOR)); button.setSelected(true); bar.add(button); button = new JToggleButton(controller.getAction(TreeViewerControl.METADATA)); button.setSelected(true); bar.add(button); JButton b = new JButton(controller.getAction(TreeViewerControl.BROWSE)); UIUtilities.unifiedButtonLookAndFeel(b); bar.add(b); switch (TreeViewerAgent.runAsPlugin()) { case TreeViewer.IMAGE_J: b = UIUtilities.formatButtonFromAction(controller.getAction(TreeViewerControl.VIEW)); UIUtilities.unifiedButtonLookAndFeel(b); b.addMouseListener(new MouseAdapter() { /** * Displays the menu when the user releases the mouse. * @see MouseListener#mouseReleased(MouseEvent) */ public void mouseReleased(MouseEvent e) { controller.showMenu(TreeViewer.VIEW_MENU, (JComponent) e.getSource(), e.getPoint()); } }); bar.add(b); break; default: b = new JButton(controller.getAction(TreeViewerControl.VIEW)); UIUtilities.unifiedButtonLookAndFeel(b); bar.add(b); } bar.add(new JSeparator(JSeparator.VERTICAL)); //Now register the agent if any TaskBar tb = TreeViewerAgent.getRegistry().getTaskBar(); List<JComponent> l = tb.getToolBarEntries(TaskBar.AGENTS); if (l != null) { Iterator<JComponent> i = l.iterator(); JComponent comp; while (i.hasNext()) { comp = i.next(); UIUtilities.unifiedButtonLookAndFeel(comp); bar.add(comp); } bar.add(new JSeparator(JSeparator.VERTICAL)); } fullScreen = new JToggleButton(controller.getAction(TreeViewerControl.FULLSCREEN)); fullScreen.setSelected(model.isFullScreen()); //bar.add(fullScreen); if (TreeViewerAgent.isAdministrator()) { b = new JButton(controller.getAction(TreeViewerControl.UPLOAD_SCRIPT)); UIUtilities.unifiedButtonLookAndFeel(b); bar.add(b); } TreeViewerAction a = controller.getAction(TreeViewerControl.AVAILABLE_SCRIPTS); b = new JButton(a); Icon icon = b.getIcon(); Dimension d = new Dimension(UIUtilities.DEFAULT_ICON_WIDTH, UIUtilities.DEFAULT_ICON_HEIGHT); if (icon != null) d = new Dimension(icon.getIconWidth(), icon.getIconHeight()); busyLabel = new JXBusyLabel(d); busyLabel.setVisible(true); b.addMouseListener((RunScriptAction) a); UIUtilities.unifiedButtonLookAndFeel(b); scriptButton = b; bar.add(b); index = bar.getComponentCount() - 1; bar.add(new JSeparator(JSeparator.VERTICAL)); MouseAdapter adapter = new MouseAdapter() { /** * Shows the menu corresponding to the display mode. */ public void mousePressed(MouseEvent me) { createGroupsAndUsersMenu((Component) me.getSource(), me.getPoint()); } }; a = controller.getAction(TreeViewerControl.SWITCH_USER); IconManager icons = IconManager.getInstance(); menuButton = new JButton(icons.getIcon(IconManager.FILTER_MENU)); menuButton.setVisible(true); menuButton.setText(GROUP_DISPLAY_TEXT); menuButton.setHorizontalTextPosition(SwingConstants.LEFT); menuButton.addMouseListener(adapter); bar.add(menuButton); setPermissions(); return bar; }
From source file:org.openmicroscopy.shoola.agents.treeviewer.view.ToolBar.java
/** * Helper method to create the tool bar hosting the edit items. * //from w w w.j a v a2 s .c o m * @return See above. */ private JToolBar createSearchBar() { JToolBar bar = new JToolBar(); bar.setFloatable(false); bar.setRollover(true); bar.setBorder(null); bar.add(new JSeparator(JSeparator.VERTICAL)); bar.add(new JToggleButton(controller.getAction(TreeViewerControl.SEARCH))); return bar; }
From source file:org.openmicroscopy.shoola.env.ui.TaskBarView.java
/** * Returns a copy of the <code>Help</code> menu. * * @return See above./*ww w . ja v a 2 s. c o m*/ */ private JMenu getHelpMenu() { JMenu menu = createHelpMenu(); Component[] comps = menus[HELP_MENU].getPopupMenu().getComponents(); for (int i = 0; i < comps.length; i++) { if (comps[i] instanceof JMenu) menu.add(copyItemsFromMenu((JMenu) comps[i])); else if (comps[i] instanceof JMenuItem) menu.add(copyItem((JMenuItem) comps[i])); else if (comps[i] instanceof JSeparator) menu.add(new JSeparator(JSeparator.HORIZONTAL)); } helpMenus.add(menu); return menu; }
From source file:org.openmicroscopy.shoola.env.ui.TaskBarView.java
/** * Copies the items from the specified menu and creates a new menu. * * @param original The menu to handle./*from w w w . j a v a2 s. c o m*/ * @return See above. */ private JMenu copyItemsFromMenu(JMenu original) { Component[] comps = original.getPopupMenu().getComponents(); JMenu menu = new JMenu(); menu.setText(original.getText()); menu.setToolTipText(original.getToolTipText()); ActionListener[] al = original.getActionListeners(); for (int j = 0; j < al.length; j++) menu.addActionListener(al[j]); MenuKeyListener[] mkl = original.getMenuKeyListeners(); for (int j = 0; j < mkl.length; j++) menu.addMenuKeyListener(mkl[j]); MenuListener[] ml = original.getMenuListeners(); for (int j = 0; j < ml.length; j++) menu.addMenuListener(ml[j]); for (int i = 0; i < comps.length; i++) { if (comps[i] instanceof JMenu) { menu.add(copyItemsFromMenu((JMenu) comps[i])); } else if (comps[i] instanceof JMenuItem) { menu.add(copyItem((JMenuItem) comps[i])); } else if (comps[i] instanceof JSeparator) { menu.add(new JSeparator(JSeparator.HORIZONTAL)); } } return menu; }
From source file:org.openmicroscopy.shoola.env.ui.TaskBarView.java
/** * Helper method to create the help menu. * * @return The help menu./*www .j a v a2 s .co m*/ */ private JMenu createHelpMenu() { JMenu help = new JMenu("Help"); help.setMnemonic(KeyEvent.VK_H); help.add(buttons[HELP_MI]); help.add(buttons[FORUM_MI]); help.add(buttons[COMMENT_MI]); help.add(new JSeparator(JSeparator.HORIZONTAL)); help.add(buttons[LOG_FILE_MI]); help.add(buttons[UPDATES_MI]); return help; }
From source file:org.openmicroscopy.shoola.util.ui.UIUtilities.java
/** * Create a separator to add to a toolbar. The separator needs to be * set when the layout of the toolbar is reset. * /*w ww .j ava 2 s .com*/ * @param button The button to add to the toolBar. The height of the * separator depends of the insets of the button. * @param icon The icon to add to the button. The height of the * separator depends of the height of the icon. * @return See below. */ public static JSeparator toolBarSeparator(JButton button, Icon icon) { JSeparator separator = new JSeparator(SwingConstants.VERTICAL); if (button == null) return separator; Insets i = button.getInsets(); int h = 0; if (icon != null) h = icon.getIconHeight(); Dimension d = new Dimension(SEPARATOR_WIDTH, i.top + h + i.bottom); separator.setPreferredSize(d); separator.setSize(d); return separator; }
From source file:org.openmicroscopy.shoola.util.ui.UIUtilities.java
/** * Creates a separator of the specified height. * /*from www. j a va2 s . c o m*/ * @param h The desired height. * @return See above. */ public static JSeparator createSeparator(int h) { if (h <= 0) h = DEFAULT_ICON_HEIGHT; JSeparator s = new JSeparator(JSeparator.VERTICAL); Dimension d = s.getPreferredSize(); s.setMaximumSize(new Dimension(d.width, h)); return s; }