public void addContentAndShow ( List < Label > content , int left , int top , boolean showCloseButton ) { // Add a closeButton when showCloseButton is true. if ( showCloseButton ) { Label closeButtonLabel = new Label ( " X " ) ; closeButtonLabel . addStyleName ( ToolTipResource . INSTANCE . css ( ) . toolTipCloseButton ( ) ) ; contentPanel . add ( closeButtonLabel ) ; closeButtonLabel . addClickHandler ( new ClickHandler ( ) { @ Override public void onClick ( ClickEvent event ) { hide ( ) ; } } ) ; } // Add the content to the panel. for ( Label l : content ) { l . addStyleName ( ToolTipResource . INSTANCE . css ( ) . toolTipLine ( ) ) ; contentPanel . add ( l ) ; } // Finally set position of the tooltip and show it. toolTip . setPopupPosition ( left , top ) ; toolTip . show ( ) ; }
Add content to the tooltip and show it with the given parameters .