Custom ToolTip on JavaFX

Hello I’m here to show you the new ToolTip which you can customize as you like! My Tooltip is little bit messy  process but it takes very less memory. You can easily apply my Tooltip to your desired application. Here the code goes:

My CustomNode who uses the tooltip..

Till here there is something little bit different. I used a new tooltip variable which has datatypes of MyToolTip. Ok I’ll show you what the MyToolTip class is:

You can see there is nothing new on MyTooltip it’s all about using simple graphics and text. Now the main class goes here:

Now you can see the main thing is ; I’m using a single MyToolTip which controls all  the nodes tooltip. That’s all . Thanks for watching the post. You can see the demo at below launch button.

3 thoughts on “Custom ToolTip on JavaFX”

  1. Hi , nice blog
    I have a problem adding a toolip on a rectangle with 2.2
    nothing shows up

    Rectangle rect = new Rectangle(0, 0, 100, 100);
    Tooltip t = new Tooltip(“A Square”);
    Tooltip.install(rect, t);
    any idea ?
    cheers

  2. Hello baikelin,
    The code that you have works perfectly. Please make sure that you have added that rectangle in the Container.
    Sample Code:

    ...
    public void start(Stage stage) throws Exception {

    Rectangle rect = new Rectangle(0, 0, 100, 100);
    Tooltip t = new Tooltip("A Square");
    Tooltip.install(rect, t);

    Group g = new Group(rect);

    stage.setScene(new Scene(g));
    stage.show();
    }
    ...

    Thanks

Leave a Reply