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:AlignLabels.java
JLabel createLabel(String text) { String separator = System.getProperty("line.separator"); JLabel label = new JLabel(text + separator + "multiline" + separator + "label"); label.setToolTipText(text + "\n\ndoubled space\n\ntooltip"); label.setBorder(BorderFactory.createEtchedBorder()); this.add(label); label.setPreferredSize(new Dimension(125, 125)); return label; }
From source file:Main.java
public UnicodeJFrame() { super("Demonstrating Unicode"); setLayout(new GridLayout(8, 1)); JLabel englishJLabel = new JLabel( "\u0057\u0065\u006C\u0063" + "\u006F\u006D\u0065\u0020\u0074\u006F\u0020Unicode\u0021"); englishJLabel.setToolTipText("This is English"); add(englishJLabel);// w w w. j a v a 2s. co m JLabel chineseJLabel = new JLabel("\u6B22\u8FCE\u4F7F\u7528" + "\u0020\u0020Unicode\u0021"); chineseJLabel.setToolTipText("This is Traditional Chinese"); add(chineseJLabel); JLabel cyrillicJLabel = new JLabel( "\u0414\u043E\u0431\u0440" + "\u043E\u0020\u043F\u043E\u0436\u0430\u043B\u043E\u0432" + "\u0430\u0422\u044A\u0020\u0432\u0020Unicode\u0021"); cyrillicJLabel.setToolTipText("This is Russian"); add(cyrillicJLabel); JLabel frenchJLabel = new JLabel( "\u0042\u0069\u0065\u006E\u0076" + "\u0065\u006E\u0075\u0065\u0020\u0061\u0075\u0020Unicode\u0021"); frenchJLabel.setToolTipText("This is French"); add(frenchJLabel); JLabel germanJLabel = new JLabel( "\u0057\u0069\u006C\u006B\u006F" + "\u006D\u006D\u0065\u006E\u0020\u007A\u0075\u0020Unicode\u0021"); germanJLabel.setToolTipText("This is German"); add(germanJLabel); JLabel japaneseJLabel = new JLabel("Unicode\u3078\u3087\u3045" + "\u3053\u305D\u0021"); japaneseJLabel.setToolTipText("This is Japanese"); add(japaneseJLabel); JLabel portugueseJLabel = new JLabel("\u0053\u00E9\u006A\u0061" + "\u0020\u0042\u0065\u006D\u0076\u0069\u006E\u0064\u006F\u0020" + "Unicode\u0021"); portugueseJLabel.setToolTipText("This is Portuguese"); add(portugueseJLabel); JLabel spanishJLabel = new JLabel("\u0042\u0069\u0065\u006E" + "\u0076\u0065\u006E\u0069\u0064\u0061\u0020\u0061\u0020" + "Unicode\u0021"); spanishJLabel.setToolTipText("This is Spanish"); add(spanishJLabel); }
From source file:cool.pandora.modeller.ui.BagTableFormBuilder.java
/** * addBinding./*w w w . j a va2 s. c o m*/ * * @param isRequired boolean * @param labelName String * @param component JComponent * @param removeButton JComponent * @return JComponent */ private JComponent[] addBinding(final boolean isRequired, final String labelName, final JComponent component, final JComponent removeButton) { removeButton.setFocusable(false); final JLabel label = new JLabel(labelName); // createLabelFor(fieldName, // component); label.setToolTipText("Double-Click to Edit"); final TableLayoutBuilder layoutBuilder = getLayoutBuilder(); if (!layoutBuilder.hasGapToLeft()) { layoutBuilder.gapCol(); } layoutBuilder.cell(label, "colSpec=left:pref:noGrow"); final JComponent reqComp; /* */ if (isRequired) { final JButton b = new JButton("R"); b.setForeground(Color.red); b.setOpaque(false); b.setBorderPainted(false); reqComp = b; } else { final JButton b = new JButton(""); b.setOpaque(false); b.setBorderPainted(false); reqComp = b; } /* */ reqComp.setFocusable(false); layoutBuilder.cell(reqComp, "colSpec=left:pref:noGrow"); layoutBuilder.cell(component, "colSpec=fill:pref:grow"); layoutBuilder.labelGapCol(); layoutBuilder.cell(removeButton, "colSpec=left:pref:noGrow"); layoutBuilder.labelGapCol(); return new JComponent[] { label, reqComp, component, removeButton }; }
From source file:gov.loc.repository.bagger.ui.NewBagFrame.java
private void layoutProfileSelection(JPanel contentPane, int row) { // content/*from w ww . j a v a 2 s . c o m*/ // profile selection JLabel bagProfileLabel = new JLabel(bagView.getPropertyMessage("Select Profile:")); bagProfileLabel.setToolTipText(bagView.getPropertyMessage("bag.projectlist.help")); profileList = new JComboBox(bagView.getProfileStore().getProfileNames()); profileList.setName(bagView.getPropertyMessage("bag.label.projectlist")); profileList.setSelectedItem(bagView.getPropertyMessage("bag.project.noproject")); profileList.setToolTipText(bagView.getPropertyMessage("bag.projectlist.help")); GridBagConstraints glbc = new GridBagConstraints(); JLabel spacerLabel = new JLabel(); glbc = LayoutUtil.buildGridBagConstraints(0, row, 1, 1, 5, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST); contentPane.add(bagProfileLabel, glbc); glbc = LayoutUtil.buildGridBagConstraints(1, row, 1, 1, 40, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER); contentPane.add(profileList, glbc); glbc = LayoutUtil.buildGridBagConstraints(2, row, 1, 1, 40, 50, GridBagConstraints.NONE, GridBagConstraints.EAST); contentPane.add(spacerLabel, glbc); }
From source file:es.emergya.ui.base.Message.java
private void inicializar(final String texto) { log.trace("inicializar(" + texto + ")"); final Message message_ = this; SwingUtilities.invokeLater(new Runnable() { @Override/* w w w .java2 s . com*/ public void run() { log.trace("Sacamos un nuevo mensaje: " + texto); JDialog frame = new JDialog(window.getFrame(), true); frame.setUndecorated(true); frame.getContentPane().setBackground(Color.WHITE); frame.setLocation(150, window.getHeight() - 140); frame.setSize(new Dimension(window.getWidth() - 160, 130)); frame.setName("Incoming Message"); frame.setBackground(Color.WHITE); frame.getRootPane().setBorder(new MatteBorder(4, 4, 4, 4, color)); frame.setLayout(new BorderLayout()); if (font != null) frame.setFont(font); JLabel icon = new JLabel(new ImageIcon(this.getClass().getResource("/images/button-ok.png"))); icon.setToolTipText("Cerrar"); icon.removeMouseListener(null); icon.addMouseListener(new Cerrar(frame, message_)); JLabel text = new JLabel(texto); text.setBackground(Color.WHITE); text.setForeground(Color.BLACK); frame.add(text, BorderLayout.WEST); frame.add(icon, BorderLayout.EAST); frame.setVisible(true); } }); }
From source file:gov.loc.repository.bagger.ui.NewBagFrame.java
private void layoutBagVersionSelection(JPanel contentPane, int row) { //contents/*from ww w . j a v a 2 s . co m*/ // Bag version dropdown list JLabel bagVersionLabel = new JLabel(bagView.getPropertyMessage("bag.label.version")); bagVersionLabel.setToolTipText(bagView.getPropertyMessage("bag.versionlist.help")); ArrayList<String> versionModel = new ArrayList<String>(); Version[] vals = Version.values(); for (int i = 0; i < vals.length; i++) { versionModel.add(vals[i].versionString); } bagVersionList = new JComboBox(versionModel.toArray()); bagVersionList.setName(bagView.getPropertyMessage("bag.label.versionlist")); bagVersionList.setSelectedItem(Version.V0_96.versionString); bagVersionList.setToolTipText(bagView.getPropertyMessage("bag.versionlist.help")); GridBagConstraints glbc = null; JLabel spacerLabel = new JLabel(); glbc = LayoutUtil.buildGridBagConstraints(0, row, 1, 1, 5, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST); contentPane.add(bagVersionLabel, glbc); glbc = LayoutUtil.buildGridBagConstraints(1, row, 1, 1, 40, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER); contentPane.add(bagVersionList, glbc); glbc = LayoutUtil.buildGridBagConstraints(2, row, 1, 1, 40, 50, GridBagConstraints.NONE, GridBagConstraints.EAST); contentPane.add(spacerLabel, glbc); }
From source file:dpcs.About.java
public About() { setIconImage(Toolkit.getDefaultToolkit().getImage(About.class.getResource("/graphics/Icon.png"))); setResizable(false);/*from w w w .j a v a 2 s . com*/ setType(Type.UTILITY); setTitle("About"); setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE); setBounds(100, 100, 540, 400); contentPane = new JPanel(); contentPane.setBackground(Color.WHITE); contentPane.setBorder(new EmptyBorder(5, 5, 5, 5)); setContentPane(contentPane); contentPane.setLayout(null); try { InputStreamReader reader2 = new InputStreamReader( getClass().getResourceAsStream("/others/app-version.txt")); String tmp = IOUtils.toString(reader2); AppVersion = Double.parseDouble(tmp); } catch (IOException e1) { e1.printStackTrace(); } JButton btnGitHub = new JButton("GitHub"); btnGitHub.setToolTipText("Access Droid PC Suite github repository"); btnGitHub.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent arg0) { try { Desktop.getDesktop().browse(new URL("https://github.com/kvsjxd/Droid-PC-Suite/").toURI()); } catch (Exception e) { e.printStackTrace(); } } }); btnGitHub.setBounds(369, 295, 111, 25); contentPane.add(btnGitHub); JLabel lblMyFriend4 = new JLabel("Gulati-kun"); lblMyFriend4.setFont(new Font("Dialog", Font.PLAIN, 15)); lblMyFriend4.setBounds(25, 266, 242, 24); contentPane.add(lblMyFriend4); JLabel lblMyFriend3 = new JLabel("Anil-kun"); lblMyFriend3.setFont(new Font("Dialog", Font.PLAIN, 15)); lblMyFriend3.setBounds(25, 242, 242, 24); contentPane.add(lblMyFriend3); JLabel lblMyFriend2 = new JLabel("Suri-kun"); lblMyFriend2.setFont(new Font("Dialog", Font.PLAIN, 15)); lblMyFriend2.setBounds(25, 217, 242, 24); contentPane.add(lblMyFriend2); JLabel lblApplicationVersion = new JLabel("Version: " + AppVersion); lblApplicationVersion.setFont(new Font("Dialog", Font.BOLD, 14)); lblApplicationVersion.setBounds(382, 16, 132, 18); contentPane.add(lblApplicationVersion); JLabel lblForMyOther = new JLabel("For my other Android stuff visit me on XDA - Developers (@kvsjxd)"); lblForMyOther.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent arg0) { try { Desktop.getDesktop().browse(new URL( "http://forum.xda-developers.com/member.php?s=82fb1dacfee601c8f79084b30d57d5a2&u=5640594") .toURI()); } catch (Exception e) { e.printStackTrace(); } } @Override public void mouseEntered(MouseEvent e) { lblForMyOther.setForeground(Color.BLUE); } @Override public void mouseExited(MouseEvent e) { lblForMyOther.setForeground(Color.BLACK); } }); lblForMyOther.setFont(new Font("Dialog", Font.PLAIN, 15)); lblForMyOther.setBounds(25, 321, 502, 24); contentPane.add(lblForMyOther); JLabel lblMySensei2 = new JLabel("Karun Sensei"); lblMySensei2.setFont(new Font("Dialog", Font.PLAIN, 15)); lblMySensei2.setBounds(25, 120, 242, 24); contentPane.add(lblMySensei2); JLabel lblMySensei1 = new JLabel("Prashotam Sensei"); lblMySensei1.setFont(new Font("Dialog", Font.PLAIN, 15)); lblMySensei1.setBounds(25, 98, 242, 24); contentPane.add(lblMySensei1); JLabel lblDaretobe = new JLabel("D4r3T0B3"); lblDaretobe.setFont(new Font("Dialog", Font.PLAIN, 15)); lblDaretobe.setBounds(25, 194, 242, 24); contentPane.add(lblDaretobe); JLabel label_9 = new JLabel(""); label_9.setToolTipText("This variation of android robot is created using Androidify"); label_9.setIcon(new ImageIcon(About.class.getResource("/graphics/Droidrobot.png"))); label_9.setBounds(334, 50, 180, 270); contentPane.add(label_9); JLabel lblDeveloper = new JLabel("Developer"); lblDeveloper.setFont(new Font("Dialog", Font.BOLD, 16)); lblDeveloper.setBounds(25, 12, 233, 24); contentPane.add(lblDeveloper); JLabel lblMrAleksandarDespotovski_shi = new JLabel("Aleksandar Despotovski-shi"); lblMrAleksandarDespotovski_shi.setFont(new Font("Dialog", Font.PLAIN, 15)); lblMrAleksandarDespotovski_shi.setBounds(25, 169, 242, 24); contentPane.add(lblMrAleksandarDespotovski_shi); JLabel lblMyname = new JLabel("Karanvir Singh"); lblMyname.addMouseListener(new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { try { Desktop.getDesktop().browse(new URL( "http://forum.xda-developers.com/member.php?s=82fb1dacfee601c8f79084b30d57d5a2&u=5640594") .toURI()); } catch (Exception e1) { e1.printStackTrace(); } } @Override public void mouseEntered(MouseEvent e) { lblMyname.setForeground(Color.BLUE); } @Override public void mouseExited(MouseEvent e) { lblMyname.setForeground(Color.RED); } }); lblMyname.setForeground(Color.RED); lblMyname.setFont(new Font("Dialog", Font.BOLD | Font.ITALIC, 16)); lblMyname.setBounds(25, 36, 242, 24); contentPane.add(lblMyname); JLabel lblMyFriend1 = new JLabel("My friend - Chetan-kun"); lblMyFriend1.setFont(new Font("Dialog", Font.PLAIN, 15)); lblMyFriend1.setBounds(25, 145, 242, 24); contentPane.add(lblMyFriend1); JLabel label_6 = new JLabel("Special thanks to"); label_6.setForeground(UIManager.getColor("OptionPane.questionDialog.titlePane.shadow")); label_6.setFont(new Font("Dialog", Font.BOLD, 16)); label_6.setBounds(25, 71, 240, 25); contentPane.add(label_6); JLabel lblGoogle = new JLabel( "Android, android green colored robot are trademarks of Google, Inc. We are not affliated with Google, Inc. in any way."); lblGoogle.setHorizontalAlignment(SwingConstants.LEFT); lblGoogle.setFont(new Font("Dialog", Font.PLAIN, 8)); lblGoogle.setBounds(25, 341, 514, 24); contentPane.add(lblGoogle); }
From source file:cool.pandora.modeller.ui.jpanel.base.NewBagFrame.java
/** * layoutProfileSelection./* www .j av a 2 s . co m*/ * * @param contentPane JPanel * @param row int */ private void layoutProfileSelection(final JPanel contentPane, final int row) { // content // profile selection final JLabel bagProfileLabel = new JLabel(bagView.getPropertyMessage("Select Profile:")); bagProfileLabel.setToolTipText(bagView.getPropertyMessage("bag.projectlist.help")); profileList = new JComboBox<>(bagView.getProfileStore().getProfileNames()); profileList.setName(bagView.getPropertyMessage("bag.label.projectlist")); profileList.setSelectedItem(bagView.getPropertyMessage("bag.project.noproject")); profileList.setToolTipText(bagView.getPropertyMessage("bag.projectlist.help")); GridBagConstraints glbc = new GridBagConstraints(); final JLabel spacerLabel = new JLabel(); glbc = LayoutUtil.buildGridBagConstraints(0, row, 1, 1, 5, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.WEST); contentPane.add(bagProfileLabel, glbc); glbc = LayoutUtil.buildGridBagConstraints(1, row, 1, 1, 40, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER); contentPane.add(profileList, glbc); glbc = LayoutUtil.buildGridBagConstraints(2, row, 1, 1, 40, 50, GridBagConstraints.NONE, GridBagConstraints.EAST); contentPane.add(spacerLabel, glbc); }
From source file:com.github.cric.app.ui.SettingPanel.java
private JLabel label(String defaultValue, String mnemonic) { JLabel label = new JLabel(defaultValue); label.setToolTipText(mnemonic); label.setHorizontalAlignment(JLabel.RIGHT); return label; }
From source file:cool.pandora.modeller.ui.jpanel.iiif.CreateListsFrame.java
private JPanel createComponents() { final Border border = new EmptyBorder(5, 5, 5, 5); final TitlePane titlePane = new TitlePane(); initStandardCommands();/* w w w .ja v a2 s .com*/ final JPanel pageControl = new JPanel(new BorderLayout()); final JPanel titlePaneContainer = new JPanel(new BorderLayout()); titlePane.setTitle(bagView.getPropertyMessage("CreateListsFrame.title")); titlePane.setMessage(new DefaultMessage(bagView.getPropertyMessage("Create List in:"))); titlePaneContainer.add(titlePane.getControl()); titlePaneContainer.add(new JSeparator(), BorderLayout.SOUTH); pageControl.add(titlePaneContainer, BorderLayout.NORTH); final JPanel contentPane = new JPanel(); final DefaultBag bag = bagView.getBag(); if (bag != null) { map = bag.getInfo().getFieldMap(); } final JLabel urlLabel = new JLabel(bagView.getPropertyMessage("baseURL.label")); urlLabel.setToolTipText(bagView.getPropertyMessage("baseURL.description")); final JTextField urlField = new JTextField(""); final URI uri = IIIFObjectURI.getListContainerURI(map); try { urlField.setText(uri != null ? uri.toString() : null); } catch (final Exception e) { log.error("Failed to set url label", e); } final GridBagLayout layout = new GridBagLayout(); final GridBagConstraints glbc = new GridBagConstraints(); final JPanel panel = new JPanel(layout); panel.setBorder(new EmptyBorder(10, 10, 10, 10)); int row = 0; row++; buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST); layout.setConstraints(urlLabel, glbc); panel.add(urlLabel); buildConstraints(glbc, 1, row, 1, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER); layout.setConstraints(urlField, glbc); panel.add(urlField); row++; buildConstraints(glbc, 0, row, 1, 1, 1, 50, GridBagConstraints.NONE, GridBagConstraints.WEST); buildConstraints(glbc, 1, row, 2, 1, 80, 50, GridBagConstraints.HORIZONTAL, GridBagConstraints.CENTER); GuiStandardUtils.attachDialogBorder(contentPane); pageControl.add(panel); final JComponent buttonBar = createButtonBar(); pageControl.add(buttonBar, BorderLayout.SOUTH); this.pack(); return pageControl; }