List of usage examples for javax.swing JLabel getFont
@Transient
public Font getFont()
From source file:org.nuxeo.launcher.gui.NuxeoFrame.java
protected JComponent buildFooter() { JLabel label = new JLabel(NuxeoLauncherGUI.getMessage("footer.label", new DateTime().toString("Y"))); label.setForeground(Color.WHITE); label.setPreferredSize(new Dimension(470, 16)); label.setFont(new Font(label.getFont().getName(), label.getFont().getStyle(), 9)); label.setHorizontalAlignment(SwingConstants.CENTER); return label; }
From source file:org.openmicroscopy.shoola.agents.metadata.editor.AnnotationDataUI.java
/** Builds and lays out the UI. */ private void buildGUI() { removeAll();//from www . j av a 2 s . c o 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.ChannelAcquisitionComponent.java
/** * Transforms the detector metadata.// ww w .j a v a 2 s .c o m * * @param details The value to transform. */ private void transformGeneralSource(Map<String, Object> details) { DataComponent comp; JLabel label; JComponent area; String key; Object value; label = new JLabel(); Font font = label.getFont(); int sizeLabel = font.getSize() - 2; Object selected; List notSet = (List) details.get(EditorUtil.NOT_SET); details.remove(EditorUtil.NOT_SET); if (notSet.size() > 0 && unsetGeneral == null) { unsetGeneral = parent.formatUnsetFieldsControl(); unsetGeneral.setActionID(GENERAL); unsetGeneral.addPropertyChangeListener(this); } Set entrySet = details.entrySet(); Entry entry; Iterator i = entrySet.iterator(); boolean set; while (i.hasNext()) { entry = (Entry) i.next(); key = (String) entry.getKey(); set = !notSet.contains(key); value = entry.getValue(); label = UIUtilities.setTextFont(key, Font.BOLD, sizeLabel); label.setBackground(UIUtilities.BACKGROUND_COLOR); if (EditorUtil.ILLUMINATION.equals(key)) { selected = model.getChannelEnumerationSelected(Editor.ILLUMINATION_TYPE, (String) value); if (selected != null) illuminationBox.setSelectedItem(selected); else { set = false; illuminationBox.setSelectedIndex(illuminationBox.getItemCount() - 1); } illuminationBox.setEditedColor(UIUtilities.EDITED_COLOR); area = illuminationBox;//parent.replaceCombobox(illuminationBox); } else if (EditorUtil.CONTRAST_METHOD.equals(key)) { selected = model.getChannelEnumerationSelected(Editor.ILLUMINATION_TYPE, (String) value); if (selected != null) contrastMethodBox.setSelectedItem(selected); else { set = false; contrastMethodBox.setSelectedIndex(contrastMethodBox.getItemCount() - 1); } contrastMethodBox.setEditedColor(UIUtilities.EDITED_COLOR); area = contrastMethodBox;//parent.replaceCombobox(contrastMethodBox); } else if (EditorUtil.MODE.equals(key)) { selected = model.getChannelEnumerationSelected(Editor.MODE, (String) value); if (selected != null) modeBox.setSelectedItem(selected); else { set = false; modeBox.setSelectedIndex(modeBox.getItemCount() - 1); } modeBox.setEditedColor(UIUtilities.EDITED_COLOR); area = modeBox;//parent.replaceCombobox(modeBox); } else { if (value instanceof Number) { area = UIUtilities.createComponent(NumericalTextField.class, null); String v = ""; if (value instanceof Double) { v = "" + UIUtilities.roundTwoDecimals(((Number) value).doubleValue()); ((NumericalTextField) area).setNumberType(Double.class); } else if (value instanceof Float) { v = "" + UIUtilities.roundTwoDecimals(((Number) value).doubleValue()); ((NumericalTextField) area).setNumberType(Float.class); } else v = "" + value; ((NumericalTextField) area).setText(v); ((NumericalTextField) area).setEditedColor(UIUtilities.EDITED_COLOR); } else { area = UIUtilities.createComponent(OMETextArea.class, null); if (value == null || value.equals("")) { set = false; value = AnnotationUI.DEFAULT_TEXT; } ((OMETextArea) area).setEditable(false); ((OMETextArea) area).setText((String) value); ((OMETextArea) area).setEditedColor(UIUtilities.EDITED_COLOR); } } area.setEnabled(!set); comp = new DataComponent(label, area); comp.setEnabled(false); comp.setSetField(!notSet.contains(key)); fieldsGeneral.put(key, comp); } }
From source file:org.openmicroscopy.shoola.agents.metadata.editor.PropertiesUI.java
/** * Lays out the plate fields.// w w w . ja v a2 s . c om * * @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.// w w w. ja v a 2 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.// w w w . j a va2 s . c o m * * @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 . jav a2 s .c o m*/ * @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; }
From source file:org.openmicroscopy.shoola.agents.util.ui.ScriptingDialog.java
/** * Returns the component displaying the description of the script. * * @return See above.//from w w w. jav a 2 s . c o m */ private JComponent buildDescriptionPane() { String description = script.getDescription(); if (StringUtils.isBlank(description)) return null; OMEWikiComponent area = new OMEWikiComponent(false); area.setEnabled(false); area.setText(description); JPanel content = new JPanel(); content.setLayout(new BoxLayout(content, BoxLayout.Y_AXIS)); JLabel label = UIUtilities.setTextFont(script.getName()); Font f = label.getFont(); label.setFont(f.deriveFont(f.getStyle(), f.getSize() + 2)); content.add(UIUtilities.buildComponentPanel(label)); content.add(Box.createVerticalStrut(5)); JPanel p = UIUtilities.buildComponentPanel(area); p.setBackground(BG_COLOR); area.setBackground(BG_COLOR); content.add(p); return content; }
From source file:org.openmicroscopy.shoola.agents.util.ui.ScriptingDialog.java
/** * Builds the component displaying the parameters. * * @return See above./*from w w w . j a va 2 s. co m*/ */ private JPanel buildBody() { JPanel p = new JPanel(); p.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5)); double[] columns = { TableLayout.PREFERRED, 5, TableLayout.FILL }; TableLayout layout = new TableLayout(); layout.setColumn(columns); p.setLayout(layout); int row = 0; JComponent area = buildDescriptionPane(); JComponent authorsPane = buildScriptDetails(); if (area != null) { layout.insertRow(row, TableLayout.PREFERRED); p.add(area, "0," + row + ", 2, " + row); row++; } if (authorsPane != null) { layout.insertRow(row, TableLayout.PREFERRED); p.add(authorsPane, "0," + row + ", 2, " + row); row++; } layout.insertRow(row, 5); row++; Entry<String, ScriptComponent> entry; Iterator<Entry<String, ScriptComponent>> i = components.entrySet().iterator(); ScriptComponent comp; int required = 0; while (i.hasNext()) { entry = i.next(); comp = entry.getValue(); layout.insertRow(row, TableLayout.PREFERRED); comp.buildUI(); if (comp.isRequired()) required++; p.add(comp, "0," + row + ", 2, " + row); row++; layout.insertRow(row, 2); row++; } if (required > 0) { JLabel label = new JLabel(TEXT_END); Font font = label.getFont(); label.setFont(font.deriveFont(font.getStyle(), font.getSize() - 2)); label.setForeground(UIUtilities.REQUIRED_FIELDS_COLOR); layout.insertRow(row, TableLayout.PREFERRED); p.add(UIUtilities.buildComponentPanel(label), "0," + row + ",2, " + row); } JPanel controls = new JPanel(); controls.setLayout(new BorderLayout(0, 0)); controls.add(new JScrollPane(p), BorderLayout.CENTER); controls.add(buildControlPanel(), BorderLayout.SOUTH); return controls; }
From source file:org.openmicroscopy.shoola.env.ui.ActivityComponent.java
/** * Returns the tool bar./*from w w w .j a v a 2s.co m*/ * * @return See above. */ private JComponent createToolBar() { toolBar = new JToolBar(); toolBar.setOpaque(false); toolBar.setFloatable(false); toolBar.setBorder(null); buttonIndex = 0; toolBar.add(exceptionButton); toolBar.add(Box.createHorizontalStrut(5)); buttonIndex = 2; toolBar.add(cancelButton); JLabel l = new JLabel(); Font f = l.getFont(); l.setForeground(UIUtilities.LIGHT_GREY.darker()); l.setFont(f.deriveFont(f.getStyle(), f.getSize() - 2)); String s = UIUtilities.formatShortDateTime(null); String[] values = s.split(" "); if (values.length > 1) { String v = values[1]; if (values.length > 2) v += " " + values[2]; l.setText(v); toolBar.add(Box.createHorizontalStrut(5)); toolBar.add(l); toolBar.add(Box.createHorizontalStrut(5)); } return toolBar; }