1

GWT does provide tooltip with something like:

Label label = new Label("test");
label.setTitle("This is a tooltip");

Is there a way to style such tooltips? Is there a library for GWT that supports this?

Edit: How do I set the time for the tooltip to appear?

Michael
  • 32,527
  • 49
  • 210
  • 370

4 Answers4

3

You can use GWTQuery for doing tooltip, there are a Plugin for that. GwtQuery is a clone of JQuery but build in java.

You can find the demo here :

http://arcbees.github.io/ArcBees-GQuery-Plugins/

With this sample code, you can create toolkit for all title in the page :

$("[title]", toolbar).as(Tooltip).tooltip();

And the source code is here : https://github.com/ArcBees/ArcBees-GQuery-Plugins/tree/master/tooltip

1

The real answer to your question is : No, native tooltip style can't be modified.

Alternatives are creating your own tooltips:

  • CSS
  • JS (Libraries)

Note that if you keep using the title attribute the native tooltip will be shown over your custom tooltip.

Community
  • 1
  • 1
Michael Laffargue
  • 10,116
  • 6
  • 42
  • 76
0

You can use CSS First, you add the style you want in your css Then you set that style to the element you want with label.setStyleName("myStyle");

Hassen Ch.
  • 1,693
  • 18
  • 31
0

Tooltips can be styled with CSS. You can use one of the online tools:

http://csstooltip.com/

http://www.menucool.com/tooltip/css-tooltip

Andrei Volgin
  • 40,755
  • 6
  • 49
  • 58
  • How do I set the time for the tooltip to appear? – Michael Jan 31 '14 at 04:15
  • You can't do it in CSS. You can set "title" on a Label when you want (e.g. on MouseOver, etc.) – Andrei Volgin Jan 31 '14 at 04:21
  • I could use a PopupPresenter to show the tooltip. Do you know ho I can bind a MouseOver event on all elements that have a title attribute set? Do I have to delete the title attribute that the default browser tooltip does not show up the same time? – Michael Jan 31 '14 at 04:30
  • Don't set 'title" and there will be no default popup. You create handlers for MouseOver events the same way as for any other events in GWT. – Andrei Volgin Jan 31 '14 at 04:34