jcomponent

A custom Java mouse cursor that displays the mouse XY coordinates

Java mouse FAQ: How do I create a custom Java mouse cursor (mouse pointer)?

For my Java/Swing XY mouse position/coordinates application I finally dug into Swing and figured out how to create a Java mouse cursor that shows the X/Y position (coordinates) of the mouse cursor at any moment in time. I can't figure the right way to word that, so it may not make sense, but hopefully this picture of what I've done will help demonstrate my custom Java mouse cursor:

Java - custom mouse cursor - show X/Y coordinates/position/location

A Java tooltip tutorial

Java Swing FAQ: How do I create a Java tooltip (also known as balloon or bubble help text)?

A JButton tooltip example

Java/Swing FAQ: How do I set the help text (i.e., help text, balloon text, tooltip text) on a JButton?

Just call the setToolTipText method on the JButton. Here's a quick JButton tooltip display example:

// create a button with tooltip help text
JButton button = new JButton("Click Me");
button.setToolTipText("Click this button to make something happen.");

JTextField tooltip display - how to set a balloon tooltip on a JTextField

Java/Swing FAQ: How do I set the help text (i.e., help text, balloon text, tooltip text) on a JTextField?

Solution: Just call the setToolTipText method on the JTextField. Here's a quick JTextField tooltip display example:

// create a textfield with tooltip help text
JTextField textfield = new JTextField(10);
textfield.setToolTipText("Enter your username over here, that other thing is a label.");

A JLabel tooltip example

Java JLabel FAQ: How do I set the help text (i.e., help text, balloon text, tooltip text) on a JLabel?

Just call the setToolTipText method on the JLabel. Here's a quick JLabel tooltip display example:

// create a label with tooltip help text
JLabel label = new JLabel("Username");
label.setToolTipText("Enter your username");