List of usage examples for javax.swing JLabel setToolTipText
@BeanProperty(bound = false, preferred = true, description = "The text to display in a tool tip.") public void setToolTipText(String text)
From source file:Main.java
public static void main(String[] args) { JLabel label = new JLabel( "\u0414\u043E\u0431\u0440" + "\u043E\u0020\u043F\u043E\u0436\u0430\u043B\u043E\u0432" + "\u0430\u0422\u044A\u0020\u0432\u0020Unicode\u0021"); label.setToolTipText("This is Russian"); JOptionPane.showMessageDialog(null, label); }
From source file:Main.java
/** * Create a HTML hyperlink in JLabel component * * @param label/*from w w w . j a v a2 s .c o m*/ * @param url * @param text */ public static void createHyperLink(JLabel label, final String url, String text) { label.setToolTipText(url); label.setText("<html><a href=\"\">" + text + "</a></html>"); label.setCursor(new Cursor(Cursor.HAND_CURSOR)); label.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { try { Desktop.getDesktop().browse(new URI(url)); } catch (IOException ex) { throw new RuntimeException(ex); } catch (URISyntaxException ex) { throw new RuntimeException(ex); } } }); }
From source file:de.fhg.iais.asc.ui.i18n.LocalizedUI.java
public static JLabel createLabel(String key) { key = "Label." + key; String tooltipText = Messages.getString("Tooltip." + key, ""); JLabel label = new JLabel(Messages.getString(key)); if (!StringUtils.isEmpty(tooltipText)) { label.setToolTipText(tooltipText); }// w w w . jav a2s . c o m return label; }
From source file:net.sf.jabref.gui.GUIGlobals.java
/** * Perform initializations that are only used in graphical mode. This is to prevent * the "Xlib: connection to ":0.0" refused by server" error when access to the X server * on Un*x is unavailable.//from w w w . j a v a 2 s. com */ public static void init() { JLabel label; label = new JLabel(IconTheme.JabRefIcon.PDF_FILE.getSmallIcon()); label.setToolTipText(Localization.lang("Open") + " PDF"); GUIGlobals.TABLE_ICONS.put("pdf", label); label = new JLabel(IconTheme.JabRefIcon.WWW.getSmallIcon()); label.setToolTipText(Localization.lang("Open") + " URL"); GUIGlobals.TABLE_ICONS.put(FieldName.URL, label); label = new JLabel(IconTheme.JabRefIcon.WWW.getSmallIcon()); label.setToolTipText(Localization.lang("Open") + " CiteSeer URL"); GUIGlobals.TABLE_ICONS.put("citeseerurl", label); label = new JLabel(IconTheme.JabRefIcon.WWW.getSmallIcon()); label.setToolTipText(Localization.lang("Open") + " ArXiv URL"); GUIGlobals.TABLE_ICONS.put("eprint", label); label = new JLabel(IconTheme.JabRefIcon.DOI.getSmallIcon()); label.setToolTipText(Localization.lang("Open") + " DOI " + Localization.lang("web link")); GUIGlobals.TABLE_ICONS.put(FieldName.DOI, label); label = new JLabel(IconTheme.JabRefIcon.FILE.getSmallIcon()); label.setToolTipText(Localization.lang("Open") + " PS"); GUIGlobals.TABLE_ICONS.put("ps", label); label = new JLabel(IconTheme.JabRefIcon.FOLDER.getSmallIcon()); label.setToolTipText(Localization.lang("Open folder")); GUIGlobals.TABLE_ICONS.put(FieldName.FOLDER, label); label = new JLabel(IconTheme.JabRefIcon.FILE.getSmallIcon()); label.setToolTipText(Localization.lang("Open file")); GUIGlobals.TABLE_ICONS.put(FieldName.FILE, label); for (ExternalFileType fileType : ExternalFileTypes.getInstance().getExternalFileTypeSelection()) { label = new JLabel(fileType.getIcon()); label.setToolTipText(Localization.lang("Open %0 file", fileType.getName())); GUIGlobals.TABLE_ICONS.put(fileType.getName(), label); } label = new JLabel(Relevance.getInstance().getRepresentingIcon()); label.setToolTipText(Relevance.getInstance().getToolTip()); GUIGlobals.TABLE_ICONS.put(SpecialFieldsUtils.FIELDNAME_RELEVANCE, label); label = new JLabel(Quality.getInstance().getRepresentingIcon()); label.setToolTipText(Quality.getInstance().getToolTip()); GUIGlobals.TABLE_ICONS.put(SpecialFieldsUtils.FIELDNAME_QUALITY, label); // Ranking item in the menu uses one star label = new JLabel(Rank.getInstance().getRepresentingIcon()); label.setToolTipText(Rank.getInstance().getToolTip()); GUIGlobals.TABLE_ICONS.put(SpecialFieldsUtils.FIELDNAME_RANKING, label); // Priority icon used for the menu label = new JLabel(Priority.getInstance().getRepresentingIcon()); label.setToolTipText(Priority.getInstance().getToolTip()); GUIGlobals.TABLE_ICONS.put(SpecialFieldsUtils.FIELDNAME_PRIORITY, label); // Read icon used for menu label = new JLabel(ReadStatus.getInstance().getRepresentingIcon()); label.setToolTipText(ReadStatus.getInstance().getToolTip()); GUIGlobals.TABLE_ICONS.put(SpecialFieldsUtils.FIELDNAME_READ, label); // Print icon used for menu label = new JLabel(Printed.getInstance().getRepresentingIcon()); label.setToolTipText(Printed.getInstance().getToolTip()); GUIGlobals.TABLE_ICONS.put(SpecialFieldsUtils.FIELDNAME_PRINTED, label); if (Globals.prefs.getBoolean(JabRefPreferences.EDITOR_EMACS_KEYBINDINGS)) { EmacsKeyBindings.load(); } }
From source file:com.alvermont.terraj.stargen.ui.UIUtils.java
/** * Get a JLabel object to display with star details * /*from ww w. j a v a2 s . c o m*/ * @throws java.io.IOException If there is an error building the list * @return A <code>JLabel</code> representing the star */ public static JLabel getSunLabel() throws IOException { BufferedImage bi = UIUtils.getImage("Sun"); bi = UIUtils.scaleImage(bi, 30, 120); ImageIcon icon = new ImageIcon(bi); JLabel label = new JLabel(icon); label.setPreferredSize(new Dimension(bi.getWidth(), bi.getHeight())); label.setMinimumSize(new Dimension(bi.getWidth(), bi.getHeight())); label.setToolTipText("The Star"); return label; }
From source file:com.alvermont.terraj.stargen.ui.UIUtils.java
/** * Build a list of label objects from a list of planets * * @param planets The list of planets to build labels for * @throws java.io.IOException If there is an error building the labels * @return A list of <code>JLabel</code> objects in the same order as the * input list//w w w.java 2 s .co m */ public static List<JLabel> buildImages(List<Planet> planets) throws IOException { List<JLabel> labels = new ArrayList<JLabel>(); List<BufferedImage> images = getPlanetImages(planets); Planet p = planets.get(0); for (BufferedImage bi : images) { ImageIcon icon = new ImageIcon(bi); JLabel label = new JLabel(icon); label.setPreferredSize(new Dimension(bi.getWidth(), bi.getHeight())); label.setMinimumSize(new Dimension(bi.getWidth(), bi.getHeight())); label.setToolTipText("<html>" + UIUtils.getInfo(p) + "</html>"); labels.add(label); log.debug("Added icon for planet " + p.getNumber() + " size " + bi.getWidth() + "," + bi.getHeight()); p = p.getNextPlanet(); } return labels; }
From source file:MyLookAndFeel.java
public Main() throws Exception { UIManager.setLookAndFeel("MyLookAndFeel"); setLayout(new FlowLayout()); JButton b = new JButton(); b.setText("<html>A<br> B</html>"); b.setToolTipText("<html>C<br>D<br>E</html>"); add(b);// ww w .j ava2s .c o m JLabel l = new JLabel("Z"); l.setToolTipText("zzzzz..."); add(l); }
From source file:Main.java
public Main() throws HeadlessException { setSize(150, 300);/* w w w . jav a 2s . co m*/ setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLayout(new FlowLayout()); JLabel label1 = new JLabel("Username :", JLabel.RIGHT); JLabel label2 = new JLabel("Password :", JLabel.RIGHT); JLabel label3 = new JLabel("Confirm Password :", JLabel.RIGHT); JLabel label4 = new JLabel("Remember Me!", JLabel.LEFT); JLabel label5 = new JLabel("Hello.", JLabel.CENTER); label5.setVerticalAlignment(JLabel.TOP); label5.setToolTipText("A tool tip with me!"); getContentPane().add(label1); getContentPane().add(label2); getContentPane().add(label3); getContentPane().add(label4); getContentPane().add(label5); }
From source file:de.fhg.iais.asc.ui.parts.TopLabeledElementJPanelBuilder.java
public <E extends JComponent> E add(String labelName, E element) { String labelText = Messages.getString(this.prefix + "Label." + labelName); String tooltipText = Messages.getString(this.prefix + "Tooltip." + labelName, null); JLabel label = new JLabel(labelText + " "); label.setToolTipText(tooltipText); this.panel.add(label, this.cLabel); ++this.cLabel.gridx; element.setToolTipText(tooltipText); this.panel.add(element, this.cElement); ++this.cElement.gridx; // this.lastLabel = label; return element; }
From source file:de.fhg.iais.asc.ui.components.panel.LeftLabeledElementJPanel.java
public <E extends JComponent> E add(String labelName, E element) { String labelText = Messages.getString(this.prefix + "Label." + labelName); String tooltipText = Messages.getString(this.prefix + "Tooltip." + labelName, null); JLabel label = new JLabel(labelText + " "); label.setToolTipText(tooltipText); this.add(label, this.cLabel); ++this.cLabel.gridy; element.setToolTipText(tooltipText); this.add(element, this.cElement); ++this.cElement.gridy; this.lastLabel = label; return element; }