List of usage examples for java.awt Font deriveFont
public Font deriveFont(int style, AffineTransform trans)
From source file:org.openmicroscopy.shoola.util.ui.UIUtilities.java
/** * Displays the specified string into a {@link JLabel} and sets * the font to <code>bold</code>. * /*from w w w. java 2 s . c o m*/ * @param s The string to display. * @param fontStyle The style of font. * @param fontSize The size of the font. * @return See above. */ public static JLabel setTextFont(String s, int fontStyle, int fontSize) { if (s == null) s = ""; JLabel label = new JLabel(s); Font font = label.getFont(); label.setFont(font.deriveFont(fontStyle, fontSize)); return label; }
From source file:org.openmicroscopy.shoola.util.ui.UIUtilities.java
/** * Creates a new label.//from w ww . j av a 2s .c o m * * @param type The type of component to create. Default type is JLabel. * @param color The foreground color if not <code>null</code>. * @return See above. */ public static JComponent createComponent(Class type, Color color) { if (type == null) type = JLabel.class; JComponent comp = null; if (JLabel.class.equals(type)) comp = new JLabel(); else if (OMETextField.class.equals(type)) comp = new OMETextField(); else if (OMETextArea.class.equals(type)) comp = new OMETextArea(); else if (NumericalTextField.class.equals(type)) { comp = new NumericalTextField(); ((NumericalTextField) comp).setHorizontalAlignment(JTextField.LEFT); ((NumericalTextField) comp).setNegativeAccepted(true); comp.setBorder(null); } if (comp == null) comp = new JLabel(); comp.setBackground(BACKGROUND_COLOR); Font font = comp.getFont(); comp.setFont(font.deriveFont(font.getStyle(), font.getSize() - 2)); if (color != null) comp.setForeground(color); return comp; }
From source file:savant.view.swing.GraphPane.java
/** * Draw an informational message on top of this GraphPane. * * @param g2 the graphics to be rendered * @param message text of the message to be displayed */// w w w . j a v a2 s.c o m private void drawMessage(Graphics2D g2, String message) { g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); Font font = g2.getFont(); Font subFont = font; int h = getSize().height / 3; int w = getWidth(); if (w > 500) { font = font.deriveFont(Font.PLAIN, 36); subFont = subFont.deriveFont(Font.PLAIN, 18); } else if (w > 150) { font = font.deriveFont(Font.PLAIN, 24); subFont = subFont.deriveFont(Font.PLAIN, 12); } else { font = font.deriveFont(Font.PLAIN, 12); subFont = subFont.deriveFont(Font.PLAIN, 8); } int returnPos = message.indexOf('\n'); g2.setColor(ColourSettings.getColor(ColourKey.GRAPH_PANE_MESSAGE)); if (returnPos > 0) { drawMessageHelper(g2, message.substring(0, returnPos), font, w, h, -(subFont.getSize() / 2)); drawMessageHelper(g2, message.substring(returnPos + 1), subFont, w, h, font.getSize() - (subFont.getSize() / 2)); } else { drawMessageHelper(g2, message, font, w, h, 0); } }
From source file:org.openmicroscopy.shoola.agents.util.EditorUtil.java
/** * Initializes a <code>JComboBox</code>. * /*from ww w. ja v a 2 s. com*/ * @param values The values to display. * @param decrement The value by which the font size is reduced. * @param backgoundColor The backgoundColor of the combo box. * @return See above. */ public static OMEComboBox createComboBox(Object[] values, int decrement, Color backgoundColor) { OMEComboBox box = new OMEComboBox(values); box.setOpaque(true); if (backgoundColor != null) box.setBackground(backgoundColor); OMEComboBoxUI ui = new OMEComboBoxUI(); ui.setBackgroundColor(box.getBackground()); ui.installUI(box); box.setUI(ui); Font f = box.getFont(); int size = f.getSize() - decrement; box.setBorder(null); box.setFont(f.deriveFont(Font.ITALIC, size)); return box; }
From source file:org.openmicroscopy.shoola.agents.fsimporter.util.FileImportComponent.java
/** * Adds the specified files to the list of import data. * // w w w. jav a 2s. c o m * @param files The files to import. */ private void insertFiles(Map<File, StatusLabel> files) { resultIndex = ImportStatus.SUCCESS; if (files == null || files.size() == 0) return; components = new HashMap<File, FileImportComponent>(); Entry<File, StatusLabel> entry; Iterator<Entry<File, StatusLabel>> i = files.entrySet().iterator(); FileImportComponent c; File f; DatasetData d = dataset; Object node = refNode; if (importable.isFolderAsContainer()) { node = null; d = new DatasetData(); d.setName(getFile().getName()); } ImportableFile copy; while (i.hasNext()) { entry = i.next(); f = entry.getKey(); copy = importable.copy(); copy.setFile(f); c = new FileImportComponent(copy, browsable, singleGroup, getIndex(), tags); if (f.isFile()) { c.setLocation(data, d, node); c.setParent(this); } c.setType(getType()); attachListeners(c); c.setStatusLabel(entry.getValue()); entry.getValue().addPropertyChangeListener(this); components.put((File) entry.getKey(), c); } removeAll(); pane = EditorUtil.createTaskPane(getFile().getName()); pane.setCollapsed(false); IconManager icons = IconManager.getInstance(); pane.setIcon(icons.getIcon(IconManager.DIRECTORY)); Font font = pane.getFont(); pane.setFont(font.deriveFont(font.getStyle(), font.getSize() - 2)); layoutEntries(false); double[][] size = { { TableLayout.FILL }, { TableLayout.PREFERRED } }; setLayout(new TableLayout(size)); add(pane, new TableLayoutConstraints(0, 0)); validate(); repaint(); }
From source file:org.openmicroscopy.shoola.agents.fsimporter.util.FileImportComponent.java
/** Initializes the components. */ private void initComponents() { actionMenuButton = new JButton(); actionMenuButton.setVisible(false);// www . j a v a 2s . c o m actionMenuButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { JPopupMenu popup = createActionMenu(); popup.show(actionMenuButton, 0, actionMenuButton.getHeight()); } }); adapter = new MouseAdapter() { /** * Views the image. * @see MouseListener#mousePressed(MouseEvent) */ public void mousePressed(MouseEvent e) { if (e.getClickCount() == 1) { launchFullViewer(); } } }; setLayout(new FlowLayout(FlowLayout.LEFT)); busyLabel = new JXBusyLabel(SIZE); busyLabel.setVisible(false); busyLabel.setBusy(false); cancelButton = new JButton("Cancel"); cancelButton.setForeground(UIUtilities.HYPERLINK_COLOR); cancelButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent ev) { cancelLoading(); } }); cancelButton.setVisible(true); namePane = new JPanel(); namePane.setLayout(new FlowLayout(FlowLayout.LEFT, 5, 5)); IconManager icons = IconManager.getInstance(); Icon icon; if (getFile().isFile()) icon = icons.getIcon(IconManager.IMAGE); else icon = icons.getIcon(IconManager.DIRECTORY); imageLabel = new ThumbnailLabel(icon); imageLabel.addPropertyChangeListener(this); imageLabels = new ArrayList<ThumbnailLabel>(); ThumbnailLabel label; for (int i = 0; i < MAX_THUMBNAILS; i++) { label = new ThumbnailLabel(); if (i == MAX_THUMBNAILS - 1) { Font f = label.getFont(); label.setFont(f.deriveFont(f.getStyle(), f.getSize() - 2)); } label.setVisible(false); label.addPropertyChangeListener(this); imageLabels.add(label); } fileNameLabel = new JLabel(getFile().getName()); namePane.add(imageLabel); Iterator<ThumbnailLabel> j = imageLabels.iterator(); while (j.hasNext()) { namePane.add(j.next()); } namePane.add(Box.createHorizontalStrut(4)); namePane.add(fileNameLabel); namePane.add(Box.createHorizontalStrut(10)); resultLabel = new JLabel(); statusLabel = new StatusLabel(importable.getFile()); statusLabel.addPropertyChangeListener(this); image = null; refButton = cancelButton; refLabel = busyLabel; }
From source file:net.sf.taverna.t2.workbench.ui.impl.UserRegistrationForm.java
private void initComponents() { JPanel mainPanel = new JPanel(new GridBagLayout()); // Base font for all components on the form Font baseFont = new JLabel("base font").getFont().deriveFont(11f); // Title panel JPanel titlePanel = new JPanel(new FlowLayout(LEFT)); titlePanel.setBackground(WHITE);/*from w w w .j a v a 2 s . c o m*/ // titlePanel.setBorder(new EmptyBorder(10, 10, 10, 10)); JLabel titleLabel = new JLabel(WELCOME); titleLabel.setFont(baseFont.deriveFont(BOLD, 13.5f)); // titleLabel.setBorder(new EmptyBorder(10, 10, 0, 10)); JLabel titleIcon = new JLabel(tavernaCogs32x32Icon); // titleIcon.setBorder(new EmptyBorder(10, 10, 10, 10)); DialogTextArea titleMessage = new DialogTextArea(PLEASE_FILL_IN_THIS_REGISTRATION_FORM); titleMessage.setMargin(new Insets(0, 20, 0, 10)); titleMessage.setFont(baseFont); titleMessage.setEditable(false); titleMessage.setFocusable(false); // titlePanel.setBorder( new EmptyBorder(10, 10, 0, 10)); JPanel messagePanel = new JPanel(new BorderLayout()); messagePanel.add(titleLabel, NORTH); messagePanel.add(titleMessage, CENTER); messagePanel.setBackground(WHITE); titlePanel.add(titleIcon); titlePanel.add(messagePanel); addDivider(titlePanel, BOTTOM, true); GridBagConstraints gbc = new GridBagConstraints(); gbc.weightx = 1.0; gbc.weighty = 0.0; gbc.gridx = 0; gbc.gridy = 0; gbc.fill = HORIZONTAL; gbc.anchor = WEST; gbc.gridwidth = 2; // gbc.insets = new Insets(5, 10, 0, 0); mainPanel.add(titlePanel, gbc); // Registration messages gbc.weightx = 0.0; gbc.weighty = 0.0; gbc.gridx = 0; gbc.gridy = 1; gbc.fill = NONE; gbc.anchor = WEST; gbc.gridwidth = 2; // gbc.insets = new Insets(5, 0, 0, 10); DialogTextArea registrationMessage1 = new DialogTextArea(WHY_REGISTER); registrationMessage1.setMargin(new Insets(0, 10, 0, 0)); registrationMessage1.setFont(baseFont); registrationMessage1.setEditable(false); registrationMessage1.setFocusable(false); registrationMessage1.setBackground(getBackground()); DialogTextArea registrationMessage2 = new DialogTextArea(WE_DO); registrationMessage2.setMargin(new Insets(0, 10, 0, 10)); registrationMessage2.setFont(baseFont); registrationMessage2.setEditable(false); registrationMessage2.setFocusable(false); registrationMessage2.setBackground(getBackground()); JPanel registrationMessagePanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); registrationMessagePanel.add(registrationMessage1); registrationMessagePanel.add(registrationMessage2); addDivider(registrationMessagePanel, BOTTOM, true); mainPanel.add(registrationMessagePanel, gbc); // Mandatory label // JLabel mandatoryLabel = new JLabel("* Mandatory fields"); // mandatoryLabel.setFont(baseFont); // gbc.weightx = 0.0; // gbc.weighty = 0.0; // gbc.gridx = 0; // gbc.gridy = 3; // gbc.fill = NONE; // gbc.anchor = GridBagConstraints.EAST; // gbc.gridwidth = 2; // gbc.insets = new Insets(0, 10, 0, 20); // mainPanel.add(mandatoryLabel, gbc); // First name JLabel firstNameLabel = new JLabel(FIRST_NAME); firstNameLabel.setFont(baseFont); gbc.weightx = 0.0; gbc.weighty = 0.0; gbc.gridx = 0; gbc.gridy = 4; gbc.fill = NONE; gbc.anchor = WEST; gbc.gridwidth = 1; gbc.insets = new Insets(0, 10, 0, 10); mainPanel.add(firstNameLabel, gbc); firstNameTextField = new JTextField(); firstNameTextField.setFont(baseFont); if (previousRegistrationData != null) firstNameTextField.setText(previousRegistrationData.getFirstName()); gbc.weightx = 1.0; gbc.weighty = 0.0; gbc.gridx = 1; gbc.gridy = 4; gbc.fill = HORIZONTAL; gbc.anchor = WEST; gbc.gridwidth = 1; gbc.insets = new Insets(5, 10, 0, 10); mainPanel.add(firstNameTextField, gbc); // Last name JLabel lastNameLabel = new JLabel(LAST_NAME); lastNameLabel.setFont(baseFont); gbc.weightx = 0.0; gbc.weighty = 0.0; gbc.gridx = 0; gbc.gridy = 5; gbc.fill = NONE; gbc.anchor = WEST; gbc.gridwidth = 1; gbc.insets = new Insets(0, 10, 0, 10); mainPanel.add(lastNameLabel, gbc); lastNameTextField = new JTextField(); lastNameTextField.setFont(baseFont); if (previousRegistrationData != null) lastNameTextField.setText(previousRegistrationData.getLastName()); gbc.weightx = 1.0; gbc.weighty = 0.0; gbc.gridx = 1; gbc.gridy = 5; gbc.fill = HORIZONTAL; gbc.anchor = WEST; gbc.gridwidth = 1; gbc.insets = new Insets(5, 10, 0, 10); mainPanel.add(lastNameTextField, gbc); // Email address JLabel emailLabel = new JLabel(EMAIL_ADDRESS); emailLabel.setFont(baseFont); gbc.weightx = 0.0; gbc.weighty = 0.0; gbc.gridx = 0; gbc.gridy = 6; gbc.fill = NONE; gbc.anchor = WEST; gbc.gridwidth = 1; gbc.insets = new Insets(5, 10, 0, 10); mainPanel.add(emailLabel, gbc); emailTextField = new JTextField(); emailTextField.setFont(baseFont); if (previousRegistrationData != null) emailTextField.setText(previousRegistrationData.getEmailAddress()); gbc.weightx = 1.0; gbc.weighty = 0.0; gbc.gridx = 1; gbc.gridy = 6; gbc.fill = HORIZONTAL; gbc.anchor = WEST; gbc.gridwidth = 1; gbc.insets = new Insets(5, 10, 0, 10); mainPanel.add(emailTextField, gbc); // Keep me informed keepMeInformedCheckBox = new JCheckBox(KEEP_ME_INFORMED); keepMeInformedCheckBox.setFont(baseFont); if (previousRegistrationData != null) keepMeInformedCheckBox.setSelected(previousRegistrationData.getKeepMeInformed()); keepMeInformedCheckBox.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent evt) { if (evt.getKeyCode() == VK_ENTER) { evt.consume(); keepMeInformedCheckBox.setSelected(!keepMeInformedCheckBox.isSelected()); } } }); gbc.weightx = 0.0; gbc.weighty = 0.0; gbc.gridx = 1; gbc.gridy = 7; gbc.fill = NONE; gbc.anchor = WEST; gbc.gridwidth = 2; gbc.insets = new Insets(5, 10, 0, 10); mainPanel.add(keepMeInformedCheckBox, gbc); // Institution name JLabel institutionLabel = new JLabel(INSTITUTION_COMPANY_NAME); institutionLabel.setFont(baseFont); gbc.weightx = 0.0; gbc.weighty = 0.0; gbc.gridx = 0; gbc.gridy = 8; gbc.fill = NONE; gbc.anchor = WEST; gbc.gridwidth = 1; gbc.insets = new Insets(5, 10, 0, 10); mainPanel.add(institutionLabel, gbc); institutionOrCompanyTextField = new JTextField(); institutionOrCompanyTextField.setFont(baseFont); if (previousRegistrationData != null) institutionOrCompanyTextField.setText(previousRegistrationData.getInstitutionOrCompanyName()); gbc.weightx = 1.0; gbc.weighty = 0.0; gbc.gridx = 1; gbc.gridy = 8; gbc.fill = HORIZONTAL; gbc.anchor = WEST; gbc.gridwidth = 1; gbc.insets = new Insets(5, 10, 0, 10); mainPanel.add(institutionOrCompanyTextField, gbc); // Industry type JLabel industryLabel = new JLabel(" Industry type:"); industryLabel.setFont(baseFont); gbc.weightx = 0.0; gbc.weighty = 0.0; gbc.gridx = 0; gbc.gridy = 9; gbc.fill = NONE; gbc.anchor = WEST; gbc.gridwidth = 1; gbc.insets = new Insets(5, 10, 0, 10); mainPanel.add(industryLabel, gbc); industryTypeTextField = new JComboBox<>(industryTypes); industryTypeTextField.setFont(baseFont); if (previousRegistrationData != null) industryTypeTextField.setSelectedItem(previousRegistrationData.getIndustry()); gbc.weightx = 1.0; gbc.weighty = 0.0; gbc.gridx = 1; gbc.gridy = 9; gbc.fill = HORIZONTAL; gbc.anchor = WEST; gbc.gridwidth = 1; gbc.insets = new Insets(5, 10, 0, 10); mainPanel.add(industryTypeTextField, gbc); // Field of investigation JTextArea fieldLabel = new JTextArea(FIELD_OF_INVESTIGATION); fieldLabel.setFont(baseFont); fieldLabel.setEditable(false); fieldLabel.setFocusable(false); fieldLabel.setBackground(getBackground()); gbc.weightx = 0.0; gbc.weighty = 0.0; gbc.gridx = 0; gbc.gridy = 10; gbc.fill = NONE; gbc.anchor = LINE_START; gbc.gridwidth = 1; gbc.insets = new Insets(5, 10, 0, 10); mainPanel.add(fieldLabel, gbc); fieldTextField = new JTextField(); fieldTextField.setFont(baseFont); if (previousRegistrationData != null) fieldTextField.setText(previousRegistrationData.getField()); gbc.weightx = 1.0; gbc.weighty = 0.0; gbc.gridx = 1; gbc.gridy = 10; gbc.fill = HORIZONTAL; gbc.anchor = FIRST_LINE_START; gbc.gridwidth = 1; gbc.insets = new Insets(5, 10, 0, 10); mainPanel.add(fieldTextField, gbc); // Purpose of using Taverna JTextArea purposeLabel = new JTextArea(WHY_YOU_INTEND_TO_USE_TAVERNA); purposeLabel.setFont(baseFont); purposeLabel.setEditable(false); purposeLabel.setFocusable(false); purposeLabel.setBackground(getBackground()); gbc.weightx = 0.0; gbc.weighty = 0.0; gbc.gridx = 0; gbc.gridy = 11; gbc.fill = NONE; gbc.anchor = LINE_START; gbc.gridwidth = 1; gbc.insets = new Insets(5, 10, 0, 10); mainPanel.add(purposeLabel, gbc); purposeTextArea = new JTextArea(4, 30); purposeTextArea.setFont(baseFont); purposeTextArea.setLineWrap(true); purposeTextArea.setAutoscrolls(true); if (previousRegistrationData != null) purposeTextArea.setText(previousRegistrationData.getPurposeOfUsingTaverna()); purposeTextArea.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent evt) { if (evt.getKeyCode() == VK_TAB) { if (evt.getModifiers() > 0) purposeTextArea.transferFocusBackward(); else purposeTextArea.transferFocus(); evt.consume(); } } }); JScrollPane purposeScrollPane = new JScrollPane(purposeTextArea); gbc.weightx = 1.0; gbc.weighty = 0.0; gbc.gridx = 1; gbc.gridy = 11; gbc.fill = HORIZONTAL; gbc.anchor = FIRST_LINE_START; gbc.gridwidth = 1; gbc.insets = new Insets(5, 10, 0, 10); mainPanel.add(purposeScrollPane, gbc); // Terms and conditions termsAndConditionsCheckBox = new JCheckBox(I_AGREE_TO_THE_TERMS_AND_CONDITIONS); termsAndConditionsCheckBox.setFont(baseFont); termsAndConditionsCheckBox.setBorder(null); termsAndConditionsCheckBox.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent evt) { if (evt.getKeyCode() == VK_ENTER) { evt.consume(); termsAndConditionsCheckBox.setSelected(!termsAndConditionsCheckBox.isSelected()); } } }); // gbc.weightx = 0.0; // gbc.weighty = 0.0; // gbc.gridx = 0; // gbc.gridy = 12; // gbc.fill = NONE; // gbc.anchor = WEST; // gbc.gridwidth = 2; // gbc.insets = new Insets(10, 10, 0, 0); // mainPanel.add(termsAndConditionsCheckBox, gbc); // Terms and conditions link JEditorPane termsAndConditionsURL = new JEditorPane(); termsAndConditionsURL.setEditable(false); termsAndConditionsURL.setBackground(getBackground()); termsAndConditionsURL.setFocusable(false); HTMLEditorKit kit = new HTMLEditorKit(); termsAndConditionsURL.setEditorKit(kit); StyleSheet styleSheet = kit.getStyleSheet(); // styleSheet.addRule("body {font-family:"+baseFont.getFamily()+"; font-size:"+baseFont.getSize()+";}"); // // base font looks bigger when rendered as HTML styleSheet.addRule("body {font-family:" + baseFont.getFamily() + "; font-size:9px;}"); Document doc = kit.createDefaultDocument(); termsAndConditionsURL.setDocument(doc); termsAndConditionsURL.setText("<html><body><a href=\"" + TERMS_AND_CONDITIONS_URL + "\">" + TERMS_AND_CONDITIONS_URL + "</a></body></html>"); termsAndConditionsURL.addHyperlinkListener(new HyperlinkListener() { @Override public void hyperlinkUpdate(HyperlinkEvent he) { if (he.getEventType() == ACTIVATED) followHyperlinkToTandCs(); } }); gbc.weightx = 0.0; gbc.weighty = 0.0; gbc.gridx = 0; gbc.gridy = 13; gbc.fill = NONE; gbc.anchor = WEST; gbc.gridwidth = 2; gbc.insets = new Insets(5, 10, 0, 10); JPanel termsAndConditionsPanel = new JPanel(new FlowLayout(LEFT)); termsAndConditionsPanel.add(termsAndConditionsCheckBox); termsAndConditionsPanel.add(termsAndConditionsURL); mainPanel.add(termsAndConditionsPanel, gbc); // Button panel JPanel buttonPanel = new JPanel(new FlowLayout(FlowLayout.CENTER)); JButton registerButton = new JButton("Register"); registerButton.setFont(baseFont); registerButton.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent evt) { if (evt.getKeyCode() == VK_ENTER) { evt.consume(); register(); } } }); registerButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { register(); } }); JButton doNotRegisterButton = new JButton("Do not ask me again"); doNotRegisterButton.setFont(baseFont); doNotRegisterButton.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent evt) { if (evt.getKeyCode() == VK_ENTER) { evt.consume(); doNotRegister(); } } }); doNotRegisterButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { doNotRegister(); } }); JButton remindMeLaterButton = new JButton("Remind me later"); // in 2 weeks remindMeLaterButton.setFont(baseFont); remindMeLaterButton.addKeyListener(new KeyAdapter() { @Override public void keyPressed(KeyEvent evt) { if (evt.getKeyCode() == VK_ENTER) { evt.consume(); remindMeLater(); } } }); remindMeLaterButton.addActionListener(new ActionListener() { @Override public void actionPerformed(ActionEvent e) { remindMeLater(); } }); buttonPanel.add(registerButton); buttonPanel.add(remindMeLaterButton); buttonPanel.add(doNotRegisterButton); addDivider(buttonPanel, TOP, true); gbc.gridx = 0; gbc.gridy = 14; gbc.fill = HORIZONTAL; gbc.anchor = GridBagConstraints.CENTER; gbc.insets = new Insets(5, 10, 0, 10); gbc.gridwidth = 2; mainPanel.add(buttonPanel, gbc); getContentPane().setLayout(new BorderLayout()); getContentPane().add(mainPanel, CENTER); pack(); setResizable(false); // Center the dialog on the screen (we do not have the parent) Dimension dimension = getToolkit().getScreenSize(); Rectangle abounds = getBounds(); setLocation((dimension.width - abounds.width) / 2, (dimension.height - abounds.height) / 2); setSize(getPreferredSize()); }
From source file:org.openmicroscopy.shoola.agents.fsimporter.chooser.ImportDialog.java
/** * Builds and lays out the component displaying the options for the * metadata.// w w w. j a va 2s.c om * * @return See above. */ private JXTaskPane buildMetadataComponent() { JXTaskPane pane = new JXTaskPane(); Font font = pane.getFont(); pane.setFont(font.deriveFont(font.getStyle(), font.getSize() - 2)); pane.setCollapsed(true); pane.setTitle(TEXT_METADATA_DEFAULTS); pane.add(buildPixelSizeComponent()); return pane; }
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; parentLabel = new JLabel(); f = parentLabel.getFont();/*from w ww . j a v a2 s .c om*/ 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.AnnotationDataUI.java
/** * Creates a menu item.//from w w w. j a v a 2 s . c om * * @param index The index associated to the item. * @return See above. */ private JCheckBoxMenuItem createMenuItem(int index) { JCheckBoxMenuItem item = new JCheckBoxMenuItem(NAMES[index]); Font f = item.getFont(); item.setFont(f.deriveFont(f.getStyle(), f.getSize() - 2)); item.setSelected(filter == index); item.addActionListener(this); item.setActionCommand("" + index); return item; }