How to use the Balloontip library?

Asked

Viewed 79 times

1

I would like to use tooltips as in the library balloontip, but I haven’t found a way to use it, it seems to be different from toolTips conventional methods that use the method to be applied setToolTipText.

How can I apply this balloontip for 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 a ballotip-like object, it gives me error saying:

Balloontip() has protected access in Balloontip

  • There are examples, already downloaded the examples to see how they were made?

  • @Articuno I downloaded , performed, but do not know how to use :(

  • Post what tried to.

  • @Articuno ta there, it was something very "simple "

  • I understand you didn’t follow my guidance on last answer.

  • @Careless cunning, man, the more I changed now !

Show 1 more comment

1 answer

1


According to the documentation, the class builder BaloonTip receives 2 parameters, as can be seen below:

BalloonTip(JComponent attachedComponent, String text);

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

The constructor without parameters you’re trying to use has protected visibility, for this reason the error occurs.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.