How to use the BalloonTip library?

1

I would like to use tooltips like the balloontip library, but I did not find one way to use, it seems to be different from the conventional toolTips that to be applied use the setToolTipText method.

How can I apply this balloontip to a component?

I try to do so:

import java.awt.EventQueue;
import javax.swing.JFrame;
import javax.swing.JTextField;
import net.java.balloontip.BalloonTip;

public class TesteBalloonTip extends JFrame {

    private JTextField jTextField = new JTextField();

    public static void main(String[] args) {
        EventQueue.invokeLater(()
                -> {            
            TesteBalloonTip tp = new TesteBalloonTip();
            tp.setVisible(true);
        }
        );        
    }

    public TesteBalloonTip() {

        BalloonTip ballon = new BalloonTip();

        ballon.setAttachedComponent(jTextField);

        setSize(500, 300);
        setLocationRelativeTo(null);
        setDefaultCloseOperation(EXIT_ON_CLOSE);
    }
}

However, when I try to instantiate an object of type ballotip, it gives me error saying:

  

BalloonTip () has protected access in BalloonTip

    
asked by anonymous 21.10.2017 / 01:07

1 answer

1

According to the documentation , the class constructor BaloonTip gets 2 parameters, as can be seen below:

BalloonTip(JComponent attachedComponent, String text);

The first represents the component to which you want to apply the baloon tip, the second is the string that represents the text that will be displayed on it.

The parameterless constructor you are trying to use has protected visibility , so the error occurs.     

21.10.2017 / 02:43