What you are describing is not, strictly speaking, tooltips.
Tooltips are small windows that pop up when you hover over an area of interest, then automatically dismiss themselves after a short interval or after you move the mouse away. They don't have controls, and notably don't have close buttons, since they don't need them and they're intended to obscure as little of the display as possible.
There are custom tags that implement tooltips in many of the
JSF extension libraries such as RichFaces. However, the essential functionality comes from Javascript code that they bind to their target elements.
This function is as follows:
1. ensure that the target element is bound to tooltip Javascript functions called, for example, when you mouse over the control.
2. The actual tooltip is just a small floating HTML DIV element which is normally hidden. When the "display tooltip" function is invoked, that function makes it visible. The DIV is then made invisible again when the mouse has moved away (mouseout function) or a suitable interval has expired.