List of usage examples for javax.swing BoxLayout Y_AXIS
int Y_AXIS
To view the source code for javax.swing BoxLayout Y_AXIS.
Click Source Link
From source file:org.openmicroscopy.shoola.agents.metadata.editor.OriginalMetadataComponent.java
/** * Builds and lays out the UI./* w w w .ja va 2s . co m*/ * * @param components The components to lay out. */ private void buildGUI(Map<String, List<String>> components) { //Now lay out the elements JPanel p = new JPanel(); p.setBackground(UIUtilities.BACKGROUND_COLOR); p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); String key; List<String> l; Entry<String, List<String>> entry; Iterator<Entry<String, List<String>>> i = components.entrySet().iterator(); JPanel row; JLabel label; p.add(new JSeparator()); while (i.hasNext()) { entry = i.next(); key = entry.getKey(); l = entry.getValue(); if (!CollectionUtils.isEmpty(l)) { label = UIUtilities.setTextFont(key); label.setBackground(UIUtilities.BACKGROUND_COLOR); row = UIUtilities.buildComponentPanel(label); row.setBackground(UIUtilities.BACKGROUND_COLOR); p.add(row); p.add(createTable(l)); } } removeAll(); add(toolBar, BorderLayout.NORTH); add(p, BorderLayout.CENTER); revalidate(); repaint(); }
From source file:org.openmicroscopy.shoola.agents.metadata.editor.PropertiesUI.java
/** Initializes the components composing this display. */ private void initComponents() { setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); setBackground(UIUtilities.BACKGROUND_COLOR); Font f;//from w w w . j av a2s . c o m parentLabel = new JLabel(); f = parentLabel.getFont(); Font newFont = f.deriveFont(f.getStyle(), f.getSize() - 2); parentLabel.setOpaque(false); parentLabel.setFont(newFont); parentLabel.setBackground(UIUtilities.BACKGROUND_COLOR); gpLabel = new JLabel(); gpLabel.setOpaque(false); gpLabel.setFont(newFont); gpLabel.setBackground(UIUtilities.BACKGROUND_COLOR); wellLabel = new JLabel(); wellLabel.setOpaque(false); wellLabel.setFont(newFont); wellLabel.setBackground(UIUtilities.BACKGROUND_COLOR); idLabel = UIUtilities.setTextFont(""); idLabel.setName("ID label"); inplaceIcon = new JLabel(IconManager.getInstance().getIcon(IconManager.INPLACE_IMPORT)); ClickableTooltip inplaceIconTooltip = new ClickableTooltip(INPLACE_IMPORT_TOOLTIP_TEXT, createInplaceIconAction()); inplaceIconTooltip.attach(inplaceIcon); ownerLabel = new JLabel(); ownerLabel.setBackground(UIUtilities.BACKGROUND_COLOR); namePane = createTextPane(); namePane.setEditable(false); editableName = false; typePane = createTextPane(); typePane.setEditable(false); namePane.addFocusListener(this); f = namePane.getFont(); newFont = f.deriveFont(f.getStyle(), f.getSize() - 2); descriptionWiki = new OMEWikiComponent(false); descriptionWiki.installObjectFormatters(); descriptionWiki.setFont(newFont); descriptionWiki.setEnabled(false); descriptionWiki.setAllowOneClick(true); descriptionWiki.addFocusListener(this); descriptionWiki.addPropertyChangeListener(this); defaultBorder = namePane.getBorder(); namePane.setFont(f.deriveFont(Font.BOLD)); typePane.setFont(f.deriveFont(Font.BOLD)); typePane.setFont(f.deriveFont(f.getStyle(), f.getSize() - 2)); f = parentLabel.getFont(); parentLabel.setFont(f.deriveFont(Font.BOLD)); parentLabel.setForeground(UIUtilities.DEFAULT_FONT_COLOR); f = gpLabel.getFont(); gpLabel.setFont(f.deriveFont(Font.BOLD)); gpLabel.setForeground(UIUtilities.DEFAULT_FONT_COLOR); f = wellLabel.getFont(); wellLabel.setFont(f.deriveFont(Font.BOLD)); wellLabel.setForeground(UIUtilities.DEFAULT_FONT_COLOR); f = ownerLabel.getFont(); ownerLabel.setFont(f.deriveFont(Font.BOLD, f.getSize() - 2)); channelsArea = UIUtilities.createComponent(null); channelsPane = channelsArea; IconManager icons = IconManager.getInstance(); editName = new JButton(icons.getIcon(IconManager.EDIT_12)); formatButton(editName, EDIT_NAME_TEXT, EDIT_NAME); descriptionButtonEdit = new JButton(icons.getIcon(IconManager.EDIT_12)); formatButton(descriptionButtonEdit, EDIT_DESC_TEXT, EDIT_DESC); editChannel = new JButton(icons.getIcon(IconManager.EDIT_12)); formatButton(editChannel, EDIT_CHANNEL_TEXT, EDIT_CHANNEL); editChannel.setEnabled(false); descriptionWiki.setEnabled(false); }
From source file:org.openmicroscopy.shoola.agents.metadata.editor.PropertiesUI.java
/** * Builds the properties component./*from w ww .j a v a 2s . c o m*/ * * @return See above. */ private JPanel buildProperties() { Object refObject = model.getRefObject(); JPanel p = new JPanel(); p.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); p.setBackground(UIUtilities.BACKGROUND_COLOR); p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); JPanel idPanel = new JPanel(); idPanel.setLayout(new BoxLayout(idPanel, BoxLayout.X_AXIS)); idPanel.setBackground(UIUtilities.BACKGROUND_COLOR); JPanel l = UIUtilities.buildComponentPanel(idLabel, 0, 0); l.setBackground(UIUtilities.BACKGROUND_COLOR); idPanel.add(l); idPanel.add(Box.createHorizontalGlue()); idPanel.add(inplaceIcon); p.add(idPanel); l = UIUtilities.buildComponentPanel(ownerLabel, 0, 0); l.setBackground(UIUtilities.BACKGROUND_COLOR); p.add(l); int w = editName.getIcon().getIconWidth() + 4; l = UIUtilities.buildComponentPanel(gpLabel, 0, 0); l.setBackground(UIUtilities.BACKGROUND_COLOR); p.add(layoutEditablefield(Box.createHorizontalStrut(w), l)); l = UIUtilities.buildComponentPanel(parentLabel, 0, 0); l.setBackground(UIUtilities.BACKGROUND_COLOR); p.add(layoutEditablefield(Box.createHorizontalStrut(w), l)); l = UIUtilities.buildComponentPanel(wellLabel, 0, 0); l.setBackground(UIUtilities.BACKGROUND_COLOR); p.add(layoutEditablefield(Box.createHorizontalStrut(w), l)); namePanel = layoutEditablefield(editName, namePane); p.add(namePanel); p.add(Box.createVerticalStrut(5)); if (refObject instanceof ImageData || refObject instanceof DatasetData || refObject instanceof ProjectData || refObject instanceof TagAnnotationData || refObject instanceof WellSampleData || refObject instanceof PlateData || refObject instanceof ScreenData || refObject instanceof PlateAcquisitionData) { descriptionScrollPane = new JScrollPane(descriptionWiki); descriptionScrollPane.setHorizontalScrollBarPolicy(ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED); descriptionScrollPane.setBorder(AnnotationUI.EDIT_BORDER); Dimension viewportSize = new Dimension(WIDTH, HEIGHT); descriptionScrollPane.getViewport().setPreferredSize(viewportSize); double[][] design = new double[][] { { TableLayout.PREFERRED, TableLayout.FILL }, { TableLayout.PREFERRED } }; TableLayout table = new TableLayout(design); descriptionPanel = new JPanel(table); descriptionPanel.setBackground(UIUtilities.BACKGROUND_COLOR); descriptionPanel.add(descriptionButtonEdit, "0, 0, c, t"); descriptionPanel.add(descriptionScrollPane, "1, 0"); p.add(descriptionPanel); p.add(Box.createVerticalStrut(5)); } return p; }
From source file:org.openmicroscopy.shoola.agents.metadata.editor.ToolBar.java
/** Initializes the components. */ private void initComponents() { setBackground(UIUtilities.BACKGROUND_COLOR); setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); IconManager icons = IconManager.getInstance(); saveButton = new JButton(icons.getIcon(IconManager.SAVE)); saveButton.setToolTipText("Save changes back to the server."); saveButton.addActionListener(controller); saveButton.setActionCommand("" + EditorControl.SAVE); saveButton.setEnabled(false);//www. j a v a 2s.co m saveButton.setBackground(UIUtilities.BACKGROUND_COLOR); downloadButton = new JButton(icons.getIcon(IconManager.DOWNLOAD)); downloadButton.setToolTipText("Download the Archived File(s)."); downloadButton.addActionListener(controller); downloadButton.setActionCommand("" + EditorControl.DOWNLOAD); //downloadButton.setEnabled(false); downloadButton.setBackground(UIUtilities.BACKGROUND_COLOR); rndButton = new JButton(icons.getIcon(IconManager.RENDERER)); rndButton.setToolTipText("Rendering control for the first selected " + "image."); rndButton.addActionListener(controller); rndButton.setActionCommand("" + EditorControl.RENDERER); rndButton.setEnabled(false); rndButton.setBackground(UIUtilities.BACKGROUND_COLOR); refreshButton = new JButton(icons.getIcon(IconManager.REFRESH)); refreshButton.setToolTipText("Refresh."); refreshButton.addActionListener(controller); refreshButton.setActionCommand("" + EditorControl.REFRESH); refreshButton.setBackground(UIUtilities.BACKGROUND_COLOR); publishingButton = new JButton(icons.getIcon(IconManager.PUBLISHING)); publishingButton.setToolTipText("Display the publishing options."); publishingButton.setEnabled(false); publishingButton.setBackground(UIUtilities.BACKGROUND_COLOR); publishingButton.addMouseListener(new MouseAdapter() { /** * Launches the dialog when the user releases the mouse. * MouseAdapter#mouseReleased(MouseEvent) */ public void mouseReleased(MouseEvent e) { launchOptions((Component) e.getSource(), e.getPoint(), MetadataViewer.PUBLISHING_OPTION); } }); analysisButton = new JButton(icons.getIcon(IconManager.ANALYSIS)); analysisButton.setToolTipText("Display the analysis options."); analysisButton.setEnabled(false); analysisButton.setBackground(UIUtilities.BACKGROUND_COLOR); analysisButton.addMouseListener(new MouseAdapter() { /** * Launches the dialog when the user releases the mouse. * MouseAdapter#mouseReleased(MouseEvent) */ public void mouseReleased(MouseEvent e) { launchOptions((Component) e.getSource(), e.getPoint(), MetadataViewer.ANALYSIS_OPTION); } }); scriptsButton = new JButton(icons.getIcon(IconManager.ANALYSIS_RUN)); scriptsButton.setToolTipText("Display the available scripts."); scriptsButton.setEnabled(false); scriptsButton.setBackground(UIUtilities.BACKGROUND_COLOR); scriptsButton.addMouseListener(new MouseAdapter() { /** * Loads the scripts of displays them if already loaded. * MouseAdapter#mousePressed(MouseEvent) */ public void mouseReleased(MouseEvent e) { if (model.getScripts() == null) { location = e.getPoint(); scriptsButton.setEnabled(false); model.loadScripts(); setStatus(true); } else { launchOptions((Component) e.getSource(), e.getPoint(), MetadataViewer.SCRIPTS_OPTION); } } }); exportAsOmeTiffButton = new JButton(icons.getIcon(IconManager.EXPORT_AS_OMETIFF)); exportAsOmeTiffButton.setEnabled(false); exportAsOmeTiffButton.setToolTipText(EXPORT_AS_OME_TIFF_TOOLTIP); exportAsOmeTiffButton.addActionListener(controller); exportAsOmeTiffButton.setActionCommand("" + EditorControl.EXPORT_AS_OMETIFF); exportAsOmeTiffButton.setBackground(UIUtilities.BACKGROUND_COLOR); uploadScriptButton = new JButton(icons.getIcon(IconManager.UPLOAD_SCRIPT)); uploadScriptButton.setToolTipText("Upload a script to the server."); uploadScriptButton.addActionListener(controller); uploadScriptButton.setActionCommand("" + EditorControl.UPLOAD_SCRIPT); uploadScriptButton.setBackground(UIUtilities.BACKGROUND_COLOR); saveAsButton = new JButton(icons.getIcon(IconManager.EXPORT_AS_OMETIFF)); saveAsButton.setToolTipText("Display the saving options."); saveAsButton.addMouseListener(new MouseAdapter() { /** * Displays the saving options. * MouseAdapter#mousePressed(MouseEvent) */ public void mouseReleased(MouseEvent e) { launchOptions((Component) e.getSource(), e.getPoint(), MetadataViewer.SAVE_OPTION); } }); saveAsButton.setBackground(UIUtilities.BACKGROUND_COLOR); viewButton = new JButton(icons.getIcon(IconManager.VIEW)); viewButton.setToolTipText("Open the Image Viewer"); if (MetadataViewerAgent.runAsPlugin() == MetadataViewer.IMAGE_J) { viewButton.addMouseListener(new MouseAdapter() { /** * Displays the <code>view</code> menu. * @see MouseListener#mouseReleased(MouseEvent) */ public void mouseReleased(MouseEvent e) { showViewMenu((Component) e.getSource(), e.getPoint()); } }); } else { viewButton.setActionCommand("" + EditorControl.VIEW_IMAGE); viewButton.addActionListener(controller); } linkButton = new JButton(icons.getIcon(IconManager.LINK)); linkButton.addMouseListener(new MouseAdapter() { /** * Launches the dialog when the user releases the mouse. * MouseAdapter#mouseReleased(MouseEvent) */ public void mouseReleased(MouseEvent e) { location = e.getPoint(); component = (Component) e.getSource(); createLinkMenu().show(component, location.x, location.y); } }); UIUtilities.unifiedButtonLookAndFeel(linkButton); UIUtilities.unifiedButtonLookAndFeel(viewButton); UIUtilities.unifiedButtonLookAndFeel(saveAsButton); UIUtilities.unifiedButtonLookAndFeel(saveButton); UIUtilities.unifiedButtonLookAndFeel(downloadButton); UIUtilities.unifiedButtonLookAndFeel(rndButton); UIUtilities.unifiedButtonLookAndFeel(refreshButton); UIUtilities.unifiedButtonLookAndFeel(exportAsOmeTiffButton); UIUtilities.unifiedButtonLookAndFeel(publishingButton); UIUtilities.unifiedButtonLookAndFeel(uploadScriptButton); UIUtilities.unifiedButtonLookAndFeel(analysisButton); UIUtilities.unifiedButtonLookAndFeel(scriptsButton); Dimension d = new Dimension(UIUtilities.DEFAULT_ICON_WIDTH, UIUtilities.DEFAULT_ICON_HEIGHT); busyLabel = new JXBusyLabel(d); busyLabel.setEnabled(true); busyLabel.setVisible(false); }
From source file:org.openmicroscopy.shoola.agents.metadata.editor.ToolBar.java
/** Builds and lays out the UI. */ private void buildGUI() { JPanel bars = new JPanel(); bars.setBackground(UIUtilities.BACKGROUND_COLOR); bars.setLayout(new BoxLayout(bars, BoxLayout.X_AXIS)); bars.add(buildGeneralBar());/*w w w .ja v a2s.co m*/ JPanel p = new JPanel(); p.setBackground(UIUtilities.BACKGROUND_COLOR); p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); JPanel pp = UIUtilities.buildComponentPanel(bars); pp.setBackground(UIUtilities.BACKGROUND_COLOR); p.add(pp); pp = UIUtilities.buildComponentPanelRight(busyLabel); pp.setBackground(UIUtilities.BACKGROUND_COLOR); p.add(pp); setLayout(new BoxLayout(this, BoxLayout.Y_AXIS)); setBackground(UIUtilities.BACKGROUND_COLOR); add(p); add(new JSeparator()); }
From source file:org.openmicroscopy.shoola.agents.metadata.editor.UserProfile.java
/** * Returns the component displayed the user photo. * /*from w w w . j a v a 2 s. c om*/ * @return See above. */ private JPanel buildProfileCanvas() { JPanel p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); p.add(userPicture); p.setBackground(UIUtilities.BACKGROUND_COLOR); JPanel bar = new JPanel(); bar.setBackground(UIUtilities.BACKGROUND_COLOR); bar.setLayout(new FlowLayout(FlowLayout.LEFT)); bar.add(changePhoto); bar.add(deletePhoto); p.add(bar); return p; }
From source file:org.openmicroscopy.shoola.agents.metadata.editor.UserProfile.java
/** * Builds the UI component hosting the UI component used to modify * the password.//from w w w . ja va 2 s. c om * * @return See above. */ private JPanel buildPasswordPanel() { JPanel content = new JPanel(); content.setBackground(UIUtilities.BACKGROUND_COLOR); Registry reg = MetadataViewerAgent.getRegistry(); String ldap = (String) reg.lookup(LookupNames.USER_AUTHENTICATION); if (ldap != null && ldap.length() > 0) { content.setBorder(BorderFactory.createTitledBorder("LDAP Authentication")); content.setLayout(new FlowLayout(FlowLayout.LEFT)); content.add(new JLabel(ldap)); return content; } content.setBorder(BorderFactory.createTitledBorder("Change Password")); content.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.fill = GridBagConstraints.HORIZONTAL; c.anchor = GridBagConstraints.WEST; c.insets = new Insets(0, 2, 2, 0); c.gridx = 0; c.gridy = 0; c.gridwidth = GridBagConstraints.RELATIVE; //next-to-last c.fill = GridBagConstraints.NONE; c.weightx = 0.0; if (MetadataViewerAgent.isAdministrator()) { content.add(UIUtilities.setTextFont(PASSWORD_NEW), c); c.gridx++; c.gridwidth = GridBagConstraints.REMAINDER; c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1.0; content.add(passwordNew, c); } else { content.add(UIUtilities.setTextFont(PASSWORD_OLD), c); c.gridx++; c.gridwidth = GridBagConstraints.REMAINDER; c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1.0; content.add(oldPassword, c); c.gridy++; c.gridx = 0; c.gridwidth = GridBagConstraints.RELATIVE; //next-to-last c.fill = GridBagConstraints.NONE; c.weightx = 0.0; content.add(UIUtilities.setTextFont(PASSWORD_NEW), c); c.gridx++; c.gridwidth = GridBagConstraints.REMAINDER; c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1.0; content.add(passwordNew, c); c.gridy++; c.gridx = 0; c.gridwidth = GridBagConstraints.RELATIVE; //next-to-last c.fill = GridBagConstraints.NONE; c.weightx = 0.0; content.add(UIUtilities.setTextFont(PASSWORD_CONFIRMATION), c); c.gridx++; c.gridwidth = GridBagConstraints.REMAINDER; c.fill = GridBagConstraints.HORIZONTAL; c.weightx = 1.0; content.add(passwordConfirm, c); c.gridy++; c.gridx = 0; } JPanel p = new JPanel(); p.setBackground(UIUtilities.BACKGROUND_COLOR); p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); p.add(content); JPanel buttonPanel = UIUtilities.buildComponentPanel(passwordButton); buttonPanel.setBackground(UIUtilities.BACKGROUND_COLOR); p.add(buttonPanel); return p; }
From source file:org.openmicroscopy.shoola.agents.metadata.rnd.GraphicsPane.java
/** * Builds and lays out the slider./* w ww . ja v a 2s .c om*/ * * @return See above. */ private JPanel buildPane() { JPanel p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); p.setBackground(UIUtilities.BACKGROUND_COLOR); p.add(codomainSlider); return p; }
From source file:org.openmicroscopy.shoola.agents.metadata.rnd.GraphicsPane.java
/** * Builds and lays out the images as seen by other experimenters. * /*w ww . j ava 2s . co m*/ * @param results The thumbnails to lay out. */ void displayViewedBy(List results) { if (results == null) return; JPanel p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); p.setBackground(UIUtilities.BACKGROUND_COLOR); Iterator<ViewedByItem> i = results.iterator(); JPanel row = null; int index = 0; ViewedByItem item; int maxPerRow = 2; while (i.hasNext()) { item = i.next(); if (index == 0) { row = new JPanel(); row.setBackground(UIUtilities.BACKGROUND_COLOR); row.setLayout(new FlowLayout(FlowLayout.LEFT)); row.add(item); index++; } else if (index == maxPerRow) { row.add(item); p.add(row); index = 0; } else { row.add(item); index++; } } if (index > 0) p.add(row); viewedBy.removeAll(); JPanel content = UIUtilities.buildComponentPanel(p); content.setBackground(UIUtilities.BACKGROUND_COLOR); viewedBy.add(content); viewedBy.setVisible(true); viewedBy.setCollapsed(false); }
From source file:org.openmicroscopy.shoola.agents.treeviewer.util.MIFNotificationDialog.java
/** * Layout the result per group./*from w ww . j a v a2 s .com*/ * * @param object The object to handle * @param n The number of objects to handle. * @return See above. */ private JComponent layoutMIFResult(MIFResultObject object, int n) { JPanel p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); Map<Long, Map<Boolean, List<ImageData>>> map = object.getResult(); Entry<Long, Map<Boolean, List<ImageData>>> e; Iterator<Entry<Long, Map<Boolean, List<ImageData>>>> i = map.entrySet().iterator(); List<ThumbnailData> thumbnails; JPanel row; List<ImageData> images; StringBuffer buf; String text = "You tried to move "; if (ImageCheckerType.DELETE.equals(index)) text = "You tried to delete "; int size; while (i.hasNext()) { e = i.next(); buf = new StringBuffer(); buf.append(text); row = createRow(); images = e.getValue().get(Boolean.valueOf(true)); size = images.size(); buf.append(size); buf.append(" image"); if (size > 1) buf.append("s"); buf.append(" from a fileset, leaving "); thumbnails = object.getThumbnailsFromList(images); row.add(layoutThumbnails(images.size() - thumbnails.size(), thumbnails)); row.add(Box.createHorizontalStrut(10)); images = e.getValue().get(Boolean.valueOf(false)); buf.append(images.size()); buf.append("."); thumbnails = object.getThumbnailsFromList(images); row.add(layoutThumbnails(images.size() - thumbnails.size(), thumbnails)); p.add(UIUtilities.buildComponentPanel(new JLabel(buf.toString()))); p.add(row); } if (n == 1) return new JScrollPane(p); long id = object.getContext().getGroupID(); GroupData group = getGroup(id); if (group != null) text = group.getName(); else { buf = new StringBuffer(); buf.append("Group "); buf.append(id); text = buf.toString(); } JXTaskPane pane = EditorUtil.createTaskPane(text); pane.add(new JScrollPane(p)); return pane; }