How do I disable/enable application tool tips?

package org.kodejava.swing;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.SwingUtilities;
import javax.swing.ToolTipManager;
import javax.swing.WindowConstants;
import java.awt.FlowLayout;
import java.awt.HeadlessException;

public class DisableToolTip extends JFrame {
    public DisableToolTip() throws HeadlessException {
        initComponent();
    }

    public static void main(String[] args) {
        SwingUtilities.invokeLater(() -> new DisableToolTip().setVisible(true));
    }

    private void initComponent() {
        setSize(500, 500);
        setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
        getContentPane().setLayout(new FlowLayout(FlowLayout.CENTER));

        JButton disable = new JButton("DISABLE");
        disable.setToolTipText("Application tool tip will be disabled.");
        disable.addActionListener(e -> {
            // Disable tool tip for the entire application
            ToolTipManager.sharedInstance().setEnabled(false);
        });

        JButton enable = new JButton("ENABLE");
        enable.setToolTipText("Application tool tip will be enabled.");
        enable.addActionListener(e -> {
            // Enable tool tip for the entire application
            ToolTipManager.sharedInstance().setEnabled(true);
        });

        getContentPane().add(enable);
        getContentPane().add(disable);
    }
}
Disable or Enable Tool Tips

Disable or Enable Tool Tips

How do I set a tool tip for Swing components?

package org.kodejava.swing;

import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.WindowConstants;
import java.awt.FlowLayout;

public class ToolTipExample {
    public static void main(String[] args) {
        JFrame frame = new JFrame("Tool Tip Demo");
        frame.setSize(500, 500);
        frame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

        JLabel label = new JLabel("Hover on me!");
        // Setting tool tip for our Swing JLabel component
        label.setToolTipText("My JLabel Tool Tip");

        frame.getContentPane().setLayout(new FlowLayout(FlowLayout.CENTER));
        frame.getContentPane().add(label);
        frame.setVisible(true);
    }
}
Swing's Tool Tip Demo

Swing’s Tool Tip Demo

How do I create an undecorated JFrame?

This code give you an example of how to create a frame without the title bar, and the frame icons such as maximize, minimize and close.

package org.kodejava.swing;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import java.awt.BorderLayout;
import java.awt.Point;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.awt.event.MouseMotionAdapter;

public class UndecoratedFrame {
    private static Point point = new Point();

    public static void main(String[] args) {
        final JFrame frame = new JFrame();

        // Disables or enables decorations for this frame. By setting undecorated
        // to true will remove the frame's title bar including the maximize,
        // minimize and the close icon.
        frame.setUndecorated(true);

        // As the the frame's title bar removed we need to close out frame for
        // instance using our own button.
        JButton button = new JButton("Close Me");
        button.addActionListener(e -> System.exit(0));

        // The mouse listener and mouse motion listener we add here is to simply
        // make our frame draggable.
        frame.addMouseListener(new MouseAdapter() {
            public void mousePressed(MouseEvent e) {
                point.x = e.getX();
                point.y = e.getY();
            }
        });

        frame.addMouseMotionListener(new MouseMotionAdapter() {
            public void mouseDragged(MouseEvent e) {
                Point p = frame.getLocation();
                frame.setLocation(p.x + e.getX() - point.x, p.y + e.getY() - point.y);
            }
        });

        frame.setSize(500, 500);
        frame.setLocation(200, 200);
        frame.setLayout(new BorderLayout());

        frame.getContentPane().add(button, BorderLayout.NORTH);
        frame.getContentPane().add(new JLabel("Drag Me", JLabel.CENTER), 
            BorderLayout.CENTER);
        frame.setVisible(true);
    }
}
An Undecorated JFrame

An Undecorated JFrame