JPopupMenu doesn't work when invoker is not a Swing JComponent ??

I've written some code that uses a java.awt.Canvas to draw some stuff, and I want to be able to bring up a popup menu over the canvas.
The problem is that when I try to show the popup menu with my Canvas as the invoker nothing happens: no popup menu appears.
I also have problems with other AWT components (e.g. with java.awt.TextArea the popup comes up with two clicks but gets hidden behinf the popup that TextArea decides to provide).
However everything works fine when I use a Swing widget (e.g. JTextArea or JPanel) as the invoker of my popup menu.
Is this a bug or an undocumented feature?
The JPopupMenu.show(...) method will happily accept any AWT Component as the invoker. Also the API documentation says nothing on this issue. Also the Swing tutorials doesn't say anything about this.
I'm tempted to conclude this is an undocumented feature, but that suprises me. Surely I'm not the first person to try and use JPopupMenu with an AWT widget as invoker? Before I file a bug report, can someone tell me if I'm missing something here?
I have some code to demonstrate this; all you have to do is comment one line and uncomment another to repoduce this behaviour. Let me know if you would like me to post it.

Quick followup for anyone reading this topic:
The suggestion of using JPanel and overriding paintComponent(...) is the way to go. I had thought of doing this to begin with, but felt it would be more effort. It's not. It's the same effort as using AWT canvas, but gives better results, and doesn't stuff up JPopupMenu or anything else that wants to interact with a lightweight component.

Similar Messages

  • Purchased tab in "App Store" app doesn't work when AppleID is not an email address.

    After updated my iPhone and iPad to iOS 6 (both 6.0&6.0.1), Purchased tab in "App Store" app doesn't work when AppleID is not an email address. This happened since 6.0 and I hope that it will be fixed in6.0.1 but it doesn't.
    When I tap at Purchased tab in iPad App Store or Purchased bar in Updates tab in iPhone App Store, it just hang on "Loading...", but when I changed to other AppleID, it works. Apparently, my AppleID is not an email address but the other AppleID is an email address.
    Not sure where to send my feedback to Apple about this issue.

    http://www.apple.com/contact/feedback.html

  • Auto-scrolling doesn't work when JFrame is not visible

    Hi, I have auto-scrolling implemented for my JTextPane that sits in JScrollPane - which lives in JInternalFrame. It works as excepted - as long as my application's JFrame is visible. When the JFrame becomes invisible, auto-scrolling simply doesn't work anymore.
    I've overcame this by scrolling down in "windowShown", but it's ugly because the user can visually see the scroll down when using this workaround (it jumps).
    I guess this is Swing's optimization, but I would really like to overcome it in someway. But it seems I'm not enough a swing hacker to do it.
    One thing to note is thtat, the auto-scrolling works fine when the JInternalFrame is NOT visible, but frame is.
    I've tried to override the isShowing-method of JInternalFrame, with no luck.
    Here's my scrolling method:
    public static void scrollDown(JScrollPane scroll) {
              JViewport port = scroll.getViewport();
              Rectangle rect = new Rectangle(0, port.getViewSize().height, 1, 1);
              port.scrollRectToVisible(rect);
              JScrollBar bar = scroll.getVerticalScrollBar();
              bar.setValue(bar.getMaximum() - bar.getModel().getExtent());
         }Anyone have ideas?

    At some point I had really hard time getting the auto-scrolling to work, as I got these weird little bumps after scrolling down.
    Adding scrollBar.setValue() seemed to 'just fix it'. It actually seems to be superfluous now.
    The scrolling is already wrapped in SwingUtilities.invokeLater() - in conjuction with printing text into the JTextPane and it works OK.
    I had some wrong info in the first post, the viewport actually does get scrolled down even when the JFrame is not visible. And by visible I mean JFrame.setVisible(false) - my application has a minimize-to-tray feature, which hides the JFrame.
    So I think the problem is 'just' a repainting problem. When the frame is shown, the previous scroll location is first displayed, and then a repaint is triggered that causes the 'jump down'.
    I'm not still sure how to fix it though.

  • I have recently upgraded to iPhone 5 from 4, call line identity doesn't work when call other iPhones.  It works when calling any other brand of cell phone.  Network carrier assures me problem is not on there side.  Any assistance will be appreciated.

    I have recently upgraded to iPhone 5 from 4, call line identity doesn't work when call other iPhones.  It works when calling any other brand of cell phone.  Network carrier assures me problem is not on there side.  Any assistance will be appreciated.

    I have recently upgraded to iPhone 5 from 4, call line identity doesn't work when call other iPhones.  It works when calling any other brand of cell phone.  Network carrier assures me problem is not on there side.  Any assistance will be appreciated.

  • [Photoshop CC 2014] Click&hold-move-release doesn't work when adding adjustment layer from the layer panel

    When selecting a menu item I used to click the left mouse button and hold it down, move the pointer to the desired menu item and release the mouse button. Everything works fine in the mine menu, but there's a problem when adding new adjustment layer from the layer panel: when I release the button nothing happens, I have to press the button again. In previous PS version it worked fine. How can I fix this?

    I don't think that is user fixable, meaning you'll have to wait till adobe fixes it with an update.
    Photoshop cc 2014
    windows does not work
    mac does work
    Did you already post over here:
    [Photoshop CC 2014] Click&hold-move-release doesn't work when adding adjustment layer from the layer panel

  • It doesn't work when I press "transfer purchased items from ipod" and I don't know specidicly whitch item I need to transfer

    It doesn't work when I press "transfer purchased items from ipod" and I don't know specidicly whitch item I need to transfer.
    Whenever i press "transfer purchased items from ipod", itunes sync's for about 3 seconds, but I still can't install updates on the ipod without itues warning me about purchased items on the ipod, that aren't in the itunes library. I've tried folowing the steps in itunes help, but I can only find a step guide for when you know the specific item that needs transferring, and I donøt know that specific item.

    This Apple Tech Note explains the process:
    http://support.apple.com/kb/ht1848
    It will transfer all purchased items that the computer you are transferring to is authorised to play: you don't have to select the items.

  • Imessage doesn't work when i connect to my wifi only works on mobile date how do i fix this?

    Imessage doesn't work when i connect to my wifi only works on mobile date how do i fix this?

    1. Did you use Bootcamp Assistant?
    2. Did you build a USB with Windows 7 ISO and Bootcamp drivers?
    3. You should use a USB2.0 disk, not a USB3.0 disk (flash drive).
    4. What year is the Retina MBP?

  • Charger works when notebook is off, but it doesn't work when the notebook is on.

    I have a HP Pavilion dv6-3070tx Entertainment Notebook PC.
    My charger doesn't work when the notebook is on and plugged in, but when the notebook is off (or even when it is in sleep mode) it gets charged. I tested this by using different chargers that work in other hp notebooks. If this can be solved, I'll be grateful.

    Hi
    There are two structures of DVDs
    • Data-DVD - as burned from DeskTop/Finder
    • Video-DVD - to be played on a DVD-Player - Needs a program that can do this
    One can in iMovie - Export as QuickTime .mov and save this via DeskTop/Finder onto a DVD - BUT this will only play on a Computer and if it is a Window-PC this needs to download QT-player or VLC-player.
    But no DVD-player for TV can play back this.
    To get a Video-DVD then You need
    • iDVD (not from Apple any more) - or -
    • DVD Studio Pro (not from Apple any more) - or -
    • FinalCut Pro-X (can do simple Video-DVDs) - or -
    • Burn - http://www.digital-digest.com/software/Burn.html - FREE - but very PLAIN - no fancy things at all.
    • Roxio Toast™ 11 Pro - Fairly advanced - and costs a bit - still very Good and lot's of great tool's included. (I love it) - Can also back convert home made DVDs to an editable mode in an OK quality. With BD-component also capable to do sort of Blu-Ray DVDs.
    Yours Bengt W

  • Why won't my pandora work when I'm not on wifi? I have the cellular data on for it but I never works. Also pandora isn't the only app of mine that does that.. What's wrong with it??

    Why won't my pandora work when I'm not on wifi? I have the cellular data on for it but I never works. Also pandora isn't the only app of mine that does that.. What's wrong with it??

    You're welcome.
    Voicemail is left at your carrier's server. That will continue to work unless you report your iPhone as lost or stolen with your carrier.
    You may never find it again and you can't if the iPhone remains offline or out of service which means the iPhone is powered off or doesn't have cellular reception.

  • Flash player doesn't work for Samsung Galaxy Note

    I have downloaded Flash Player 11 for my Samsung Galaxy Note. But it doesn't work when I watch video in other website ( Not Youtube ). It said I have not installed my Flash Player. I keep download and undownload and it still doesn't work.
    Thanks for helping me.

    Hopefully one of these FAQs will help:
    Why is Flash Player not working on my Android tablet or phone?
    Flash Player for Android Frequently Asked Questions

  • Just upgraded to Lion an am discovering that I cannot send email photos from within iPhoto. Error message says bad Internet connection or server not working, when that's not the case. Never happened in Snow Leopard! Help!!!

    Just upgraded to Lion an am discovering that I cannot send email photos from within iPhoto. Error message says bad Internet connection or server not working, when that's not the case. Never happened in Snow Leopard! Help!!!

    what email service - Yahoo mail have been acting up lately
    you can try setting Mail as your email client - it resolves this pfoblem for some people
    LN

  • My speaker doesn't work when I try to listen to music or open up a quick time file, however they seem to work perfectly when I listen to a voice memo (p.s. the volume slider disappears in a song page and even in the multi tasking bar)

    my speaker doesn't work when I try to listen to music or open up a quick time file, however they seem to work perfectly when I listen to a voice memo (p.s. the volume slider disappears in a song page and even in the multi tasking bar)

    Thanks for your solution, it wasn't quite what solved the problem but i remembered that i had a bit of salt water on my phone recently and spraying the charging port with an anti-oxide spray solved my problem, do you mind if i ask, how is the charging port related with the volume or/and speakers?

  • BitmapData draw method doesn't work when the project is published as the .swf file of the web applic

    Hi,
            I am totally confused by this strange error. When I tried using the draw method of BitmapData to draw a movieclip symbol of my project, it seems to work fine locally. However, as I uploaded the published .swf file to my web server and launched it as the plugin of my web application, it failed. The source codes as follows,
    function printscreenClicked():void
         //ExternalInterface.call calls a javascript function to print message1
        var bd:BitmapData = new BitmapData(stage.width,stage.height);
        //ExternalInterface.call calls a javascript function to print message2
      bd.draw(stage);
        //ExternalInterface.call calls a javascript function to print message3
    message3 didn't show at all. Instead, the browser console shows "Uncaught Error: Error calling method on NPObject.". My understanding of this error message is that the .swf is calling something crashing, and I believe that bd.draw(stage)is the crashng method call.
    Also, here is my html embed tag:
        <embed src="/tests/videoplayer.swf" id="flash" quality="high" height="510" width="990" scale="exactfit" name="squambido" align="middle" allowscriptaccess="always" allowfullscreen="true" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" style="margin: 0px auto;clear:both;position:relative;"/>
    Can someone help me?

    Thank you for your reply.
    I tried stageWidth and stageHeight, but it still doesn't work.
    The draw() methid is triggered when I clicked a screenshot button in my application as follows,
    ExternalInterface.addCallback("printscreenClicked", printscreenClicked);
    function printscreenClicked():void
         //ExternalInterface.call calls a javascript function to print message1
        var bd:BitmapData = new BitmapData(stage.width,stage.height);
        //ExternalInterface.call calls a javascript function to print message2
      bd.draw(stage);
        //ExternalInterface.call calls a javascript function to print message3
    Would you please give me an example of "waiting for Event.RESIZE is good, or just at least Event.ENTER_FRAME"?
    My real purpose in this application is to capture a snapshot of a streaming video. The video is contained in a movieclip object. I tried stage first since BirmapData.draw() doesn't work when drawing the movieclip on the web site. Do you have any suggestion for this situation? Also, is there any good method to find out what happened if the browser have "Uncaught Error: Error calling method on NPObject."?

  • I have different account ID's with my iphone and computer. I would like to standardise both to just the one. One of the ID's doesn't work, when I tried to list the second email with the preferred one a message telling me that this email is already in

    I have different account ID's with my iphone and computer.
    I would like to standardize both to just the one.
    One of the ID's doesn't work, when I tried to list this second email with the preferred one a message telling me that this email is already in use pops up.. yes it is, with me??
    Is there an easy to fix this please, Fabfitz

    If the email address you want to use is being used as the primary email address on a different ID you have to manage that ID and change it to a different primary email address.  This explains how: Change your Apple ID - Apple Support.
    If it is being used as an alternate or rescue address on a different ID, you manage the ID and either remove it or change it to a different email address.  This explains how: Manage your Apple ID primary, rescue, alternate, and notification email addresses - Apple Support.

  • I have Adobe Acrobat 9.5.4 installed on my computer and it doesn't work when PDFing

    I have Adobe Acrobat 9.5.4 installed on my computer and it doesn't work when PDFing my document using Microft Word 2010. I have tried using the tab add-in, but it doesn't respond either. The only way to convert my document is to save it as a .pdf from the save as drop down box. I need to be able to have the full functionability of creating a PDF document with the tabs and links working.
    Please help!

    From OFFICE 2010 you either have to have AA X or just print to the Adobe PDF printer. You give no information on your operating system or specifically what you mean by PDFing -- there are multiple ways to create a PDF from a WORD document and you have given no information. However, in this case your only choice is to print to the Adobe PDF printer. Otherwise, you need to upgrade Acrobat.

Maybe you are looking for