Search code examples
javaballoon-tip

BallonTip Java, how to move the balloon


I'm using BalloonTip component in my program and I couldn't find the answer how to move it (to the right).

PoleTekstowe = new javax.swing.JTextField();

Balonik = new BalloonTip(PoleTekstowe, "Nie dzielimy przez 0!");
Balonik.setVisible(false);
Balonik.setCloseButton(BalloonTip.getDefaultCloseButton(), false);    

Too bad I cant post an image yet.


Solution

  • You could use something like...

    BalloonTip tip = new BalloonTip(
                    field, 
                    new JLabel("Type Something"),
                    new RoundedBalloonStyle(5,5,Color.WHITE, Color.BLACK), 
                    BalloonTip.Orientation.RIGHT_BELOW, 
                    BalloonTip.AttachLocation.ALIGNED, 
                    15, 
                    15, 
                    true);
    

    Which is demonstrated in the Tweaking a balloon tip's position section of the manual...

    enter image description here

    I'd also grab a copy of the source code, as it makes it eaiser to see how they build the tooltips...