List of usage examples for javax.swing JPanel setBackground
@BeanProperty(preferred = true, visualUpdate = true, description = "The background color of the component.") public void setBackground(Color bg)
From source file:org.openmicroscopy.shoola.agents.metadata.editor.AnnotationDataUI.java
/** Builds and lays out the UI. */ private void buildGUI() { removeAll();/*w w w. j a va 2s . co m*/ JLabel l = new JLabel(); Font f = l.getFont(); int size = f.getSize() - 1; content.removeAll(); content.setLayout(new GridBagLayout()); GridBagConstraints c = new GridBagConstraints(); c.insets = new Insets(2, 1, 2, 1); c.anchor = GridBagConstraints.WEST; c.gridx = 0; c.gridy = 0; c.weightx = 1; c.weighty = 1; c.gridwidth = 2; c.fill = GridBagConstraints.HORIZONTAL; if (!model.isAnnotationLoaded()) { l.setText("Annotation could not be loaded"); content.add(l, c); return; } if (model.isMultiSelection()) { Object refObject = model.getRefObject(); StringBuffer buffer = new StringBuffer(); buffer.append("Annotate the selected "); buffer.append(model.getObjectTypeAsString(refObject)); buffer.append("s"); l.setText(buffer.toString()); content.add(l, c); c.gridy++; } // filters content.add(createBar(filterButton, null), c); c.gridy++; // rating c.gridwidth = 1; c.gridx = 0; c.weightx = 0; c.fill = GridBagConstraints.NONE; JPanel p = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); p.setBackground(UIUtilities.BACKGROUND_COLOR); p.add(UIUtilities.setTextFont("Rating:", Font.BOLD, size)); p.add(createBar(unrateButton, null)); content.add(p, c); c.gridx = 1; c.weightx = 1; c.fill = GridBagConstraints.HORIZONTAL; p = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); p.setBackground(UIUtilities.BACKGROUND_COLOR); p.add(rating); p.add(Box.createHorizontalStrut(2)); p.add(otherRating); content.add(p, c); c.gridy++; // tags c.gridx = 0; p = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); p.setBackground(UIUtilities.BACKGROUND_COLOR); p.add(UIUtilities.setTextFont("Tags:", Font.BOLD, size)); p.add(createBar(addTagsButton, removeTagsButton)); content.add(p, c); c.gridy++; content.add(tagsPane, c); c.gridy++; // attachment c.gridx = 0; c.gridwidth = 2; p = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); p.setBackground(UIUtilities.BACKGROUND_COLOR); p.add(UIUtilities.setTextFont("Attachments:", Font.BOLD, size)); p.add(createBar(addDocsButton, removeDocsButton)); content.add(p, c); c.gridy++; content.add(docRef, c); c.gridy++; if (!model.isMultiSelection()) { mapsPane.reload(filter); content.add(mapsPane, c); c.gridy++; } // other if (!CollectionUtils.isEmpty(model.getAllOtherAnnotations())) { p = new JPanel(new FlowLayout(FlowLayout.LEFT, 0, 0)); p.setBackground(UIUtilities.BACKGROUND_COLOR); p.add(UIUtilities.setTextFont("Others:", Font.BOLD, size)); p.add(createBar(null, removeOtherAnnotationsButton)); content.add(p, c); c.gridy++; content.add(otherPane, c); } add(content, BorderLayout.CENTER); }
From source file:org.openmicroscopy.shoola.agents.metadata.editor.AnnotationDataUI.java
/** * Creates a row./* www. j av a2 s . c o m*/ * * @return See above. */ private JPanel initRow() { JPanel p = new JPanel(); p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); p.setBackground(UIUtilities.BACKGROUND_COLOR); return p; }
From source file:org.openmicroscopy.shoola.agents.metadata.editor.AnnotationTaskPaneUI.java
/** * Creates the toolbar, if needed (see {@link #getToolbarButtons()} *//* w ww . ja v a 2 s. c om*/ private JPanel getToolbar() { JPanel p = new JPanel(); p.setBackground(UIUtilities.BACKGROUND_COLOR); p.setLayout(new FlowLayout(FlowLayout.RIGHT)); List<JButton> buttons = getToolbarButtons(); if (CollectionUtils.isNotEmpty(buttons)) { for (JButton b : buttons) { p.add(b); } } return p; }
From source file:org.openmicroscopy.shoola.agents.metadata.editor.GeneralPaneUI.java
/** Initializes the UI components. */ private void initComponents() { container = new JXTaskPaneContainer(); container.setBackground(UIUtilities.BACKGROUND); if (container.getLayout() instanceof VerticalLayout) { VerticalLayout vl = (VerticalLayout) container.getLayout(); vl.setGap(0);/* w w w. j a va 2 s . com*/ } if (model.getBrowser() != null) { browserTaskPane = EditorUtil.createTaskPane(Browser.TITLE); browserTaskPane.add(model.getBrowser().getUI()); browserTaskPane.addPropertyChangeListener(controller); } protocolTaskPane = EditorUtil.createTaskPane(PROTOCOL); propertiesUI = new PropertiesUI(model, controller); textualAnnotationsUI = new TextualAnnotationsUI(model, controller); annotationUI = new AnnotationDataUI(view, model, controller); components = new ArrayList<AnnotationUI>(); components.add(propertiesUI); components.add(textualAnnotationsUI); components.add(annotationUI); Iterator<AnnotationUI> i = components.iterator(); while (i.hasNext()) { i.next().addPropertyChangeListener(EditorControl.SAVE_PROPERTY, controller); } previews = new ArrayList<PreviewPanel>(); propertiesTaskPane = EditorUtil.createTaskPane(""); propertiesTaskPane.setCollapsed(false); propertiesTaskPane.add(propertiesUI); annotationTaskPane = EditorUtil.createTaskPane("Annotations"); annotationTaskPane.setCollapsed(false); JPanel p = new JPanel(); p.setBackground(UIUtilities.BACKGROUND_COLOR); p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS)); p.add(annotationUI); p.add(textualAnnotationsUI); annotationTaskPane.add(p); }
From source file:org.openmicroscopy.shoola.agents.metadata.editor.OriginalMetadataComponent.java
/** Initializes the components. */ private void initComponents() { IconManager icons = IconManager.getInstance(); Icon icon = icons.getIcon(IconManager.DOWNLOAD); downloadButton = new JButton(icon); downloadButton.setBackground(UIUtilities.BACKGROUND_COLOR); downloadButton.setOpaque(false);// w w w . j av a 2s . c o m UIUtilities.unifiedButtonLookAndFeel(downloadButton); downloadButton.setToolTipText("Download the metadata file."); downloadButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent evt) { download(); } }); toolBar = buildToolBar(); toolBar.setBackground(UIUtilities.BACKGROUND_COLOR); JXBusyLabel label = new JXBusyLabel(new Dimension(icon.getIconWidth(), icon.getIconHeight())); label.setBackground(UIUtilities.BACKGROUND_COLOR); label.setBusy(true); JPanel p = new JPanel(); p.setBackground(UIUtilities.BACKGROUND_COLOR); p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS)); p.add(label); p.add(Box.createHorizontalStrut(5)); JLabel l = new JLabel("Loading metadata"); l.setBackground(UIUtilities.BACKGROUND_COLOR); p.add(l); statusBar = UIUtilities.buildComponentPanel(p); statusBar.setBackground(UIUtilities.BACKGROUND_COLOR); setBackground(UIUtilities.BACKGROUND_COLOR); setLayout(new BorderLayout(0, 0)); add(statusBar, BorderLayout.NORTH); }
From source file:org.openmicroscopy.shoola.agents.metadata.editor.OriginalMetadataComponent.java
/** * Builds and lays out the UI.//from www . j av a 2 s . c o 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
/** * Lays out the plate fields.//from w w w. j av a 2 s.com * * @param plate The plate to handle. * @return See above. */ private JPanel layoutPlateContent(PlateData plate) { JPanel content = new JPanel(); content.setBackground(UIUtilities.BACKGROUND_COLOR); content.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); content.setLayout(new GridBagLayout()); JLabel l = new JLabel(); Font font = l.getFont(); int size = font.getSize() - 2; Map<JLabel, JComponent> components = new LinkedHashMap<JLabel, JComponent>(); String v = plate.getPlateType(); JLabel value; if (v != null && v.trim().length() > 0) { l = UIUtilities.setTextFont(EditorUtil.TYPE, Font.BOLD, size); value = UIUtilities.createComponent(null); value.setFont(font.deriveFont(font.getStyle(), size)); value.setForeground(UIUtilities.DEFAULT_FONT_COLOR); value.setText(v); components.put(l, value); } l = UIUtilities.setTextFont(EditorUtil.EXTERNAL_IDENTIFIER, Font.BOLD, size); value = UIUtilities.createComponent(null); value.setFont(font.deriveFont(font.getStyle(), size)); value.setForeground(UIUtilities.DEFAULT_FONT_COLOR); v = plate.getExternalIdentifier(); if (v == null || v.length() == 0) v = NO_SET_TEXT; value.setText(v); components.put(l, value); l = UIUtilities.setTextFont(EditorUtil.STATUS, Font.BOLD, size); value = UIUtilities.createComponent(null); value.setFont(font.deriveFont(font.getStyle(), size)); value.setForeground(UIUtilities.DEFAULT_FONT_COLOR); v = plate.getStatus(); if (v == null || v.length() == 0) v = NO_SET_TEXT; value.setText(v); components.put(l, value); layoutComponents(content, components); return content; }
From source file:org.openmicroscopy.shoola.agents.metadata.editor.PropertiesUI.java
/** * Lays out the well fields./*from w w w.ja v a2 s . c o m*/ * * @param well The well to handle. * @return See above. */ private JPanel layoutWellContent(WellData well) { JPanel content = new JPanel(); content.setBackground(UIUtilities.BACKGROUND_COLOR); content.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); content.setLayout(new GridBagLayout()); JLabel l = new JLabel(); Font font = l.getFont(); int size = font.getSize() - 2; Map<JLabel, JComponent> components = new LinkedHashMap<JLabel, JComponent>(); String v = well.getWellType(); JLabel value; if (v != null && v.trim().length() > 0) { l = UIUtilities.setTextFont(EditorUtil.TYPE, Font.BOLD, size); value = UIUtilities.createComponent(null); value.setFont(font.deriveFont(font.getStyle(), size)); value.setForeground(UIUtilities.DEFAULT_FONT_COLOR); value.setText(v); components.put(l, value); } l = UIUtilities.setTextFont(EditorUtil.EXTERNAL_DESCRIPTION, Font.BOLD, size); value = UIUtilities.createComponent(null); value.setFont(font.deriveFont(font.getStyle(), size)); value.setForeground(UIUtilities.DEFAULT_FONT_COLOR); v = well.getExternalDescription(); if (v == null || v.length() == 0) v = NO_SET_TEXT; value.setText(v); components.put(l, value); l = UIUtilities.setTextFont(EditorUtil.STATUS, Font.BOLD, size); value = UIUtilities.createComponent(null); value.setFont(font.deriveFont(font.getStyle(), size)); value.setForeground(UIUtilities.DEFAULT_FONT_COLOR); v = well.getStatus(); if (v == null || v.length() == 0) v = NO_SET_TEXT; value.setText(v); components.put(l, value); layoutComponents(content, components); return content; }
From source file:org.openmicroscopy.shoola.agents.metadata.editor.PropertiesUI.java
/** * Lays out the screen fields.//from ww w. j a v a2s . c om * * @param screen The screen to handle. * @return See above. */ private JPanel layoutScreenContent(ScreenData screen) { JPanel content = new JPanel(); content.setBackground(UIUtilities.BACKGROUND_COLOR); content.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); content.setLayout(new GridBagLayout()); JLabel l = new JLabel(); Font font = l.getFont(); int size = font.getSize() - 2; Map<JLabel, JComponent> components = new LinkedHashMap<JLabel, JComponent>(); l = UIUtilities.setTextFont("Protocol Identifier:", Font.BOLD, size); JLabel value = UIUtilities.createComponent(null); value.setForeground(UIUtilities.DEFAULT_FONT_COLOR); String v = screen.getProtocolIdentifier(); if (v == null || v.length() == 0) v = NO_SET_TEXT; value.setText(v); components.put(l, value); l = UIUtilities.setTextFont("Protocol Description:", Font.BOLD, size); value = UIUtilities.createComponent(null); value.setFont(font.deriveFont(font.getStyle(), size)); value.setForeground(UIUtilities.DEFAULT_FONT_COLOR); v = screen.getProtocolDescription(); if (v == null || v.length() == 0) v = NO_SET_TEXT; value.setText(v); components.put(l, value); l = UIUtilities.setTextFont("ReagentSet Identifier:", Font.BOLD, size); value = UIUtilities.createComponent(null); value.setFont(font.deriveFont(font.getStyle(), size)); value.setForeground(UIUtilities.DEFAULT_FONT_COLOR); v = screen.getReagentSetIdentifier(); if (v == null || v.length() == 0) v = NO_SET_TEXT; value.setText(v); components.put(l, value); l = UIUtilities.setTextFont("ReagentSet Description:", Font.BOLD, size); value = UIUtilities.createComponent(null); value.setForeground(UIUtilities.DEFAULT_FONT_COLOR); value.setFont(font.deriveFont(font.getStyle(), size)); v = screen.getReagentSetDescripion(); if (v == null || v.length() == 0) v = NO_SET_TEXT; value.setText(v); components.put(l, value); layoutComponents(content, components); return content; }
From source file:org.openmicroscopy.shoola.agents.metadata.editor.PropertiesUI.java
/** * Builds the panel hosting the information * // w w w. j a v a 2 s.c om * @param details The information to display. * @param image The image of reference. * @return See above. */ private JPanel buildContentPanel(Map details, ImageData image) { JPanel content = new JPanel(); content.setBackground(UIUtilities.BACKGROUND_COLOR); content.setBorder(BorderFactory.createEmptyBorder(0, 5, 0, 5)); 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.gridy = 0; c.gridx = 0; JLabel l = new JLabel(); Font font = l.getFont(); int size = font.getSize() - 2; JLabel label = UIUtilities.setTextFont(EditorUtil.ARCHIVED, Font.BOLD, size); JCheckBox box = new JCheckBox(); box.setEnabled(false); box.setBackground(UIUtilities.BACKGROUND); box.setSelected(model.isArchived()); content.add(label, c); c.gridx = c.gridx + 2; content.add(box, c); c.gridy++; c.gridx = 0; label = UIUtilities.setTextFont(EditorUtil.ACQUISITION_DATE, Font.BOLD, size); JLabel value = UIUtilities.createComponent(null); String v = model.formatDate(image); value.setText(v); content.add(label, c); c.gridx = c.gridx + 2; content.add(value, c); c.gridy++; c.gridx = 0; try { //just to be on the save side label = UIUtilities.setTextFont(EditorUtil.IMPORTED_DATE, Font.BOLD, size); value = UIUtilities.createComponent(null); v = UIUtilities.formatShortDateTime(image.getInserted()); value.setText(v); content.add(label, c); c.gridx = c.gridx + 2; content.add(value, c); c.gridy++; } catch (Exception e) { } label = UIUtilities.setTextFont(EditorUtil.XY_DIMENSION, Font.BOLD, size); value = UIUtilities.createComponent(null); v = (String) details.get(EditorUtil.SIZE_X); v += " x "; v += (String) details.get(EditorUtil.SIZE_Y); value.setText(v); c.gridx = 0; content.add(label, c); c.gridx = c.gridx + 2; content.add(value, c); c.gridy++; label = UIUtilities.setTextFont(EditorUtil.PIXEL_TYPE, Font.BOLD, size); value = UIUtilities.createComponent(null); value.setText((String) details.get(EditorUtil.PIXEL_TYPE)); c.gridx = 0; content.add(label, c); c.gridx = c.gridx + 2; content.add(value, c); value = UIUtilities.createComponent(null); String s = formatPixelsSize(details, value); if (s != null) { c.gridy++; label = UIUtilities.setTextFont(s, Font.BOLD, size); c.gridx = 0; content.add(label, c); c.gridx = c.gridx + 2; content.add(value, c); } //parse modulo T. Map<Integer, ModuloInfo> modulo = model.getModulo(); ModuloInfo moduloT = modulo.get(ModuloInfo.T); c.gridy++; label = UIUtilities.setTextFont(EditorUtil.Z_T_FIELDS, Font.BOLD, size); value = UIUtilities.createComponent(null); v = (String) details.get(EditorUtil.SECTIONS); v += " x "; if (moduloT != null) { String time = (String) details.get(EditorUtil.TIMEPOINTS); int t = Integer.parseInt(time); v += "" + (t / moduloT.getSize()); } else { v += (String) details.get(EditorUtil.TIMEPOINTS); } value.setText(v); c.gridx = 0; content.add(label, c); c.gridx = c.gridx + 2; content.add(value, c); c.gridy++; if (moduloT != null) { label = UIUtilities.setTextFont(EditorUtil.SMALL_T_VARIABLE, Font.BOLD, size); value = UIUtilities.createComponent(null); value.setText("" + moduloT.getSize()); c.gridx = 0; content.add(label, c); c.gridx = c.gridx + 2; content.add(value, c); c.gridy++; } if (!model.isNumerousChannel() && model.getRefObjectID() > 0) { label = UIUtilities.setTextFont(EditorUtil.CHANNELS, Font.BOLD, size); c.gridx = 0; c.anchor = GridBagConstraints.NORTHEAST; content.add(label, c); c.anchor = GridBagConstraints.CENTER; c.gridx++; content.add(editChannel, c); c.gridx++; content.add(channelsPane, c); } JPanel p = UIUtilities.buildComponentPanel(content); p.setBackground(UIUtilities.BACKGROUND_COLOR); return p; }