Volodymyr Levytskyi Volodymyr Levytskyi - 4 months ago 50
Java Question

How to create good-looking tooltip with small arrow on the corner in javafx?

I want to create cool Tooltip that can be displayed programmatically and on desired location.

I have seen Tooltips in javaFx but I need to popup nice tooltip that has arrow that points to TextField.

I need tooltip like the one on stackoverflow :

enter image description here

Maybe someone have done that before or know how to do it?

Thank you!

Answer

i think this would help you.

.tooltip {
-fx-skin: "com.sun.javafx.scene.control.skin.TooltipSkin";
-fx-background-color:
    linear-gradient(#cec340, #a59c31),
    linear-gradient(#fefefc, #e6dd71),
    linear-gradient(#fef592, #e5d848);
-fx-background-insets: 0,1,2;
-fx-background-radius: 0 0 13 0;
-fx-padding: 0.333333em 0.666667em 0.333333em 0.666667em; /* 4 8 4 8 */
-fx-effect: dropshadow( three-pass-box , rgba(0,0,0,0.6) , 8, 0.0 , 0 , 0 );
}
.page-corner {
-fx-padding: 4.5 4.5 4.5 4.5;
-fx-background-color: linear-gradient( from 0% 0% to 50% 50%, #fcf7b6, #a59c31);
-fx-shape: "M0,0H9L0,9Z";
-fx-effect: dropshadow( three-pass-box , rgba(0,0,0,0.6) , 4 , 0.0 , 0 , 0 );
}