custom ToolTipText
We will
ToolTipText as we can modify to make it more friendly, all thanks to HTML as this component interprets this language. Images
Code
Master Class
package Classes;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JApplet;
import javax.swing.JButton;
import javax.swing.JOptionPane;
public class Principal extends JApplet {
public void init(){
setLayout(new FlowLayout());
JButton b=new JButton("Java Zone");
b.addActionListener(new ActionListener(){
@ Override
public void actionPerformed (ActionEvent e) {
JOptionPane.showMessageDialog (null, "As you can see, you can customize the ToolTipText with all the benefits of using html .)
}
});
b.setToolTipText ( \u0026lt; html> \u0026lt; h1> Java Zone \u0026lt; / h1> \u0026lt; br> You can code include \u0026lt; b> html \u0026lt; / b> in any ToolTipText \u0026lt; br> \u0026lt; br> \u0026lt; img src = \\ "http://1.bp.blogspot 2BBlog.png .com/_73t-OXs9bAc/TOCuu2YPdyI/AAAAAAAAAEo/DjMJzwm5-Jc/S1600-R/fondo% \\ "> \u0026lt; / html>");
add (b)
}}
As we see, the main class which creates a button to leave the pointer on, bring your ToolTipText, but this is not a simple but a custom, in this use several HTML tags that allow us to change the font for the title, also allows us to use images.
0 comments:
Post a Comment