Know how to change the outline shape of a tooltip?

Hi All,
I was wondering if anybody knows how to change the shape of a tooltip popup box?
I've implemented my own UI delegate for ToolTipUI and overridden the paint( Graphics g, JComponent c ) method which I thought would have allowed me to completely control the rendering of the tooltip, box and all. But what I discovered was that even when I did nothing inside this method, the rectangular popup window was still appearing (I stepped through the code, and the correct instance of UI was being used, not the one that may have been defined by UIManager.set( "ToolTipUI", "foo.Bar" )) After a little more investigation, I ended up in ToolTipManager.showTipWindow() which eventually calls
PopupFactory popupFactory = PopupFactory.getSharedInstance();
tipWindow = popupFactory.getPopup(insideComponent, tip, location.x, location.y);
tipWindow.show();To try to overcome this, as a test I extended JButton with the following constructor:
public TestButton() {
    super();
    setUI( new MyCustomUI() );
    ToolTipManager.sharedInstance().unregisterComponent( this );
}but this didn't solve the problem either. Has anybody got any ideas on this?
Cheers,
Paul.

Try this.
regards,
Stas
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import java.awt.geom.*;
public class Test {
    JScrollPane scroll;
    JPanel p=new JPanel(new BorderLayout());
    Robot robot=new Robot();
    public Test()  throws Exception {
        final JFrame frame=new JFrame();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.getContentPane().add(p);
        JButton b=new JButton("Test balloon!");
        b.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent e) {
                TransparentFrame frame1=new TransparentFrame();
                int x=frame.getX()-100;
                if (x<0) x=0;
                int y=frame.getY()-100;
                if (y<0) y=0;
                frame1.setBounds(x,y,100,100);
                frame1.createBalloon();
                frame1.setVisible(true);
        frame.getContentPane().add(b);
        frame.setBounds(200,200,120,50);
        frame.show();
    public static void main(String[] args) throws Exception {
        new Test();
class TransparentFrame extends JWindow {
    Robot robot;
    BufferedImage screenImg;
    Rectangle screenRect;
    MyPanel contentPanel=new MyPanel();
    boolean userActivate=false;
    Area Balloon;
    public TransparentFrame() {
        super();
        createScreenImage();
        contentPanel.Balloon=Balloon;
        this.setContentPane(contentPanel);
        this.addComponentListener(new ComponentAdapter() {
            public void componentHidden(ComponentEvent e) {}
            public void componentMoved(ComponentEvent e) {
                resetUnderImg();
                repaint();
            public void componentResized(ComponentEvent e) {
                resetUnderImg();
                repaint();
            public void componentShown(ComponentEvent e) {}
        this.addWindowListener(new WindowAdapter() {
            public void windowClosing(WindowEvent e) {
            public void windowClosed(WindowEvent e) {
            public void windowOpened(WindowEvent e) {
            public void windowIconified(WindowEvent e) {
            public void windowDeiconified(WindowEvent e) {
            public void windowActivated(WindowEvent e) {
            public void windowDeactivated(WindowEvent e) {
                Balloon=null;
    protected void createScreenImage() {
        try {
            if (robot==null)
                robot=new Robot();
        catch (AWTException ex) {
            ex.printStackTrace();
        Dimension screenSize=Toolkit.getDefaultToolkit().getScreenSize();
        screenRect=new Rectangle(0,0,screenSize.width,screenSize.height);
        screenImg=robot.createScreenCapture(screenRect);
    public void createBalloon() {
        Rectangle bounds=new Rectangle(0,0,getWidth(),getHeight());
        Balloon=new Area(new Rectangle(bounds));
        System.err.println(Balloon.getBounds());
        RoundRectangle2D content=new RoundRectangle2D.Double(0,0,getWidth(),getHeight()/3,20,20);
        Polygon polygon=new Polygon(new int[] {20,getWidth()/2,getWidth()},new int[] {getHeight()/3,getHeight()/3,getHeight()},3);
        Area a=new Area(new Rectangle(bounds));
        a.subtract(new Area(content));
        a.subtract(new Area(polygon));
        Balloon.subtract(a);
        contentPanel.Balloon=Balloon;
    public void resetUnderImg() {
        if (robot!=null && screenImg!=null) {
            Rectangle frameRect=getBounds();
            int x=frameRect.x;
            contentPanel.paintX=0;
            contentPanel.paintY=0;
            if (x<0) {
                contentPanel.paintX=-x;
                x=0;
            int y=frameRect.y;
            if (y<0) {
                contentPanel.paintY=-y;
                y=0;
            int w=frameRect.width;
            if (x+w>screenImg.getWidth())
                w=screenImg.getWidth()-x;
            int h=frameRect.height;
            if (y+h>screenImg.getHeight())
                h=screenImg.getHeight()-y;
            contentPanel.underFrameImg=screenImg.getSubimage(x,y,w,h);
class MyPanel extends JPanel {
    BufferedImage underFrameImg;
    Area Balloon;
    int paintX=0;
    int paintY=0;
    public MyPanel() {
        super();
        setOpaque(true);
    public void paint(Graphics g) {
        super.paint(g);
    protected void paintComponent(Graphics g) {
        super.paintComponent(g);
        g.drawImage(underFrameImg,paintX,paintY,null);
        if (Balloon!=null) {
            g.setColor(Color.yellow);
            ((Graphics2D)g).fill(Balloon);
        g.setColor(Color.red);
        g.drawString("Balloon test!",10,20);
}

Similar Messages

  • I have three email accounts and want to know how to change the display order.

    I have three email accounts and want to know how to change the display order.

    Install this add on.
    https://addons.mozilla.org/en-US/thunderbird/addon/manually-sort-folders/?src=search

  • I recently changed my apple ID but my previous apple ID is associated with my icloud account. I'm setting up my new iphone 6 and cannot complete the set up until I can sync my icloud account. Does anyone know how to change the icloud id?

    I recently changed my apple ID but my previous apple ID is associated with my icloud account. I'm setting up my new iphone 6 and cannot complete the set up until I can sync my icloud account. Does anyone know how to change the icloud id?

    Do the following:
    Make sure you are signed into iMessage and FaceTime with your current ID.  If they are signed into the old ID, go to Settings>Messages>Send & Receive and Settings>FaceTime, tap the ID, sign out, then sign back in with your current ID.
    Then temporarily recreate the old ID by going to https://appleid.apple.com, click Manage my Apple ID and sign in with your current iCloud ID.  Click edit next to the primary email account, change it back to your old email address and save the change.  (You should not have to verify the old email account so it doesn’t matter if you no longer have access to it.)  Now go to Settings>iCloud, turn off Find My iPhone and enter your current password when prompted (even though it prompts you for the password for your old ID).  Then go to Settings>iCloud, tap Sign Out and choose Delete from My iPhone when prompted (your iCloud data will still be in iCloud).  Next, go back to https://appleid.apple.com and change your primary email address back to the way it was.  Now you can go to Settings>iCloud and sign back in with your current iCloud ID and password (your data will download back to your phone).

  • Does anyone know how to change the settings for siri as all he keeps saying to me is he can only look up businesses in the u.s

    my siri seems to be a bit confused as he thinks im in america but im in northern ireland is ther anyone who knows how to change the settings as i cant find them alsao he doesnt understand a word im saying

    To use another iCloud backup, you have to erase all content and settings or restore it. Either gets you to the backup/setup page.
    http://support.apple.com/kb/HT1766

  • HT4356 I have two printers on my network.  Does anyone know how to change the printer nomenclature - Officejet Pro 8600  (0B54AF) to a recognizable name...like Brad's Office?

    I have two printers on my network.  Does anyone know how to change the printer nomenclature - Officejet Pro 8600  (0B54AF) to a recognizable name...like Brad's Office when you use Airprint?

    You would have to change that in the printer's settings on the printer, if that option is offered by the manufacturer. The iPhone just finds printers on the network and uses the name they have given themselves or that were given to them when they were set up.

  • Why doesn't siri know how to change the time of a reminder? When asked, "Do you want to confirm or cancel your reminder?" Reply, "Can I change the time to a half hour later?" Siri doesn't know how to respond.

    Why doesn't siri know how to change the time of a reminder? When asked, "Do you want to confirm or cancel your reminder?" Reply, "Can I change the time to a half hour later?" Siri doesn't know how to respond.

    Hi
    In iMovie'11 (version 9.0.x)
    on top menu row - Apple/iMovie/File/Edit/Cut (Can vary dep. on language - in Swedish Apple/iMovie/Arkiv/Redigera/Klipp . . . )
    down Cut menu - Slow playback/Raspid Playback/Re-play in Slow Motion and onvards
    Here one can select the Pre-Set speeds
    Are you familiar with getting 'inspector' to run?
    No - but I guess that Double Click on clip/sequense or ctrl-Click on it might open it.
    Yours Bengt W

  • Does anyone know how to change the copy on a pdf made in Indesign?  I don't have that software on my Mac

    Does anyone know how to change the text on a pdf made in Indesign when my Mac doesn't have that software?   Thanks,

    If you don't have access to Acrobat Pro or Nitro PDF Pro,  see this article:
    http://www.labnol.org/software/edit-pdf-files/10870/

  • The fonts on my facebook page is set to approximately 200%. This problem is only on my facebook page. Does anyone know how to change the font size on this page?

    I do not know how I changed the font size on my face book page I have tried everything to change the font size to 100% but have failed. Any suggestions?

    Hi,
    From your description, you want to know how to edit a page in SharePoint 2013.
    Go to the page->click Settings->Edit page,refer to the following screenshot:
    If a user want to edit a page, he at least have edit permissions.
    If you have any problems, please don't hesitate to let me know.
    Best Regards,
    Lisa Chen
    TechNet Community Support
    Please remember to mark the replies as answers if they help, and unmark the answers if they provide no help. If you have feedback for TechNet Support, contact
    [email protected]

  • R12-Please let me know how to change the product status

    Hi,
    We are looking to change the "INV" product status from "shared" to "Fully installed".Please let me know,how to change the same.

    Hi,
    Did you verify the current status of the product?
    Note: 443699.1 - How to check if certain Oracle Applications product/module is implemented?
    https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=443699.1
    You can change the status of the product from shared to installed from OAM > License Manager. Once the product is installed, run the following via adadmin for this product (optional but recommended).
    - Generate message files
    - Generate forms files
    - Generate report files
    Regards,
    Hussein

  • Hi  does anybody know how to change the language of interface in demo version illustrator CC

    Hi  does anybody know how to change the language of interface in demo version illustrator CC ?

    It doesn't help. I will try to download again illustrator
    Отправлено из мобильной Почты Mail.Ru
    Понедельник, 9 марта 2015 г., 18:36 +0300 от Mylenium  <[email protected]>:
    Hi  does anybody know how to change the language of interface in demo version illustrator CC created by  Mylenium in  Downloading, Installing, Setting Up -  View the full discussion

  • HI, DOES ANYONE KNOW HOW TO CHANGE THE COMPUTER MY ILLUSTRATOR IS INSTALLED ON?

    HI, DOES ANYONE KNOW HOW TO CHANGE THE COMPUTER MY ILLUSTRATOR IS INSTALLED ON?

    This is just about as vague as you can get. Change it how? Maybe paint it red or something? What’s your problem?

  • Hi Guys Do you know how to change the country for app nana

    Hi Guys
    Do you know how to change the country/region in app nana because i have a lot of nanas but my region is US. I want the region to be Australia. CAN YOU PLEASE HELP ME
    Thanks

    Check the third answer down on this link. If it doesn't solve your problem use the link to contact appnana.
    https://mapiz.wufoo.com/forms/appnana-helps/

  • I need to know how to change the identity (email address) used for the iTunes store as I no longer use that email

    I need to know how to change the identity (email address) used for the iTunes store as I no longer use that email.

    Settings > iTunes & App store.
    Tap AppleID, sign out then sign back in.
    The Apple ID is right everywhere else. I've synced the phone. I've reset it in Settings on the phone. I've changed it at Apple.
    When you write, "I've changed it at Apple, this means you updated yoru old AppleID or you ceated a new AppleID?

  • I have recently changed networks to giffgaff but now my voicemail button doent work does anyone know how to change the voice mail number so it works again? thanks

    i have recently changed networks to giffgaff but now my voicemail button doent work does anyone know how to change the voice mail number so it works again? thanks

    GiffGaff are not a supported UK Apple carrier .That is probably why you have lost Voicemail they are a cheap carrier who provide minimum services ,do they even offer voice mail
    Go talk to them

  • May I know how to change the color of texts inside the indicator box?

    Can anyone tell me how to change the color of texts inside the indicator box? I have tried to use property node but not really know how it functions.
    In fact, I am writing a program for which the number inside indicator on front panel will show red color if the measured value can't reach the requirement. I am using LabView 6.1 Professional
    Thank You for your attention!!!!!!

    Simply use a property node with "NumText.TextColor" and wire the correct color depending on your test result.
    The attached simple example (LV 6.1) lets you change it from the front panel. In your case, you would use your test output instead of a FP switch, of course. Message Edited by altenbach on 05-25-2005 09:05 PM
    LabVIEW Champion . Do more with less code and in less time .
    Attachments:
    TextColor.vi ‏18 KB

Maybe you are looking for

  • Help: XP driver for 3000 G410 wireless adapter

    Hi All, My recently bought g410 came with Vistra (only) drivers CD, while I'm installing winXP instead. I downloaded drivers from Lenovo website and everything worked except the winXP driver for "wireless network adapter" (all 3 of them: Gemtek, 3xxx

  • Create a melody with Labview/ Function Generator

    Hi (first sorry for poor english, not my native language) I have a project at school which is creating a melody using Labview and a function generator. I've worked on it for hours now and i still can't get through it. I joined the vi file with my pos

  • What's this in the box?

    I have a lovely new iPod. Just one stupid question so far: What is this thing in the box? The little white thing, looks like it's some sort of protector for the dock port? What am I to do with this? Thanks in advance! ibook g3 now cadidate MBP owner

  • How do I change ownership of an I Phone

    I recently moved in with my daughter and she gave me her I phone 4 G, because she got a new phone.  I cannot update the I phone 4  in I tunes because it wants the Serial # of the phone and it keep s coming up and saying " Veronica's I phone"  How do

  • NI 9237 with varriable resistance

    Dear All, I am interfacing NI 9237 module with a vaiiable resistance to just give a demo how to read analoge sensor , I am not able to get the values of my varriabe resistance(POT) I just want to display the variation in a numeric text box as i chang