How do I create a multi lines tool tips?

package org.kodejava.example.swing;

import javax.swing.*;
import java.awt.*;

public class MultilinesToolTip {
    public static void main(String[] args) {
        JFrame frame = new JFrame("Tool Tip Demo");
        frame.setSize(200, 200);

        JLabel label = new JLabel("Hover on me!");

        // Setting tool tip for our Swing JLabel component using an html
        // formatted string so that we can create a multi lines tool tip.
            "<html>Lorem Ipsum is simply dummy text of the printing and<br/>" +
            "typesetting industry. Lorem Ipsum has been the industry's <br/>" +
            "standard dummy text ever since the 1500s, when an unknown<br/>" +
            "printer took a galley of type and scrambled it to make a<br/>" +
            "type specimen book.</html>");

        frame.getContentPane().setLayout(new FlowLayout(FlowLayout.CENTER));



Programmer, runner, recreational diver, live in the island of Bali, Indonesia. Mostly programming in Java, Spring Framework, Hibernate / JPA.

Leave a Reply