JPopupMenu bug 4245587

This bug details a problem where the popup menus appear 'behind' the windows taskbar if the popup appears at a place where it may be obscured. Various work-arounds have been posted and I have one that works (just). My issue with this is more general. The bug reports that the problem is fixed and the bug has been closed (although no date is given for when this happened). The release fixed is detailed as 'Hopper'. My question is this... How do we now what public release (if any) this fix appears or will appear in. It seems to me that the process is a bit flawed if developers have no way of knowing if fixes have been made. Comments, suggestion (yes even flames if you think I have missed the point) welcome.
Cheers,
Paul Brickell

What version of the JDK/JRE are you using when the problem occurs. I'm pretty sure that this was a bug fixed in JDK1.3. If you're stuck with an older version of Swing Tim Endres wrote some GPLed code to get around the problem. Take a look here http://www.gjt.org/servlets/JCVSlet/show/ice/com/ice/util/JFCUtilities.java/1.1
Col

Similar Messages

  • JPopupMenu bug...

    I have a JFrame with a JPopupMenu on a right mouse click. At the bottom of the menu, there is an extra item that appears to be just outside the menu's border. The text is: "Java Applet Window".
    Our webserver is tomcat and the IDE is JBuilder version 4.0.152.0. When running from the IDE, the problem is not present. It's not showing up anywhere else within the product either.
    Any thoughts on how to get rid of it?

    What version of the JDK/JRE are you using when the problem occurs. I'm pretty sure that this was a bug fixed in JDK1.3. If you're stuck with an older version of Swing Tim Endres wrote some GPLed code to get around the problem. Take a look here http://www.gjt.org/servlets/JCVSlet/show/ice/com/ice/util/JFCUtilities.java/1.1
    Col

  • ToolTip/JPopupMenu bug?

    The popup menu and tooltips for the menu items in the popup menu in my program had been working fine until I added a glassPane. Then I noticed that sometimes the popup menu is drawn below the glasspane and doesn't respond to the cursor moving over its menu items.
    So I disabled its option to use a lightwight component.
    Now, the popup menu is always drawn on top of glasspane and responds.
    But . . . now
    . . . sometimes, tooltips are drawn behind the popup menu!
    Is there any simple fix for this problem?

    The problem is inside the PopupFactory :
        private int getPopupType(Component owner, Component contents,
                                 int ownerX, int ownerY) {
            int popupType = getPopupType();
         if (owner == null || invokerInHeavyWeightPopup(owner)) {
             popupType = HEAVY_WEIGHT_POPUP;
            else if (popupType == LIGHT_WEIGHT_POPUP &&
                     !(contents instanceof JToolTip) &&
                     !(contents instanceof JPopupMenu)) {
                popupType = MEDIUM_WEIGHT_POPUP;
         return popupType;
        }The weight of the ToolTip popup is determined by its parent -- in your case, the parent is a menuitem which is light-weight regardless of how you set the menuitem's owner (JMenu?). If you don't want to write your own ToolTipManager, you'll have to find a way to set the weight of the JMenuItems!
    ;o)
    V.V.

  • Oracle.jdeveloper.cm.ds.db.ValidationException

    i'm using JDev 10.1.3.0.2.223 and i get the this message at import offline objects from Database:
    oracle.jdeveloper.cm.ds.db.ValidationException: PERIOADE_CONT_ISTORIC.DOC: String is too long
         at oracle.jdeveloper.offlinedb.validators.TableValidator.validateTable(TableValidator.java:119)
         at oracle.jdeveloper.offlinedb.validators.TableValidator.validateObject(TableValidator.java:64)
         at oracle.jdeveloper.cm.ds.db.AbstractDBObjectProvider.validateObject(AbstractDBObjectProvider.java:729)
         at oracle.jdeveloper.offlinedb.OfflineDBObjectProvider.createObjectImpl(OfflineDBObjectProvider.java:647)
         at oracle.jdeveloper.offlinedb.OfflineDBObjectProvider.createObjects(OfflineDBObjectProvider.java:770)
         at oracle.jdeveloper.offlinedb.handler.AbstractTransferHandler.run(AbstractTransferHandler.java:399)
         at oracle.ide.dialogs.ProgressBar.run(ProgressBar.java:526)
         at java.lang.Thread.run(Thread.java:534)

    Hi Romeo,
    Thank you for sending me your Table definitions. You have found a bug, which I have logged as bug 4245587.
    This should be fixed for 10.1.3 Production.
    The problem is with the columns that have a default value set to NULL, we are currently treating this incorrectly.
    Unfortunately the only workaround in the meantime would be to alter your tables in the database so that the default value is set as 'DEFAULT (NULL)' rather than 'DEFAULT NULL' but I doubt this is a viable option.
    Thanks again for reporting this bug.
    Lisa Sherriff
    JDev QA

  • 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.

  • JPopupMenu - Problem with Handling ESC character.

    As per the Javadoc, it says ESC is the key for retracting the PopupMenu. But it is not retracting whenever we press ESC.
    Is this a bug?
    If it is not a bug, how do i retract the popup menu when the Esc is pressed.
    Thanks,
    -Shenbugs

    I also have my JDialogs set up to close when ESC is pressed, by overriding the createRootPane() method:  protected JRootPane createRootPane()
        closeDialogAction = new CloseDialogAction();
        JRootPane rootPane = new JRootPane();
        KeyStroke stroke = KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0);
        rootPane.registerKeyboardAction(closeDialogAction, stroke,
            JComponent.WHEN_IN_FOCUSED_WINDOW);
        return rootPane;
      }I tried adding a menubar to one of my dialogs (which I had never done before), and I saw the same problem as you: if I pressed escape when the menu was open, the whole dialog disappeared. But if I comment out the method above and recompile, the menubar works as it should.
    The problem is that JPopupMenu's InputMap uses a WHEN_IN_FOCUSED_WINDOW binding, which appears to be the binding of last resort (I tried the above with a WHEN_ANCESTOR_OF_FOCUSED_COMPONENT binding, with the same results). So, while we would like ESC to be interpreted as "if a menu is open, close it; otherwise close the dialog", that doesn't seem to be possible.
    In that dialog's RootPane i added a InputMap for "ESC"
    key to map that to WindowClosingEvent. And while
    running, if the popupMenu is shown, and Esc is pressed
    the Dialog is closed. And if i remove that ActionMap,
    popupMenu still remains visible though i press ESC.You say you removed the ActionMap, but did you remove the InputMap as well? If not, your RootPane is probably still consuming the ESC-key event.

  • Flickerring Problem With JPopUpMenu

    Hello Friends,
    In my application made in Java i show a JPopUpmenu on a JINternalFrame in a DekstopPane which is further kept in JFrame. The contents of the PopUpMenu may vary as according to the various places where the mouse is clicked. Sometimes when the mouse may be clicked on the lower part of the applciation some part of the PopUpmenu goes out of the visible area of the screen. For that after showing the popupmenu i get the height of the popup menu and shift it accordingly so that its length doesnt go out of the viewable area. It works fine but the problem is that it gives a little flicker. And alsoo of i try to set the position before showing the pop up menu i am not able to do so because before calling the show() method of the popUPmenu i am getting the height and width of the pop up menu. Please help me out.
    Any type of pointers and links would be highly helpful.
    Thanks in Advance
    Vikram.

    HI!
    it didnt work
    here is the code snippet
              popupClass.pack();
              popupClass.requestFocus();          
              java.lang.System.out.println(" HEIGHTTTTT "+popupClass.getHeight());
              int Height = (int)Toolkit.getDefaultToolkit().getScreenSize().getHeight();
              int Width = (int)Toolkit.getDefaultToolkit().getScreenSize().getHeight();
              if ((DiagramInternalPane)getParent() != null)
                   if(((mouseY+popupClass.getHeight()-((DiagramInternalPane)getParent()).GetParent().scrollpane.getVerticalScrollBar().getValue()+AsterixApplet.getFrame().getY()) > Height-160) && ((mouseX+popupClass.getWidth()-((DiagramInternalPane)getParent()).GetParent().scrollpane.getHorizontalScrollBar().getValue()+AsterixApplet.getFrame().getX()) > Width-20))
                        popupClass.show(comp,mouseX-popupClass.getWidth(), mouseY-popupClass.getHeight());
                   else
                        if((mouseY+popupClass.getHeight()-((DiagramInternalPane)getParent()).GetParent().scrollpane.getVerticalScrollBar().getValue()+AsterixApplet.getFrame().getY()) > Height-160)
                             popupClass.show(comp,mouseX, mouseY-popupClass.getHeight());
                        if((mouseX+popupClass.getWidth()-((DiagramInternalPane)getParent()).GetParent().scrollpane.getHorizontalScrollBar().getValue()+AsterixApplet.getFrame().getX()) > Width-20)
                             popupClass.show(comp,mouseX-popupClass.getWidth(), mouseY);     
              if(getParent() != null)     
                   getParent().repaint();
              popupClass.show(comp,mouseX, mouseY);                
              java.lang.System.out.println(" HEIGHTTTTT AAAAAAAAAAAAAAAA"+popupClass.getHeight());
    Before caluing the show() , method i am getting the height as 0 and only after calling the show method i am getting the actual height. Is it a java bug or something ?
    Anyway thanks for all ur help

  • Focus problem in 1.4_2 after JPopupMenu show

    Hi, there:
    I have an application, with a JTextField when that textfield gained focus, a popup menu is shown, and when it lost focus, the popup menu is hidden.
    My focus listener class is listed below, where popup is JPopupMenu, and function displayPopup() is just to call show() in JPopupMenu:
         class MyFocusListener extends FocusAdapter {
              public void focusGained(FocusEvent e) {
                   System.out.println("focus gained.............");
                   displayPopup();
              public void focusLost(FocusEvent e) {
                   System.out.println("focus lost ..............");
                   popup.setVisible(false);
         }Everything works fine in jdk 1.3 version. In jdk1.4_2 version, I met following issues:
    1. whenever the text field gained the focus, the application keeps calling "focusGained()", and "focusLost()" functions endlessly (it seems the system keeps sending those focus events endlessly);
    2. if I removed that "popup.setVisible(false)" in focusLost, then, it seems no other component can gain the focus anylonger.
    So, very appreciated if anyone can give me some help, is that a bug in 1.4.2 or is there any way to work around?
    Thanks a lot
    David

    The reason is that in 1.4.2 each time you show a popup over a text field, it trades focus back and fourth with the text field a few times (2-3 times) before it is fully shown.
    That means you gain focus... diaplay a popup -> which fires 2-3 more gain/lost focus -> and on each of those, you show a popup -> infinite loop.
    Here is the overall tip: Don't try to show/hide popups based on foucs events. Make them controlled by something else, like clicking events.
    If you must do this, you can use a timer to avoid the issue. Just make sure you are using showPopup(Component,x,y) in your displayPopup() method!
    class MyFocusListener extends FocusAdapter {
      long lastTimeGainedFocus = -1L;
      public void focusGained(FocusEvent e) {
        long currentTime = System.getCurrentTimeMilliseconds();
        if(lastTimeGainedFocus == -1L || currentTime - lastTimeGainedFocus > 100) {
          displayPopup();
        lastTimeGainedFocus = currentTime;
      public void focusLost(FocusEvent e) {
         // do nothing here... popup should hide itself
    }

  • Motif L&F cancel JPopupMenu missing listener

    Hi all,
    I have a JButton and a JPopupMenu
    I would like to show JPopupMenu when JButton is pressed
    popupMenu.addPopupMenuListener(new PopupMenuListener() {
    public void popupMenuWillBecomeVisible(PopupMenuEvent event) {
    System.out.println("Visible");
    public void popupMenuWillBecomeInvisible(PopupMenuEvent event) {
    System.out.println("Invisible");
    public void popupMenuCanceled(PopupMenuEvent event) {
    System.out.println("Canceled");
    button.addMouseListener(new MouseAdapter(){
    public void mousePressed(MouseEvent event) {
    System.out.println("Pressed");
    if (match some condition) {
    popupMenu.show(button, 0, button.getHeight());
    When I haven't change the L&F
    The output is correct:
    // First time of pressing the button
    Pressed
    Visible// Second time of pressing the button
    Canceled
    Invisible
    Pressed
    Visible ...The problem is when I using Motif L&F
    The "Pressed" is missing and need to perform one more click
    // First time of pressing the button
    Pressed
    Visible// Second time of pressing the button
    Canceled
    Invisible// Third time of pressing the button
    Pressed
    Visible ...My program will change L&F at runtime and I would like to provide same behaviour of the popup.
    Could anyone tell me how to provide same behaviour even at Motif L&F?
    Thank you very much
    Roy

    I don't think that changing L&F might change behavior of firing events.
    Maybe the problem is somewhere in your code...
    Maybe you set different values of some variables before changing L&F, then you change L&F and then it doesn't work as you want. It seems to you that the problem is in L&F, but I don't think so.
    Take a look at your code again and try to find a bug there, not in L&F.

  • JPopupMenu SelectionManager error!

    The following little test program results in both Exception, and or VM crash!!!!
    import javax.swing.*;
    import java.awt.event.*;
    class Pop{
    JDialog m_dialog;
    JPopupMenu m_menu;
    public static void main(String[] args){
    new Pop();
    public Pop(){
    m_dialog = new JDialog();
    m_dialog.addMouseListener(new RightMouseListener());
    m_dialog.setSize(200,200);
    m_menu = new JPopupMenu("Menu");
    JMenuItem item1 = new JMenuItem("1");
    m_menu.add(item1);
    JMenuItem item2 = new JMenuItem("2");
    m_menu.add(item2);
    JMenu item3 = new JMenu("3");
    m_menu.add(item3);
    JMenuItem item3_1 = new JMenuItem("3.1");
    item3.add(item3_1);
    m_dialog.setVisible(true);
    private class RightMouseListener extends MouseAdapter{
    public void mouseClicked(MouseEvent e){
    if(e.getModifiers()==InputEvent.BUTTON3_MASK){
    m_menu.show(m_dialog, e.getX(), e.getY());
    Brings up a little dialog. Press right mouse button, and a little popup apears.
    Click and hold on the first menu item, drag the mouse FAST out of the popup menu, (it should be deselected) and move the mouse pointer back into the popup menu, all the while holding down the mouse button.
    This should result in a trace:
    java.lang.ArrayIndexOutOfBoundsException: 1073741823
    at javax.swing.MenuSelectionManager.processMouseEvent(MenuSelectionManager.java:238, Compiled Code)
    at javax.swing.plaf.basic.BasicMenuItemUI$MouseInputHandler.mouseDragged(BasicMenuItemUI.java:924, Compiled Code)
    at java.awt.Component.processMouseMotionEvent(Component.java:3759, Compiled Code)
    at javax.swing.JComponent.processMouseMotionEvent(JComponent.java:2377, Compiled Code)
    at java.awt.Component.processEvent(Component.java:3548, Compiled Code)
    at java.awt.Container.processEvent(Container.java:1165, Compiled Code)
    at java.awt.Component.dispatchEventImpl(Component.java:2593, Compiled Code)
    at java.awt.Container.dispatchEventImpl(Container.java:1214, Compiled Code)
    at java.awt.Component.dispatchEvent(Component.java:2497, Compiled Code)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:2452, Compiled Code)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:2206, Compiled Code)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2126, Compiled Code)
    at java.awt.Container.dispatchEventImpl(Container.java:1201, Compiled Code)
    at java.awt.Window.dispatchEventImpl(Window.java:912, Compiled Code)
    at java.awt.Component.dispatchEvent(Component.java:2497, Compiled Code)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:333, Compiled Code)
    at java.awt.EventDispatchThread.pumpOneEvent(EventDispatchThread.java:103, Compiled Code)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93, Compiled Code)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:84, Compiled Code)
    Any idea why? Is this a bug in java? or am I doing something wrong?
    Now try the next issue.
    Right click to bring up the popup menu. Move the mouse down to menuitem #3, click and hold on it, and drag the mouse fast to the right, straight past item 3.1 and out of the menu. (menu item 3.1 should not be selected.) Now move the mouse straight left back to menu item #3. Observe the whole VM going down with a big trace, and core dump.
    Again I ask, am I doing something wrong? Or is it a bug?

    Ouch!
    Looks like Sun will have to give you the Dukes on this one. I sugget you file a bug report in Bugs Parade because it sure looks like one...and feels like one. But Sun may shrug it off by saying that menus are not meant to be used the way you're using (or abusing) it!
    V.V.

  • JPopupMenu won't die

    Hi,
    I'm using a JPopupMenu on a JList and I'm experiencing an odd problem.
    The menu never actually closes itself under a certain circumstance.
    Say for instance you invoke the popup menu. If you click outside the frame, the menu closes fine. However, if you minimize the frame while the popup menu is displayed, things get weird when you restore it. The menu is still there, but in the form of a solid gray box. All lettering is gone and no highlighting occurs if I move the cursor over it. I have to invoke the popup menu again with a right click if I want the thing to actually disappear.
    I have dug through the forums in an attempt to find a solution. I didn't find anything that addressed my specific problem, but found things that might apply. None have worked. I have tried the following:
    popupMenu.setVisible(false);
    MenuSelectionManager.defaultManager().clearSelectedPath();
    remove(popupMenu);
    Is this a bug, or am I doing something incorrectly?
    Thanks for your help.

    Thank you for your reply. I tried your suggestion, but got the same results. I have coded up a demo program that will reproduce the problem. In addition, those who are interested can (for now) view screen caps of this issue at http://marble.sru.edu/~kjl4608/jpopupmenu.html
    Thanks for your help
    Demo - test.java:import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    public class test extends JFrame
       private Container container;
       private JPopupMenu popupMenu;
       private DefaultListModel listModel;
       private JList list;
       public test()
          super("DEMO");
          setSize(100,210);
          container=getContentPane();
          container.setLayout(new BorderLayout());
          listModel=new DefaultListModel();
          doList();
          createPopupMenu();
       public static void main(String[] args)
          test frame=new test();
          frame.show();
       private void createPopupMenu()
          popupMenu=new JPopupMenu();
          for(int i=1;i<5;i++)
             popupMenu.add(new JMenuItem("Choice "+i));
          MouseListener popupListener=new popupListener();
          list.addMouseListener(popupListener);
       private void doList()
          for(int i=1;i<=10;i++)
             listModel.addElement("Item"+i);
          list=new JList(listModel);
          container.add(list,BorderLayout.CENTER);
       //class is nested
       private class popupListener extends MouseAdapter
          public void mousePressed(MouseEvent e)
          {  maybeShowPopup(e);  }
          public void mouseReleased(MouseEvent e)
          {  maybeShowPopup(e); }
          private void maybeShowPopup(MouseEvent e)
             if(e.isPopupTrigger())
                popupMenu.show(e.getComponent(),e.getX(),e.getY());
                int row=list.locationToIndex(e.getPoint());
             list.setSelectedIndex(row);
    }

  • Spawning my own JPopupMenu breaks every single JComboBox in the application

    That's pretty much it.
    I have determined the problem is in no way caused by the contents of the popup menu, but rather the popup menu itself. I have a popup menu which contains only a button which does nothing (I've tried this same thing with just a checkbox, just a radio box, just a text widget...same thing happens). If I bring up the popup and then hide it right away, everything else works fine. If I bring up the popup and click the button, every single combo box in the application (there are dozens) is suddenly in this weird state where even though you can bring up their list popups, selecting items there won't change the contents of the text portion of the widget and in fact an action listener won't even report that an event has taken place.
    When the CBs are in this state, you can use the keyboard to select items. You can also click and HOLD the mouse button and release on your selection and that will properly select the item, but clicking to select list items doesn't work.
    Somehow, the JPopupMenus are swallowing all the mouse pressed events for any other popupmenus in the system. Sounds like a REALLY low level java bug to me...
    OS: Win XP, Win 2000, Win ME, Solaris, FreeBSD, Linux.
    JVMS: Pretty much all the ones you can run on those platforms.
    - Joe

    Of course it's been a while since the original poster brought up this problem, but I was just having this same issue. It had nothing to do with mixing light-weight and heavy-weight components though.
    In my case, I was using a JPopupMenu with some buttons in it as a sort of toolbar flyout, and whenever you would click one of the buttons, all combo boxes in the application would cease to allow simple mouse selection of items in the list. This behavior is evidently related to bug #4492892 and supposedly only applies to the Windows look and feel.
    I think I've found a reasonable work-around. Setting all of the components in the popup menu to be non-focusable (ie. button.setFocusable(false); ) seems to do the trick. Just hoping others might benefit from this solution. Cheers.

  • Netbeans and JPopupMenu

    Im having a problem creating a JPopupMenu,
    Im using the netbeans GUI builder, I've added the popup menu to the Jframe, and can get it to display itself when right clicked, however i cannot get it to hold any components.
    I tried adding a menu item to it, first by dragging and dropping, which did not work, then by right clicking and adding from pallete, which did work.
    However, the menu item is not diplayed.
    I tried adding various other containers too, but they are not displayed either, any ideas what im doing wrong?
    Thanks,
    James

    Yes quite, netbeans is absolutley fine, frankly, the java website suggests using it for gridbag... Some people just like to feel 1337.
    Curiously its working now, kinda.
    There seems to be a bug of somesort that causes the palette to empty, at which point i have to recreate the project and it comes back, since then however, the popupmenu seems to work, although the offset is a bit wonky
    jPopupMenu1.setLocation(evt.getX(), evt.getY());
                jPopupMenu1.setEnabled(true);
                jPopupMenu1.setVisible(true); that should put the menu where the mouse was at the time, however it seems to be off slightly, any ideas why?

  • Problem with key mnemonics in JPopupMenu

    Hello everyone...
    Since mnemonics do not work in a popup menu using Java sdk 1.3 (due to a bug), i am currently trying to implement this fuctionality myself. However i have a few problems...
    Please consider the following chunk of code:
    textAreaOut = new JTextArea(6, 0)
         protected void processKeyEvent(KeyEvent event)
    if (((event.getKeyChar() == 'T') || (event.getKeyChar() == 't')) &&
                        (textAreaOutPop.isVisible() == true) && (cutItem.isEnabled() == true))
                             if (event.getID() == KeyEvent.KEY_PRESSED)
                                  System.out.println("Cut");
                                  cutItem.doClick();
                                  textAreaOutPop.setVisible(false);
                             else event.consume();
                        else super.processKeyEvent(event);
    What i am trying to do is to get a keyEvent when the popup menu is visible and the menuItem is enabled. I put that in a proccessKeyEvent in order to override the typing of mnemonics inside the JTextArea.
    Unfortunately i am unable to make this to work, as there is a character typed into the textArea after i press the mnemonic (although the mnemonic now works). Since the proccessKeyEvent captures both KEY_PRESSED and KEY_RELEASED i added an extra if statement but that does not seem to solve the problem.
    Could please someone tell me whats wrong with my code sample? is there any better way to implement mnemonics in a JPopupMenu?
    Thanks for your time
    John

    I found a solution myself... Using the following code i make the mnemonics to work on the JPopupMenu in jdk 1.3
    textAreaOut = new JTextArea(6, 0)
                   protected void processKeyEvent(KeyEvent event)
                        if (event.isControlDown() == true)
                        menuBar.requestFocus();
                        else if (firePopupMenuItem('U', 'u', textAreaOutPop, undoItem1, event) == true);
                        else if (firePopupMenuItem('T', 't', textAreaOutPop, cutItem, event) == true);
                        else if (firePopupMenuItem('C', 'c', textAreaOutPop, copyItem1, event) == true);
                        else if (firePopupMenuItem('P', 'p', textAreaOutPop, pasteItem, event) == true);
                        else if (firePopupMenuItem('D', 'd', textAreaOutPop, deleteItem1, event) == true);
                        else if (firePopupMenuItem('A', 'a', textAreaOutPop, selectAllItem1, event) == true);
                        else if (firePopupMenuItem('S', 's', textAreaOutPop, sendItem, event) == true);
                        else if (textAreaOutPop.isVisible() == true)
                        event.consume();
                        else super.processKeyEvent(event);
    and the firePopupMenuItem mehtod...
    private boolean firePopupMenuItem(char mnemonic1, char mnemonic2, JPopupMenu puMenu,
         JMenuItem puMenuItem, KeyEvent ke)
              if (((ke.getKeyChar() == mnemonic1) || (ke.getKeyChar() == mnemonic2)) &&
              (puMenu.isVisible() == true) && (puMenuItem.isEnabled() == true))
                   //Testing
                   System.out.println("firePopupMenuItem");
                   if (ke.getID() == ke.KEY_PRESSED)
                   puMenuItem.doClick();
                   else puMenu.setVisible(false);
                   return true;
              return false;
    However, there is a small problem...
    When i use a mnemonic the event is executed and the JPopupMenu closes (which is fine) however when the popup menu is closed if i click at exactly the same point of where i clicked to open it the mouse event will not trigger and i have to do 2 clicks in order to open again the popup menu again. This is not happening if the mouse click is in different location (i.e. the popup menu opens with only 1 mouse click)...
    Anyone knows why?
    Thanks,
    John

  • JPopupMenu not disappearing in Mac OS 10.6

    Hello, I am experiencing a problem with a JPopupMenu on Mac 10.6, once the menu is active a switch in the active application doesn't make it disappear it is shown above the other active windows, the strange thing is that this behavior is particular on Mac 10.6. On Windows and on Mac 10.5 it works completely fine.
    Greetings
    Jose Luis Vega

    Thanks Luca, the problem is that the listeners are not triggered while another aplication is active the event received was when the popup is active and then nothing. Look the issue was shown on popus that are triggered by a right click, while the java application is not active so the popup is shown 'above' other applications which is a normal mac behavior the problem is that once the popup is there you can turn to the other applicatios and the popup remains open and above everithing on the screen. I believe is a java implementation bug on mac but I don't know how to fix it because as I said no events are triggered from the menu or the parent components.

Maybe you are looking for

  • Import failed. Unhandled Exception in Import Manager

    I'm just starting with MDM (5.5 SP1) and have created my first Import but keep getting an "Import failed. Unhandled Exception. RC: 0x82030100" when I Execute Import. I'm not sure where to look to determine the cause. Any suggstions?

  • HR Professional Landing Page not appearing

    Hi, We have three system : 1. ECC Backend System 2. Separate Gateway System 3. Web Dispatcher 1. Backend System : Activate all the services as mentioned in various forumns and HR Renewal Administrative Guide. 2. Gateway : Activate OData Services in G

  • Change of Profile email

    Hi All, I would like to change the profile email such that I receive all the notifications from SCN. But I was unable to find the same in the profile settings. Can anyone help me to change the ID? Thanks in advance. Regards, Narender.

  • How to change the layout of the desktop before you login as a User into iPS.

    I am trying to change the layout of the anonymous user desktop. I know how to change the layout after i login as a User. All the thin channels except one get lined up in the first column of a thin-thick-thin layout. How to change that? Any help is gr

  • Error msg: Software to decode not on system

    I am working on an Encore project. I created the project, imported audio/video to a timeline, saved it and closed it. I'm now attempting to reopen it, and I get this error msg: "The software that's used to decode the media is not available on this sy