List of usage examples for javax.swing ButtonGroup add
public void add(AbstractButton b)
From source file:org.openconcerto.erp.core.humanresources.payroll.element.VariablePayeSQLElement.java
public SQLComponent createComponent() { return new BaseSQLComponent(this) { private ValidState validVarName; private JRadioButton radioVal = new JRadioButton("Valeur"); private JRadioButton radioFormule = new JRadioButton("Formule"); private final JTextField textValeur = new JTextField(); // private final ITextArea textFormule = new ITextArea(); private final VariableTree treeVariable = new VariableTree(); private final JTextField textNom = new JTextField(); private final JLabel labelWarningBadVar = new JLabelWarning(); private ElementComboBox comboSelSal; private EditFrame edit = null; private final SQLJavaEditor textFormule = new SQLJavaEditor(getMapTree()); public void addViews() { this.setLayout(new GridBagLayout()); final GridBagConstraints c = new DefaultGridBagConstraints(); this.validVarName = null; this.textFormule.setEditable(false); // Arbre des variables JScrollPane sc = new JScrollPane(this.treeVariable); sc.setPreferredSize(new Dimension(150, sc.getPreferredSize().height)); this.treeVariable.addMouseListener(new MouseAdapter() { public void mousePressed(final MouseEvent mE) { if (mE.getButton() == MouseEvent.BUTTON3) { JPopupMenu menuDroit = new JPopupMenu(); TreePath path = treeVariable.getClosestPathForLocation(mE.getPoint().x, mE.getPoint().y); final Object obj = path.getLastPathComponent(); if ((obj == null) || !(obj instanceof VariableRowTreeNode)) { return; }//from ww w . j a v a 2s. c o m menuDroit.add(new AbstractAction("Editer") { public void actionPerformed(ActionEvent e) { if (edit == null) { edit = new EditFrame(getElement(), EditFrame.MODIFICATION); } System.err.println("Action performed"); if (obj != null) { System.err.println("Object not null --> " + obj.toString()); if (obj instanceof VariableRowTreeNode) { System.err.println("Object VariableRowTreeNode"); VariableRowTreeNode varNode = (VariableRowTreeNode) obj; edit.selectionId(varNode.getID(), 1); edit.setVisible(true); } } } }); menuDroit.show((Component) mE.getSource(), mE.getPoint().x, mE.getPoint().y); } else { if (mE.getClickCount() == 2) { TreePath path = treeVariable.getClosestPathForLocation(mE.getPoint().x, mE.getPoint().y); Object obj = path.getLastPathComponent(); if (obj != null) { if (obj instanceof FormuleTreeNode) { final FormuleTreeNode n = (FormuleTreeNode) obj; int start = textFormule.getSelectionStart(); String tmp = textFormule.getText(); textFormule.setText(tmp.substring(0, start) + n.getTextValue() + tmp.substring(start, tmp.length())); } } } } } }); JPanel panelDroite = new JPanel(); panelDroite.setLayout(new GridBagLayout()); // Categorie JTextField textCategorie = new JTextField(); c.fill = GridBagConstraints.HORIZONTAL; c.gridheight = 1; c.gridx = 1; c.gridy = 0; JLabel labelCategorie = new JLabel("Catgorie"); panelDroite.add(labelCategorie, c); c.gridx++; c.gridwidth = GridBagConstraints.REMAINDER; panelDroite.add(textCategorie, c); c.gridwidth = 1; // Nom c.fill = GridBagConstraints.HORIZONTAL; c.gridheight = 1; c.gridx = 1; c.gridy++; JLabel labelNom = new JLabel("Nom"); panelDroite.add(labelNom, c); c.gridx++; c.weightx = 1; panelDroite.add(this.textNom, c); this.textNom.getDocument().addDocumentListener(new SimpleDocumentListener() { @Override public void update(DocumentEvent e) { updateValidVarName(); } }); c.gridx++; c.weightx = 0; panelDroite.add(this.labelWarningBadVar, c); // Description JLabel labelInfos = new JLabel(getLabelFor("INFOS")); ITextArea textInfos = new ITextArea(); c.gridy++; c.gridx = 1; c.gridwidth = 1; c.weightx = 0; panelDroite.add(labelInfos, c); c.gridx++; c.gridwidth = GridBagConstraints.REMAINDER; c.weightx = 1; c.weighty = 0; panelDroite.add(textInfos, c); // Valeur c.gridx = 1; c.gridy++; c.gridwidth = 1; c.weightx = 0; panelDroite.add(this.radioVal, c); c.gridx++; c.weightx = 1; c.gridwidth = GridBagConstraints.REMAINDER; panelDroite.add(this.textValeur, c); c.gridwidth = 1; c.gridx = 1; c.gridy++; panelDroite.add(this.radioFormule, c); c.gridx++; c.weightx = 1; c.weighty = 1; c.fill = GridBagConstraints.BOTH; c.gridwidth = GridBagConstraints.REMAINDER; panelDroite.add(this.textFormule, c); c.gridwidth = 1; ButtonGroup group = new ButtonGroup(); group.add(this.radioVal); group.add(this.radioFormule); this.radioVal.setSelected(true); setFormuleEnabled(false); this.radioVal.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setFormuleEnabled(false); } }); this.radioFormule.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { setFormuleEnabled(true); } }); c.gridy++; c.gridx = 1; c.weighty = 0; c.weightx = 0; c.fill = GridBagConstraints.HORIZONTAL; this.comboSelSal = new ElementComboBox(false); this.comboSelSal.init(getDirectory().getElement(SalarieSQLElement.class)); c.gridx++; c.gridwidth = GridBagConstraints.REMAINDER; c.weightx = 0; panelDroite.add(this.comboSelSal, c); c.gridwidth = 1; JSplitPane split = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT, sc, panelDroite); c.fill = GridBagConstraints.BOTH; c.gridx = 0; c.gridy = 0; c.weightx = 1; c.weighty = 1; this.add(split, c); this.addRequiredSQLObject(this.textNom, "NOM"); this.addSQLObject(this.textValeur, "VALEUR"); this.addSQLObject(this.textFormule, "FORMULE"); this.addSQLObject(textCategorie, "CATEGORIE"); this.addSQLObject(textInfos, "INFOS"); this.comboSelSal.addValueListener(new PropertyChangeListener() { public void propertyChange(PropertyChangeEvent evt) { // TODO Auto-generated method stub textFormule.setSalarieID(comboSelSal.getSelectedId()); } }); } @Override public synchronized ValidState getValidState() { return super.getValidState().and(this.validVarName); } private void setFormuleEnabled(boolean b) { if (b) { this.textValeur.setText(""); } else { this.textFormule.setText(""); } this.textValeur.setEditable(!b); this.textValeur.setEnabled(!b); this.textFormule.setEditable(b); this.textFormule.setEnabled(b); this.treeVariable.setEnabled(b); this.treeVariable.setEditable(b); } private void setValidVarName(ValidState s) { if (!s.equals(this.validVarName)) { this.validVarName = s; final boolean warningVisible = !s.isValid(); if (warningVisible) this.labelWarningBadVar.setText(s.getValidationText()); this.labelWarningBadVar.setVisible(warningVisible); this.fireValidChange(); } } private void updateValidVarName() { this.setValidVarName(this.computeValidVarName()); } private ValidState computeValidVarName() { // on vrifie si la syntaxe de la variable est correct (chiffre lettre et _) final String varName = this.textNom.getText().trim(); System.err.println("Verification de la validit du nom de la variable."); if (varName.length() == 0) { return VAR_NO_NAME; } // ne contient que des chiffre lettre et _ et ne commence pas par un chiffre if (!isJavaVar(varName)) { return VAR_NAME_NOT_CORRECT; } // on vrifie que la variable n'existe pas dja SQLSelect selAllVarName = new SQLSelect(getTable().getBase()); selAllVarName.addSelect(VariablePayeSQLElement.this.getTable().getField("ID")); Where w = new Where(VariablePayeSQLElement.this.getTable().getField("NOM"), "=", varName); w = w.and(new Where(VariablePayeSQLElement.this.getTable().getKey(), "!=", getSelectedID())); selAllVarName.setWhere(w); String reqAllVarName = selAllVarName.asString();// + " AND '" + varName.trim() + "' // REGEXP VARIABLE_PAYE.NOM"; Object[] objKeysRowName = ((List) getTable().getBase().getDataSource().execute(reqAllVarName, new ArrayListHandler())).toArray(); if (objKeysRowName.length > 0) { return VAR_ALREADY_EXIST; } else { // Impossible de crer une variable du meme nom qu'un champ du salarie if (isForbidden(varName)) return VAR_ALREADY_EXIST; this.textFormule.setVarAssign(varName); return ValidState.getTrueInstance(); } } private boolean isJavaVar(String s) { if ((s.charAt(0) >= '0') && ((s.charAt(0) <= '9'))) { System.err.println("Erreur la variable commence par un chiffre!!"); return false; } else { for (int i = 0; i < s.length(); i++) { if (!(((s.charAt(i) >= '0') && (s.charAt(i) <= '9')) || (s.charAt(i) >= 'a') && (s.charAt(i) <= 'z') || (s.charAt(i) >= 'A') && (s.charAt(i) <= 'Z') || (s.charAt(i) == '_'))) { System.err.println("Erreur la variable contient un caractere incorrect!!"); return false; } } return (!CTokenMarker.getKeywords().isExisting(s)); } } @Override public void select(SQLRowAccessor r) { super.select(r); // System.err.println("Select RowAccess -------> " + r.getID() + " For Object " + // this.hashCode()); if (r != null) { if (r.getString("FORMULE").trim().length() == 0) { this.radioVal.setSelected(true); setFormuleEnabled(false); } else { this.radioFormule.setSelected(true); setFormuleEnabled(true); } this.textFormule.setVarAssign(r.getString("NOM")); } this.updateValidVarName(); } }; }
From source file:org.openmicroscopy.shoola.agents.fsimporter.chooser.ImportDialog.java
/** * Initializes the components composing the display. * // w w w . j a v a2 s . c om * @param filters The filters to handle. * @param importerAction The cancel-all-imports action. */ private void initComponents(FileFilter[] filters, ImporterAction importerAction) { canvas = new QuotaCanvas(); sizeImportLabel = new JLabel(); diskSpacePane = new JPanel(); diskSpacePane.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 0)); diskSpacePane.add(UIUtilities.setTextFont(TEXT_FREE_SPACE)); diskSpacePane.add(canvas); showThumbnails = new JCheckBox(TEXT_SHOW_THUMBNAILS); showThumbnails.setVisible(false); Registry registry = ImporterAgent.getRegistry(); Boolean loadThumbnails = (Boolean) registry.lookup(LOAD_THUMBNAIL); if (loadThumbnails != null) { if (loadThumbnails.booleanValue()) { showThumbnails.setVisible(true); showThumbnails.setSelected(loadThumbnails.booleanValue()); } } if (!isFastConnection()) // slow connection showThumbnails.setSelected(false); long groupId = -1; if (model.getSelectedGroup() != null) groupId = model.getSelectedGroup().getGroupId(); if (groupId < 0) groupId = ImporterAgent.getUserDetails().getGroupId(); locationDialog = new LocationDialog(owner, selectedContainer, type, objects, model, groupId, true); locationDialog.addPropertyChangeListener(this); int plugin = ImporterAgent.runAsPlugin(); if (plugin == LookupNames.IMAGE_J_IMPORT || plugin == LookupNames.IMAGE_J) { detachedDialog = new LocationDialog(owner, selectedContainer, type, objects, model, groupId, false); detachedDialog.addPropertyChangeListener(this); } tagSelectionListener = new ActionListener() { public void actionPerformed(ActionEvent e) { Object src = e.getSource(); if (src instanceof JButton) { TagAnnotationData tag = tagsMap.get(src); if (tag != null) { tagsMap.remove(src); handleTagsSelection(tagsMap.values()); } } } }; tabbedPane = new JTabbedPane(); numberOfFolders = new NumericalTextField(); numberOfFolders.setMinimum(0); numberOfFolders.setText("0"); numberOfFolders.setColumns(3); numberOfFolders.addPropertyChangeListener(this); tagsMap = new LinkedHashMap<JButton, TagAnnotationData>(); IconManager icons = IconManager.getInstance(); refreshFilesButton = new JButton(TEXT_REFRESH_FILES); refreshFilesButton.setBackground(UIUtilities.BACKGROUND); refreshFilesButton.setToolTipText(TOOLTIP_REFRESH_FILES); refreshFilesButton.setActionCommand("" + CMD_REFRESH_FILES); refreshFilesButton.addActionListener(this); tagButton = new JButton(icons.getIcon(IconManager.PLUS_12)); UIUtilities.unifiedButtonLookAndFeel(tagButton); tagButton.addActionListener(this); tagButton.setActionCommand("" + CMD_TAG); tagButton.setToolTipText(TOOLTIP_ADD_TAGS); tagsPane = new JPanel(); tagsPane.setLayout(new BoxLayout(tagsPane, BoxLayout.Y_AXIS)); overrideName = new JCheckBox(TEXT_OVERRIDE_FILE_NAMING); overrideName.setToolTipText(UIUtilities.formatToolTipText(WARNING)); overrideName.setSelected(true); ButtonGroup group = new ButtonGroup(); fullName = new JRadioButton(TEXT_NAMING_FULL_PATH); group.add(fullName); partialName = new JRadioButton(); partialName.setText(TEXT_NAMING_PARTIAL_PATH); partialName.setSelected(true); group.add(partialName); table = new FileSelectionTable(this); table.addPropertyChangeListener(this); chooser = new GenericFileChooser(); JList list = (JList) UIUtilities.findComponent(chooser, JList.class); KeyAdapter ka = new KeyAdapter() { /** * Adds the files to the import queue. * * @see KeyListener#keyPressed(KeyEvent) */ public void keyPressed(KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_ENTER) { handleEnterKeyPressed(e.getSource()); } } }; if (list != null) list.addKeyListener(ka); if (list == null) { JTable t = (JTable) UIUtilities.findComponent(chooser, JTable.class); if (t != null) t.addKeyListener(ka); } try { File f = UIUtilities.getDefaultFolder(); if (f != null) chooser.setCurrentDirectory(f); } catch (Exception e) { // Ignore: could not set the default container } chooser.addPropertyChangeListener(this); chooser.setMultiSelectionEnabled(true); chooser.setFileSelectionMode(JFileChooser.FILES_AND_DIRECTORIES); chooser.setControlButtonsAreShown(false); chooser.setApproveButtonText(TEXT_IMPORT); chooser.setApproveButtonToolTipText(TOOLTIP_IMPORT); bioFormatsFileFilters = new ArrayList<FileFilter>(); if (filters != null) { chooser.setAcceptAllFileFilterUsed(false); for (FileFilter fileFilter : filters) { if (fileFilter instanceof ComboFileFilter) { bioFormatsFileFiltersCombined = fileFilter; ComboFileFilter comboFilter = (ComboFileFilter) fileFilter; FileFilter[] extensionFilters = comboFilter.getFilters(); for (FileFilter combinedFilter : extensionFilters) { bioFormatsFileFilters.add(combinedFilter); } break; } } chooser.addChoosableFileFilter(bioFormatsFileFiltersCombined); for (FileFilter fileFilter : bioFormatsFileFilters) { chooser.addChoosableFileFilter(fileFilter); } chooser.setFileFilter(bioFormatsFileFiltersCombined); } else { chooser.setAcceptAllFileFilterUsed(true); } closeButton = new JButton(TEXT_CLOSE); closeButton.setToolTipText(TOOLTIP_CLOSE); closeButton.setActionCommand("" + CMD_CLOSE); closeButton.addActionListener(this); cancelImportButton = new JButton(importerAction); importerAction.setEnabled(false); importButton = new JButton(TEXT_IMPORT); importButton.setToolTipText(TOOLTIP_IMPORT); importButton.setActionCommand("" + CMD_IMPORT); importButton.addActionListener(this); importButton.setEnabled(false); pixelsSize = new ArrayList<NumericalTextField>(); NumericalTextField field; for (int i = 0; i < 3; i++) { field = new NumericalTextField(); field.setNumberType(Double.class); field.setColumns(2); pixelsSize.add(field); } List<Component> boxes = UIUtilities.findComponents(chooser, JComboBox.class); if (boxes != null) { JComboBox box; JComboBox filterBox = null; Iterator<Component> i = boxes.iterator(); while (i.hasNext()) { box = (JComboBox) i.next(); Object o = box.getItemAt(0); if (o instanceof FileFilter) { filterBox = box; break; } } if (filterBox != null) { filterBox.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent e) { String value = KeyEvent.getKeyText(e.getKeyCode()); JComboBox box = (JComboBox) e.getSource(); int n = box.getItemCount(); FileFilter filter; FileFilter selectedFilter = null; String d; for (int j = 0; j < n; j++) { filter = (FileFilter) box.getItemAt(j); d = filter.getDescription(); if (d.startsWith(value)) { selectedFilter = filter; break; } } if (selectedFilter != null) box.setSelectedItem(selectedFilter); } }); } } }
From source file:org.openmicroscopy.shoola.agents.fsimporter.view.ImporterUI.java
/** * Brings up the <code>ManagePopupMenu</code>on top of the specified * component at the specified location./*from w ww .jav a2 s .c o m*/ * * @param c The component that requested the po-pup menu. * @param p The point at which to display the menu, relative to the * <code>component</code>'s coordinates. */ private void showPersonalMenu(Component c, Point p) { if (p == null) return; if (c == null) throw new IllegalArgumentException("No component."); personalMenu = new JPopupMenu(); personalMenu.setBorder(BorderFactory.createBevelBorder(BevelBorder.RAISED)); List<GroupSelectionAction> l = controller.getUserGroupAction(); Iterator<GroupSelectionAction> i = l.iterator(); GroupSelectionAction a; JCheckBoxMenuItem item; ButtonGroup buttonGroup = new ButtonGroup(); long id = model.getGroupId(); while (i.hasNext()) { a = i.next(); item = new JCheckBoxMenuItem(a); item.setEnabled(true); item.setSelected(a.isSameGroup(id)); initMenuItem(item); buttonGroup.add(item); personalMenu.add(item); } personalMenu.show(c, p.x, p.y); }
From source file:org.openmicroscopy.shoola.agents.imviewer.view.ImViewerUI.java
/** * Helper method to create the unit bar color sub-menu. * //from w w w.j a v a2 s. c om * @param pref The user preferences. * @return See above. */ private JMenuItem createScaleBarColorSubMenu(ViewerPreferences pref) { JMenu menu = new JMenu("Scale bar/Text color"); ButtonGroup group = new ButtonGroup(); Iterator<Entry<Color, String>> i = EditorUtil.COLORS_BAR.entrySet().iterator(); ColorCheckBoxMenuItem item; Color c; Color refColor = ImagePaintingFactory.UNIT_BAR_COLOR; if (pref != null) refColor = pref.getScaleBarColor(); if (refColor == null) refColor = ImagePaintingFactory.UNIT_BAR_COLOR; Entry<Color, String> entry; while (i.hasNext()) { entry = i.next(); c = entry.getKey(); item = new ColorCheckBoxMenuItem(c); item.setText(entry.getValue()); item.setSelected(c.equals(refColor)); group.add(item); menu.add(item); item.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { ColorCheckBoxMenuItem source = (ColorCheckBoxMenuItem) e.getSource(); if (source.isSelected()) model.getBrowser().setUnitBarColor(source.getColor()); } }); } return menu; }
From source file:org.openmicroscopy.shoola.agents.metadata.editor.AnnotationDataUI.java
/** * Creates and displays the menu //from www .j a v a2s . c o m * @param src The invoker. * @param p The location where to show the menu. */ private void displayMenu(Component src, Point p) { JPopupMenu menu = new JPopupMenu(); ButtonGroup group = new ButtonGroup(); JCheckBoxMenuItem item = createMenuItem(SHOW_ALL); group.add(item); menu.add(item); item = createMenuItem(ADDED_BY_ME); group.add(item); menu.add(item); item = createMenuItem(ADDED_BY_OTHERS); group.add(item); menu.add(item); menu.show(src, p.x, p.y); }
From source file:org.openmicroscopy.shoola.agents.treeviewer.browser.BrowserUI.java
/** Helper method to create the menu bar. */ private void createMenuBars() { rightMenuBar = new JToolBar(); rightMenuBar.setBorder(null);/*from www . j a v a 2 s. co m*/ rightMenuBar.setRollover(true); rightMenuBar.setFloatable(false); JButton button; leftMenuBar = new JToolBar(); leftMenuBar.setBorder(BorderFactory.createEmptyBorder(0, 0, 8, 0)); leftMenuBar.setRollover(true); leftMenuBar.setFloatable(false); BrowserManageAction a; int type = model.getBrowserType(); switch (type) { case Browser.PROJECTS_EXPLORER: case Browser.SCREENS_EXPLORER: a = (BrowserManageAction) controller.getAction(BrowserControl.NEW_CONTAINER); button = new JButton(a); button.setName("new container button"); button.setBorderPainted(false); button.addMouseListener(a); rightMenuBar.add(button); break; case Browser.ADMIN_EXPLORER: a = (BrowserManageAction) controller.getAction(BrowserControl.NEW_ADMIN); button = new JButton(a); button.setName("new group or user button"); button.setBorderPainted(false); button.addMouseListener(a); rightMenuBar.add(button); break; case Browser.TAGS_EXPLORER: a = (BrowserManageAction) controller.getAction(BrowserControl.NEW_TAG); button = new JButton(a); button.setName("new tag button"); button.setBorderPainted(false); button.addMouseListener(a); rightMenuBar.add(button); } button = new JButton(controller.getAction(BrowserControl.CUT)); button.setName("cut button"); button.setBorderPainted(false); rightMenuBar.add(button); button = new JButton(controller.getAction(BrowserControl.COPY)); button.setName("copy button"); button.setBorderPainted(false); rightMenuBar.add(button); button = new JButton(controller.getAction(BrowserControl.PASTE)); button.setName("paste button"); button.setBorderPainted(false); rightMenuBar.add(button); button = new JButton(controller.getAction(BrowserControl.DELETE)); button.setName("delete button"); button.setBorderPainted(false); rightMenuBar.add(button); button = new JButton(controller.getAction(BrowserControl.REFRESH)); button.setName("refresh button"); button.setBorderPainted(false); rightMenuBar.add(button); if (type == Browser.ADMIN_EXPLORER) { button = new JButton(controller.getAction(BrowserControl.RESET_PASSWORD)); button.setBorderPainted(false); rightMenuBar.add(button); } else { button = new JButton(controller.getAction(BrowserControl.IMPORT)); button.setBorderPainted(false); //rightMenuBar.add(button); } rightMenuBar.add(Box.createHorizontalStrut(6)); rightMenuBar.add(new JSeparator()); rightMenuBar.add(Box.createHorizontalStrut(6)); ButtonGroup group = new ButtonGroup(); JToggleButton b = new JToggleButton(); group.add(b); b.setBorderPainted(true); b.setSelected(true); b.setAction(controller.getAction(BrowserControl.SORT)); rightMenuBar.add(b); b = new JToggleButton(controller.getAction(BrowserControl.SORT_DATE)); b.setBorderPainted(true); group.add(b); rightMenuBar.add(b); partialButton = new JToggleButton(controller.getAction(BrowserControl.PARTIAL_NAME)); partialButton.setBorderPainted(true); rightMenuBar.add(partialButton); rightMenuBar.add(new JSeparator(JSeparator.VERTICAL)); button = new JButton(controller.getAction(BrowserControl.COLLAPSE)); button.setBorderPainted(false); rightMenuBar.add(button); }
From source file:org.openmicroscopy.shoola.agents.treeviewer.util.SaveResultsDialog.java
/** * Builds and lays out the elements indicating what to save. * * @return See above.//from w ww.java2 s. c om */ private JPanel buildContents() { JPanel buttons = new JPanel(); buttons.add(UIUtilities.setTextFont("Save results for")); buttons.setLayout(new BoxLayout(buttons, BoxLayout.Y_AXIS)); ButtonGroup group = new ButtonGroup(); JRadioButton b = new JRadioButton("Image from current window"); b.setSelected(activeWindow); buttons.add(b); group.add(b); b.addItemListener(new ItemListener() { @Override public void itemStateChanged(ItemEvent e) { activeWindow = (e.getStateChange() == ItemEvent.SELECTED); } }); b = new JRadioButton("Images from all image windows"); b.setSelected(activeWindow); buttons.add(b); group.add(b); buttons.add(Box.createRigidArea(UIUtilities.H_SPACER_SIZE)); buttons.add(UIUtilities.setTextFont("Save")); buttons.add(roi); buttons.add(table); JPanel row = new JPanel(); row.setLayout(new FlowLayout(FlowLayout.LEFT)); JLabel l = new JLabel(); l.setText("Measurements File Name: "); row.add(l); row.add(nameField); JPanel p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); p.add(UIUtilities.buildComponentPanel(buttons)); p.add(row); return p; }
From source file:org.openmicroscopy.shoola.agents.treeviewer.view.ToolBar.java
/** * Creates the items for the menu.//from ww w .j ava 2 s.co m * * @param add Pass <code>true</code> to build items for the <code>Add</code> * menu, <code>false</code> otherwise. * @return See above */ private List<JMenuItem> createMenuItem(boolean add) { List<JMenuItem> items = new ArrayList<JMenuItem>(); List<GroupSelectionAction> l = controller.getUserGroupAction(add); Iterator<GroupSelectionAction> i = l.iterator(); GroupSelectionAction a; JMenuItem item; if (add) { //Check the groups that already in the view. Browser browser = model.getSelectedBrowser(); List<Long> ids = new ArrayList<Long>(); if (browser != null) { ExperimenterVisitor v = new ExperimenterVisitor(browser, -1); browser.accept(v, ExperimenterVisitor.TREEIMAGE_SET_ONLY); List<TreeImageDisplay> nodes = v.getNodes(); Iterator<TreeImageDisplay> j = nodes.iterator(); TreeImageDisplay node; while (j.hasNext()) { node = j.next(); ids.add(((GroupData) node.getUserObject()).getId()); } } while (i.hasNext()) { a = i.next(); item = new JMenuItem(a); if (ids.size() > 0) { item.setEnabled(!ids.contains(a.getGroupId())); } else item.setEnabled(true); initMenuItem(item); items.add(item); } } else { ButtonGroup buttonGroup = new ButtonGroup(); long id = model.getSelectedGroupId(); while (i.hasNext()) { a = i.next(); item = new JCheckBoxMenuItem(a); item.setEnabled(true); item.setSelected(a.isSameGroup(id)); initMenuItem(item); buttonGroup.add(item); items.add(item); } } return items; }
From source file:org.parosproxy.paros.view.MainFrame.java
public MainToolbarPanel getMainToolbarPanel() { if (mainToolbarPanel == null) { mainToolbarPanel = new MainToolbarPanel(); mainToolbarPanel.addButton(getShowAllTabsButton()); mainToolbarPanel.addButton(getHideAllTabsButton()); mainToolbarPanel.addButton(getShowTabIconNamesButton()); mainToolbarPanel.addSeparator(); ButtonGroup layoutsButtonGroup = new ButtonGroup(); mainToolbarPanel.addButton(getExpandSelectLayoutButton()); layoutsButtonGroup.add(getExpandSelectLayoutButton()); mainToolbarPanel.addButton(getExpandStatusLayoutButton()); layoutsButtonGroup.add(getExpandStatusLayoutButton()); mainToolbarPanel.addButton(getFullLayoutButton()); layoutsButtonGroup.add(getFullLayoutButton()); mainToolbarPanel.addSeparator(); ButtonGroup responsePanelPositionsButtonGroup = new ButtonGroup(); mainToolbarPanel.addButton(getTabsResponsePanelPositionButton()); responsePanelPositionsButtonGroup.add(getTabsResponsePanelPositionButton()); mainToolbarPanel.addButton(getPanelsResponsePanelPositionButton()); responsePanelPositionsButtonGroup.add(getPanelsResponsePanelPositionButton()); mainToolbarPanel.addButton(getAboveResponsePanelPositionButton()); responsePanelPositionsButtonGroup.add(getAboveResponsePanelPositionButton()); mainToolbarPanel.addSeparator(); }/*from w w w . j av a 2 s . c o m*/ return mainToolbarPanel; }
From source file:org.pentaho.reporting.engine.classic.core.modules.gui.pdf.PdfExportDialog.java
/** * Creates the security config panel. This panel is used to select the level of the PDF security. * * @return the created security config panel. *//*w w w . ja va 2 s .c o m*/ private JPanel createSecurityConfigPanel() { final JPanel pnlSecurityConfig = new JPanel(); pnlSecurityConfig.setLayout(new GridLayout()); pnlSecurityConfig.add(rbSecurityNone); pnlSecurityConfig.add(rbSecurity40Bit); pnlSecurityConfig.add(rbSecurity128Bit); final ButtonGroup btGrpSecurity = new ButtonGroup(); btGrpSecurity.add(rbSecurity128Bit); btGrpSecurity.add(rbSecurity40Bit); btGrpSecurity.add(rbSecurityNone); return pnlSecurityConfig; }