Here you can find the source of registerComponent(JComponent c)
public static void registerComponent(JComponent c)
//package com.java2s; //License from project: Apache License import javax.swing.*; import java.awt.event.*; public class Main { public static void registerComponent(JComponent c) { //ensure InputMap and ActionMap are created InputMap imap = c.getInputMap(); ActionMap amap = c.getActionMap(); //put dummy KeyStroke into InputMap if is empty: boolean removeKeyStroke = false; KeyStroke[] ks = imap.keys(); if (ks == null || ks.length == 0) { imap.put(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SLASH, 0), "backSlash"); removeKeyStroke = true;/*from w w w . ja v a 2 s .c o m*/ } //now we can register by ToolTipManager ToolTipManager.sharedInstance().registerComponent(c); //and remove dummy KeyStroke if (removeKeyStroke) { imap.remove(KeyStroke.getKeyStroke(KeyEvent.VK_BACK_SLASH, 0)); } //now last part - add appropriate MouseListener and //hear to mouseEntered events // c.addMouseListener(MOUSE_HANDLER); } }