A
A
Anton @ Lyalin2017-02-23 08:42:08
Java
Anton @ Lyalin, 2017-02-23 08:42:08

What to use to be able to hover the mouse over a word??

There is a window application, it has a text field, which displays a certain text, what to use so that you can hover over a word and get, for example, a hint ??? It's like in a browser on some sites, when you hover over a word, for example, a translation comes out. And is it even possible to check this?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vorh, 2017-02-23
@Vorh

Swing

JLabel tooltipLabel = new JLabel("Username");
tooltipLabel.setToolTipText("Enter your username");
    
JTextField tooltipTextfield = new JTextField(10);
tooltipTextfield.setToolTipText("Enter your username over here, that other thing is a label.");

In JavaFX using Tooltip
PasswordField pf = new PasswordField();
Tooltip tooltip = new Tooltip();
tooltip.setText(
   "Your text");
pf.setTooltip(tooltip);

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question