import javax.swing.JButton; public class Main { public static void main(String[] argv) throws Exception { JButton component = new JButton(); component.setToolTipText("<html><center>" + "This is a" + "<br>" + "tool tip" + "</center></html>"); } }