Here you can find the source of toolTip(JComponent c, String s)
static public void toolTip(JComponent c, String s)
//package com.java2s; //License from project: Open Source License import javax.swing.*; public class Main { static public void toolTip(JComponent c, String s) { String o = c.getToolTipText(); if (s != null && s.length() == 0) s = null;//from ww w . j a v a 2s. c o m if (o == s) return; if (o == null || s == null || !o.equals(s)) c.setToolTipText(s); } }