JPopupMenu won't go away when application is moved

Sorry, I have to reask this question. I am pretty much stuck with this.
I have JPopupMenu that contains a JScrollPane that has a JPanel inside it.
My application's main component is a JFrame, the above JPopupMenu is part of a search panel (JPanel). Every time when I make JPopupMenu visible, then left-click on application's title bar, and move the whole application away, JPopupMenu stays in the original position! If I click on any other place, such as tool bar, or any other component, JPopupMenu will disappear.
This is really strange stuff. My guess is that titile bar cannot detect mouse events? Is that true? Is there any way I can make it disappear once user holds title bar and move the whole application away?
thanks in advance!
Message was edited by:
jack_wns

Finally created some sample code I can use to explain the possible solution I try to figure out. If I run the same application and then right-click on the
application, a popup menu will show up. If I move mouse outside the frame (I try to make JComponent visible so that I can move mouse outside JComponent, but I cannot make it happen), popup menu is still visible. I try to add the following to mouseExited method:
popupMenu.setVisible(false);
But this seemingly will disable pupup menu.
What I try to do is: make popup disappear once user move her mouse outside frame (better yet JComponent). How can I do this?
Here is the sample code I just created:
import java.awt.AWTEvent;
import java.awt.Color;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import javax.swing.JComponent;
import javax.swing.JFrame;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.JPopupMenu;
class PopupTest extends JComponent implements ActionListener, MouseListener {
     private JPanel topPanel;
     private JPopupMenu popupMenu;
     public PopupTest() {
          //setTitle("Popup Menu Application");
          setSize(310, 130);
          setBackground(Color.GREEN);
          topPanel = new JPanel();
          topPanel.setLayout(null);
          add(topPanel);
          JMenuItem menuFileNew = new JMenuItem("New");
          JMenuItem menuFileOpen = new JMenuItem("Open...");
          JMenuItem menuFileSave = new JMenuItem("Save");
          JMenuItem menuFileSaveAs = new JMenuItem("Save As...");
          JMenuItem menuFileExit = new JMenuItem("Exit");
          // Create a popup menu
          popupMenu = new JPopupMenu("Menu");
          popupMenu.add(menuFileNew);
          popupMenu.add(menuFileOpen);
          popupMenu.add(menuFileSave);
          popupMenu.add(menuFileSaveAs);
          popupMenu.add(menuFileExit);
          topPanel.add(popupMenu);
          enableEvents(AWTEvent.MOUSE_EVENT_MASK);
          menuFileNew.addActionListener(this);
          menuFileOpen.addActionListener(this);
          menuFileSave.addActionListener(this);
          menuFileSaveAs.addActionListener(this);
          menuFileExit.addActionListener(this);
          addMouseListener(this);
     public void processMouseEvent(MouseEvent event) {
          if (event.isPopupTrigger()) {
               popupMenu.show(event.getComponent(), event.getX(), event.getY());
          super.processMouseEvent(event);
     public void actionPerformed(ActionEvent event) {
          System.out.println(event);
     public void mouseExited(final MouseEvent e) {
          System.out.println("Mouse Exited...");
          //popupMenu.setVisible(false);  //line added
     public void mouseEntered(final MouseEvent e) {
          System.out.println("Mouse Entered...");
     public void mousePressed(final MouseEvent e) {
          System.out.println("Mouse pressed...");
     public void mouseReleased(final MouseEvent e) {
     public void mouseClicked(final MouseEvent e) {
          System.out.println("Mouse Clicked...");
     public static void main(String args[]) {
          PopupTest mainFrame = new PopupTest();
          mainFrame.setVisible(true);
          JFrame frame = new JFrame();
          frame.setTitle("Popup Menu Application");
          frame.setSize(500, 430);
          frame.getContentPane().add(mainFrame);
          frame.setVisible(true);
}thx

Similar Messages

  • Reminders Notifications in Mountain Lion latest update keeps freezing on my homescreen and won't go away when trying to close. Please help.

    Reminders Notifications in Mountain Lion latest update keeps freezing on my homescreen and won't go away when trying to close. Please help.
    I'm using a 2009 Macbook Pro and have installed the lastest update 10.8.1

    I've been seeing this for some time now and getting quite sick of it. It happens when I've been away at work for the day and come home to find frozen notifications.
    You can fix this temporarily by quitting Notification Centre from Activity Monitor but it keeps happening to me every week or so.

  • On G4 System Preferences, Network, I have a dropdown menu that says that my settings have been altered by another application and won't go away when I click ok, I can't work in the Network preferences and it won't respond to be closed.  Have to Force Quit

    On G4 Powerbook System Preferences, Network, have a dropdown menu that says this has been configured by another application.  when press OK it keeps coming on & can't work in System Preferences.  It won't even respond to Quit System Preferences and I have to Force Quit to close System Pref.
    Any ideas?

    Look at this link. http://discussions.apple.com/thread.jspa?messageID=9372513
    I did BDAqua's suggestion
    To stop the pop-up, Go to System Preferences: Security. Check the box next to "Require password to unlock each secure system preference." Then lock Security.
     Cheers, Tom

  • Treo 755p voice mail notificati​on picture won't go away when all messages are gone

    Hi,
    I have a used, new to me treo 755p (alltel). The voicemail notifaction picture on the home screen is always on, even when I have no messages. It won't go off. Any thoughts?
    Thanks,
    Bob
    Post relates to: Treo 700p (Alltel)

    The issue is the network as not sent a message to clear that from the phone. You can see if Alltel can send a message to the phone to clear that or you can do a hard reset on the device and that should resolve the issue.

  • Upload Dialog Box Won't Go Away When Uploading Larger Files

    I'm uploading a 200 MB Excel file to Power BI and the upload dialog box never goes away, even after the upload is completed. I verified this by checking network activity from Internet Explorer and additionally by opening a new Power BI window and verifying
    that the file load took place. I think this is a bug.

    Guy, what are the next steps? Should Joey file a bug on Connect?
    Thanks!
    Ed Price, Power BI & SQL Server Customer Program Manager (Blog,
    Small Basic,
    Wiki Ninjas,
    Wiki)
    Answer an interesting question?
    Create a wiki article about it!

  • I get a message that my shortcut won't work as the application is moved or deleted when using firefox, reinstall is required to get it back.

    When I reinstall after this message I have my Bookmarks and settings intact. I loose FireFox in all users on the system. Has now happened multiple times.I have the log files and the exact error which I can send if they are needed.

    Hi Bitrider54,
    I moved this question to the Firefox support forums - it seems that you are having issues with the Firefox browser in your computer, and not with a Firefox OS mobile device, is that correct?
    You may attempt to install Firefox as an administrator. To do this, right click on the installation file, and click on '''Run as administrator...'''.
    Please let us know if this solves your issue, or if you have any other questions about your Firefox browser.
    Thanks,
    - Ralph

  • Old iCal-Calandars stay somewhere in cache and won't go away when syncing

    Hey guys,
    this should be an easy question but it disturbes me for months now.
    I have old and outdated Calandars on my iPhone.
    All i want is to have exactly the content i use in iCal ond my iPhone.
    I know there is a marker to replace the stuff that is on my Mac with the one on my iPhone but it does not work .
    When i plug my iPhone on my iMac I can see those old Calandars in the iTunes Overview but I can't replace or delete them.
    Is there any chane to get rid of those old calandars?
    It might be a Problem that the old ones have exactly the same name as the new ones.
    One example would be the Birthday Calandar.
    My old one ist outdated and got wrong entries but i simply can't get rid of it.
    This leads to doubled entries and wrong entries
    I'm a bit lost here!
    Hope you can help me!
    Thanks in advance
    Patrick
    Ps: sorry for my english as its not my native language hope you got it

    I had a similar problem where I kept deleting the calendar data files and iCal preferences, only to startup iCal and have the old data appear in calendars.
    After quitting iTunes, and killing the files, iCal was clean again.

  • JPopupMenu won't disappear after using it!

    I'm using a JPopupMenu on a JTable. When I rightclick on a line in my table, I display a dialogbox to make some selections which you can close by clicking an OK button. The problem is, that when I close the dialog box the JPopupMenu won't go away. More exact: Parts of it persist on the screen, but it is more like a background image, since it then is no longer functional (menu items are not highlighted etc.). Does anybody know a workaround to this problem why the pop up menu doesn't go away after using it?

    Have you tried firepopupMenuCacelled() ??
    This is a method of JPopupmenu that notifies listeners that it hacs been cancelled.... ??
    Or maybe a mouse removed listener event to close the JPopupMenu... ??

  • TS3274 My Ipad shows an icloud backup popup that won't go away

    I have a popup that says to backup on icloud it won't go away when I press okay, won't shut down and I cannot perform any other operations on my ipad.

    Try a reset:
    Hold the Sleep and Home button down (approximately 10 seconds) until you see the Apple logo.
    Note: Data will not be affected.

  • HT4356 HP printer error message won't go away

    I've been printing from iPad to HP Envy with non-HP cartridges for years with no problems. Now the "non-HP cartridges installed" error message on printer won't go away when I hit OK.  iPad reads this as "printer is out of  ink."  Rebooting didn't help.

    Hi PJSammy,
    Here is a link to a post that should help you resolve your issue.
    Let us know if this works for you.
    If I helped you at all it would be great if you clicked the blue kudos star!
    If I solved your post please mark it as solved to help others.
    I'm a printer tech with HP.

  • I don't understand why recently with the new "pages" my computer stops responding. When I go to fix some grammar all of a sudden the little colored circle begins to appear and won't go away I restart my computer.

    I don't understand why recently with the new "pages" my computer stops responding. When I go to fix some grammar all of a sudden the little colored circle begins to appear and won't go away I restart my computer.

    If you have more than one user account, these instructions must be carried out as an administrator.
    Launch the Console application in any of the following ways:
    ☞ Enter the first few letters of its name into a Spotlight search. Select it in the results (it should be at the top.)
    ☞ In the Finder, select Go ▹ Utilities from the menu bar, or press the key combination shift-command-U. The application is in the folder that opens.
    ☞ Open LaunchPad. Click Utilities, then Console in the icon grid.
    Step 1
    Make sure the title of the Console window is All Messages. If it isn't, select All Messages from the SYSTEM LOG QUERIES menu on the left. If you don't see that menu, select
    View ▹ Show Log List
    from the menu bar.
    Enter "BOOT_TIME" (without the quotes) in the search box. Note the timestamps of those log messages, which refer to the times when the system was booted. Now clear the search box and scroll back in the log to the last boot time after  you had the problem. Select the messages logged before the boot, while the system was unresponsive or was failing to shut down. Copy them to the Clipboard by pressing the key combination command-C. Paste into a reply to this message (command-V). Please include the BOOT_TIME message at the end of the log extract.
    If there are runs of repeated messages, post only one example of each. Don’t post many repetitions of the same message.
    When posting a log extract, be selective. In most cases, a few dozen lines are more than enough.
    Please do not indiscriminately dump thousands of lines from the log into this discussion.
    Important: Some private information, such as your name, may appear in the log. Anonymize before posting.
    Step 2
    Still in Console, look under System Diagnostic Reports for crash or panic logs, and post the entire contents of the most recent one, if any. In the interest of privacy, I suggest you edit out the “Anonymous UUID,” a long string of letters, numbers, and dashes in the header of the report, if present (it may not be.) Please don’t post any other kind of report — it will be very long and not helpful.

  • When I try to open a picture from email all I get is a yellow mozilla square in the middle of my screen and it won't go away unless I restart and I can't view the picture.

    Why can't I open pictures sent to me in email. All I get is a yellow mozilla box in the middle of my screen that won't go away unless I restart.
    == This happened ==
    A few times a week
    == when I try to view a picture

    The ! turns up when iPhoto loses the connection between the thumbnail in the iPhoto Window and the file it represents.
    What version of iPhoto? Assuming 09 or later...
    Option 1
    Back Up and try rebuild the library: hold down the command and option (or alt) keys while launching iPhoto. Use the resulting dialogue to rebuild. Choose to Rebuild iPhoto Library Database from automatic backup.
    If that fails:
    Option 2
    Download iPhoto Library Manager and use its rebuild function. This will create a new library based on data in the albumdata.xml file. Not everything will be brought over - no slideshows, books or calendars, for instance - but it should get all your albums and keywords back.
    Because this process creates an entirely new library and leaves your old one untouched, it is non-destructive, and if you're not happy with the results you can simply return to your old one. .
    Regards
    TD

  • How do I get rid of the blue "downloading the latest applications" bar which won't go away even after uninstalling and reinstalling Firefox?

    Can't get rid of the blue "downloading the latest applications" bar that seems to be just hanging and won't go away. I uninstalled and reinstalled Firefox, but the bar is still there after 2 days. I updated something (can't remember what!) on I.E., and it had the same blue bar, but it had a box I could x out of so it went away on I.E. I don't know why the blue bar is there on Firefox, as I did the update while on I.E.
    == This happened ==
    Every time Firefox opened
    == I updated an application while on Internet Explorer.

    Annette,
    #In the menu bar, at the top of the Firefox window, Go to Tools -> Add-ons -> Extensions.
    # Locate ''each ''of the following extensions by name and click the disable button
    #Restart Firefox as prompted and see if the undesired toolbar has been removed.
    #The extensions to disable are: '''Crawler Toolbar''', '''MP3 Rocket Toolbar''', '''MSN Toolbar''', '''Search Helper Extension'''
    If you don't need some / all of those toolbars, consider leaving them disabled.
    You can probably remove these toolbars permanently from Start -> Control Panel -> Add/Remove Programs.

  • I upgraded to Mountain Lion (MacbookPro). Now when I open ical I get a popup window with a list I had added to Reminders app with the message 'Your calendar couldn't be refreshed' it won't go away-'delete' is greyed out-can't access calendar! Help!

    I upgraded to Mountain Lion (MacbookPro). Now when I open ical I get a popup window with a list I had added to Reminders app with the message 'Your calendar couldn't be refreshed' i--t won't go away-'delete' is greyed out--can't access calendar! Help!

    I upgraded to Mountain Lion (MacbookPro). Now when I open ical I get a popup window with a list I had added to Reminders app with the message 'Your calendar couldn't be refreshed' i--t won't go away-'delete' is greyed out--can't access calendar! Help!

  • HT1527 when I try to download apps in my iphone , i get a spinning circle that won't go away and a icon that is gray and says "waiting". Any ideas how to solve?

    When I try to download apps in my iphone , I get a spinning circle that won't go away and a grey icon that says "waiting" .Any ideas how to fix the problem?

    First go into settings, Itunes and App store,  sign out and then sign in again! (This might not work)

Maybe you are looking for

  • Problem in using the sap script from 1 client to another

    Hi, I am working on a sap script which is developed in the 555 cliet(Quality) but now the error comes change to repository or cross client is not allowed. In order to change the script which i am working on i tried to copy that script in 333 client a

  • Dynamic Lead Columns

    We have a requirement where users need to enter 3 Key figure values for 3 periods against 0MATERIAL.  The layout should show as follows: MaterailKeyFigureMonth1Month2Month3 SKU1----KF125--20----20 SKU1----KF25 USD-5 USD---6 USD SKU1----KF32---2-----2

  • HT4356 AirPrint

    Can I use my Iphone hotspot as a router for Airprint to support printing from my Macbook Pro and Ipad?

  • IPhoto 2 slow to open

    Hello everyone iPhoto 2 takes around 7 minutes to open on my trusty 400MHz Powerbook 15" titanium running 10.3.9. Hasn't always done so, but happens without fail now. I click the icon in the dock then get a spinning disc for about 7 minutes until the

  • Position Control - HR or Finance?

    It is believed that HR should manages the org structure and control the increases/decreases in positions.  Since Finance is managing the Budgets how do the increases, decreases or movement of positions monitored and reflected in the financial budgets