GlassPane & JPopupMenu with child menus

I've read the helpful posts on how to get a JPopupMenu to appear over the glasspane and handle mouse events (using setLightWeightPopupEnabled(false)).
However, my JPopupMenu has child components that are JMenus. The JMenus now have the same problem of not responding to mouse events.
How do I get JMenu to be heavyweight (or, is there a better way to do this whole thing)?

FYI. I overcame this by going to a JLayeredPane rather than using the GlassPane.

Similar Messages

  • JPopupMenu with JCheckBoxMenuItmes

    Hi,
    I have a JPopupMenu with JCheckBoxMenuItems and JMenuItems.
    The default behaviour of the JPopupMenu is, that it closes on selection of a MenuItem. This behaviour is not really nice for the CheckBoxMenuItems !
    Does anyone know a workaround?
    Thanks,
    Elke

    I don't have a workaround, sorry. But I think thats not needed too. The behavior you don't seem to like, is consistent with every application I ever used.
    When I click on a menuitem, the only actions I expect is that either the menu closes and a command is executed, or another pop-up menu appears where I make my choice.
    If you had a menu that doesn't close when you select or deselect a CheckBoxMenuItem, how do you close that menu? I think a MenuItem "Close this menu" would not be appreciated by any user. I use CheckBoxes on menus sparingly, and only for actions that generate an immediate visual response. (For instance Grayscale Image vs. Colored Image).
    If you want the user to have more control about options its better you create a small dialog with your choices and an accept/cancel set of buttons.
    Sorry I couldn't help with your initial question.

  • SM Portal display issue while creating incident classification with child items

    Hii,,
    We need to create some incident classification with child items. After creating classification with child items, portal is not showing the classification properly and the page display not showing properly. i.e. showing a block with drop down instead of simple
    drop down as same as for urgency. Please find the snapshot and suggest..
    Regards, Syed Fahad Ali

    The portal flattens those lists, so sadly this is normal behaviour. I would assume it sorts the list according to ordinal which means you may be able to atleast get a list in the correct order. 
    ex. Ordinal in paranthesis
    1. Hardware (1)
    1.1 Printers (3)
    2. Software (2)
    2.1 Windows (4)
    I would expect this list to be flattened into
    Hardware
    Software
    Printers
    Windows
    You see? In order to edit ordinal you would have to edit the list manually in XML. Tons of ressources on how to do that. 
    Cheers,
    Anders Spælling
    Senior Consultant
    Blog:  
    Twitter:   LinkedIn:
    Please remember to 'Propose as answer' if you find a reply helpful

  • Problem with contextual menus after 10.9.3 update

    Hello, since the update to 10.9.3 i am experiencing problems with contextual menus. The problem is more frequent when I use an external screen.
    First problem: I am losing the icons in the top bar of the finder. This happens mostly on external screens.
    Second problem: The arrows indicating submenus upon a right click are lost. This problem is also present when I use the internal screen of my Macbook.
    Sometimes, the icons in the left menu bar of the finder are also lost (mostly Dropbox):
    Is there anything I can do? Is this a known problem?
    My current system:
    Macbook Pro Retina 13" (late 2013)
    2.8 GHz Intel Core i7
    8 Gb Ram
    Intel Iris
    Thanks!

    Please read this whole message before doing anything.
    This procedure is a test, not a solution. Don’t be disappointed when you find that nothing has changed after you complete it.
    Step 1
    The purpose of this step is to determine whether the problem is localized to your user account.
    Enable guest logins* and log in as Guest. Don't use the Safari-only “Guest User” login created by “Find My Mac.”
    While logged in as Guest, you won’t have access to any of your personal files or settings. Applications will behave as if you were running them for the first time. Don’t be alarmed by this; it’s normal. If you need any passwords or other personal data in order to complete the test, memorize, print, or write them down before you begin.
    Test while logged in as Guest. Same problem?
    After testing, log out of the guest account and, in your own account, disable it if you wish. Any files you created in the guest account will be deleted automatically when you log out of it.
    *Note: If you’ve activated “Find My Mac” or FileVault, then you can’t enable the Guest account. The “Guest User” login created by “Find My Mac” is not the same. Create a new account in which to test, and delete it, including its home folder, after testing.
    Step 2
    The purpose of this step is to determine whether the problem is caused by third-party system modifications that load automatically at startup or login, by a peripheral device, by a font conflict, or by corruption of the file system or of certain system caches.
    Disconnect all wired peripherals except those needed for the test, and remove all aftermarket expansion cards, if applicable. Start up in safe mode and log in to the account with the problem. You must hold down the shift key twice: once when you turn on the computer, and again when you log in.
    Note: If FileVault is enabled, or if a firmware password is set, or if the startup volume is a Fusion Drive or a software RAID, you can’t do this. Ask for further instructions.
    Safe mode is much slower to start up and run than normal, with limited graphics performance, and some things won’t work at all, including sound output and Wi-Fi on certain models. The next normal startup may also be somewhat slow.
    The login screen appears even if you usually log in automatically. You must know your login password in order to log in. If you’ve forgotten the password, you will need to reset it before you begin.
    Test while in safe mode. Same problem?
    After testing, restart as usual (not in safe mode) and verify that you still have the problem. Post the results of Steps 1 and 2.

  • Working with Sub Menus

    I've been having some issues with the latest version of iDVD 7.0.1 in working with sub menus. Sometimes I need a sub menu button to click through to 1 full screen still image with the option to hit the "back button" to get to the main menu. How I've been doing this is when in the main menu, I click "add sub menu," then it brings me to a new menu where I can drop something in the drop zone, etc. I bring my full screen static image in and drop it while holding down the option or cntl key, which gets rid of the drop zones and gives me a full screen image. This has worked fine for me in the past. But now I get issues where the "back" button won't work to get back to the main menu. The "back" button simply flashes and won't let me select it once the disc has been burned.
    Am I going about this all wrong? Should I be utilizing the slideshow function instead?
    Thanks in advance!

    Needless to say, it had been a while since I sorted through my hotmail account. Last I looked I had 861 messages and I was starting to feel a bit like Jim Carrey in the movie Bruce Almighty....
    Better late than never.

  • Hierarchial Structure with Child Parameter

    I have a query like this
    select child
    from t
    START WITH parent = 'DIV'
    CONNECT BY PRIOR child= parent
    when i give some parent value its fetching the entire structure from DIV parent.
    i need to restric the rows to some specific leaf. i.e i need a additional parameter called child where i will child value so that it have return only the row from that parent to given child.I dont need other trees.
    For eg DIV is parent for A, B ,C
    A is parent for D,E
    B is parent of F,G,H
    C has no child.
    If i give parameter DIV is parent and G has child i need only this hierarchy. this should return only two rows
    A and G
    Please let me know if i am not clear..
    Pls Help
    VInoth.

    Maybe combining the two hierarchies:
    SQL> with t as (
      2  select 'A' child, 'DIV' parent from dual union all
      3  select 'B' child, 'DIV' parent from dual union all
      4  select 'C' child, 'DIV' parent from dual union all
      5  select 'D' child, 'A' parent from dual union all
      6  select 'E' child, 'A' parent from dual union all
      7  select 'F' child, 'B' parent from dual union all
      8  select 'G' child, 'B' parent from dual union all
      9  select 'H' child, 'B' parent from dual
    10  )
    11  select t1.child, t2.lev
    12  from (select child from t CONNECT BY prior parent=child start with child='G') t1,
    13  (select child, level lev from t CONNECT BY prior child=parent start with parent='DIV') t2
    14  where t1.child=t2.child;
    CHILD                       LEV
    B                             1
    G                             2you can add a condition on LEV that is the level in the top-down hierarchy...
    But I think this could be slow...
    Max

  • JPopupMenu with a JScrollPane

    I have couple of questions
    1. I want to add a JScrollPane to JPopupMenu, doing this would not make the JPopupMenu visible. Is this doable?
    2. this is not related to question 1
    I have a JPOpupMenu with JMenuItems. When I select one of items and the item selected , I append the String to a JTextArea.
    The focus goes back to th beginning of the textArea, I want the focus to be at the end of string that is appended to the textArea.
    thanx

    I might sounding dense here, but I tried all the suggestions, it does not help. The textArea does not even get displayed.
    Also I noticed another thing, the JtextArea is registered with a mouseListener. But when I right click on JTextField , I get teh popup. Which is strange.
    I have attached the code with the above suggestions.
    import java.awt.*;
    import java.awt.event.*;
    import javax.swing.*;
    import javax.swing.event.*;
    import javax.swing.text.*;
    public class TextChooserDemo extends JFrame{
         private JTextField field;
         private JLabel label1;
         private JLabel label2;
         private JPanel aPanel ;
         private JPanel bPanel;
         private JTextArea textArea;
        private TextChooser chooser;
        public TextChooserDemo() {
            initComponents();
            chooser=new TextChooser(this,textArea);
        private void initComponents() {
              field = new JTextField(20);
              label1 = new JLabel("Label1");
              textArea = new JTextArea();
              aPanel = new JPanel();
              aPanel = new JPanel();
              aPanel.setLayout(new BorderLayout());
              aPanel.add(label1, BorderLayout.WEST);
              aPanel.add(field, BorderLayout.CENTER);
              label2 = new JLabel("Label2");
              bPanel = new JPanel();
              bPanel.setLayout(new BorderLayout());
              bPanel.add(label2, BorderLayout.WEST);
              aPanel.add(textArea, BorderLayout.CENTER);
            setTitle("Text-Chooser Demo");
            setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
            getContentPane().add(aPanel,BorderLayout.NORTH );
            getContentPane().add(bPanel,BorderLayout.CENTER);
            //getContentPane().add(aPanel );
            //getContentPane().add(bPanel);
            Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
            setBounds((screenSize.width-500)/2, (screenSize.height-350)/2, 500, 350);
        public static void main(String args[]) {
            new TextChooserDemo().setVisible(true);
    class TextChooser extends JWindow {
        public TextChooser(JFrame parent, JTextArea textArea){
            super(parent);
            this.parent=parent;
            this.textArea=textArea;
            initChooser();
        private void initChooser(){
            textArea.addMouseListener(new MouseAdapter() {
                public void mouseReleased(MouseEvent evt) {
                    textAreaMouseReleased(evt);
            popupScrollPane = new JScrollPane();
            popupList = new JList();
            popupList.setModel(new AbstractListModel() {
                String[] strings = { "java ", "is ", "cool ", "and ", "nice ", "to ", "have ", "with ", "no ", "error ", ".\n" };
                public int getSize() { return strings.length; }
                public Object getElementAt(int i) { return strings; }
    popupList.addListSelectionListener(new ListSelectionListener() {
    public void valueChanged(ListSelectionEvent evt) {
    popupListAction(evt);
    popupScrollPane.setViewportView(popupList);
    getContentPane().add(popupScrollPane);
    private void popupListAction(ListSelectionEvent evt) {
    if (evt.getValueIsAdjusting() == false) {
    textArea.append((String)popupList.getSelectedValue());
    try{
    textArea.setCaretPosition(textArea.getLineEndOffset(textArea.getLineCount()-1));
    }catch(BadLocationException ex){ex.printStackTrace();}
    setVisible(false);
    textArea.requestFocus();
    private void textAreaMouseReleased(MouseEvent evt) {
    Point pnt = evt.getPoint();
    int x = (int)pnt.getX()+(int)parent.getX();
    int y = (int)pnt.getY()+(int)parent.getY()+20;
    if( !contains(x,y) ){
    setVisible(false);
    if(evt.isPopupTrigger()){
    setBounds(x,y,200,100);
    setVisible(true);
    private JFrame parent;
    private JTextArea textArea;
    private JScrollPane popupScrollPane;
    private JList popupList;
    thnx again!!!

  • How to scale the content along with child elements?

    By default I need my application size to be compatible with 1280x800 resolution; and if the application is viewed at a bigger resolution, only the background needs to be stretched, therefore I have to hardcode canvas size and set background in percentage. Till now it is alright, but when the application is viewed at a smaller resolution or with window size scaled down, the application content should also scale along.
    So, any clues on scaling down the content [along with child contents]? mind you, it has background images so must be scaled with proper aspect ratio.
    Thanks for any help.
    Siraj Khan
    [email protected]

    Thank you for the tip... this solves my problem partially. Now I am working on to scale the inner content of canvas --- on resize. Since there are elements like buttons and images, i can not define them in percentage, so i need to first check what exactly is the percentage of reduced canvas, and then accordingly i'll have to apply that percent on the inner elements. Any other better idea? as i see this only as a work around, not a proper solution.
    Anyway thanks again for the help.
    -Siraj

  • Probleme on JPopupMenu with JDialog

    I use JPopupMenu with JDialog. To display the popup, I use a mousePressed in a panel of the dialog:
    public void mousePressed(MouseEvent e) {
    if( e.getClickCount()==1 && e.getModifiers()==MouseEvent.BUTTON3_MASK && ga!=null ) {
         mpopup.show(e.getComponent(),e.getX(), e.getY());
    It works fine, but when a part of the popup is out of the dialog, the popup doesn't display.
    Is it normal?
    Has someone already had this problem?
    I work with jdk1.3.1_01
    Thanks for your help
    Templ

    When you create your popup menu do this :
    mpopup.setLightWeightPopupEnabled(false);
    I hope this helps,
    Denis

  • Could not write frame (communication error with child process failed)

    Hi ---
    Getting this error about 50 % of the time when I try to render ?
    What good is a grading app that is having so much trouble rendering out the results ?
    Any help would be great

    I Would love some help with this as well. I've color corrected and am rendering. I have chosen these settings based on the video files in Premeire.
    It gets all the way to 98% and then says "communication with child process failed"
    I tried unchecking "strip alpha" as suggested above to no avail.
    What is going on? I spent a good deal of time on this and have deadlines and all I want to do is get this graded video back into premeire. Thank you!

  • Sample code snippet needed to provision appinstance with child data in R2

    Gurus,
    I have developed some code to provision an application instance to a user using API but it is not working.
    Can you please provide me some sample code to provision with child data this using API.
    Here are the errors.
    oracle.iam.provisioning.exception.GenericProvisioningException: An error occurred in oracle.iam.provisioning.spi.DOBProvisioningMechanism/provision while provisioning application instance with key 16907 to user with name TESETUSER the cause of error is oracle.iam.provisioning.exception.GenericProvisioningConfigException: Entitlement attribute not marked as key in reconciliation field mapping for UD_ADUSRC.
    at weblogic.rjvm.ResponseImpl.unmarshalReturn(ResponseImpl.java:237)
    at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:348)
    at weblogic.rmi.cluster.ClusterableRemoteRef.invoke(ClusterableRemoteRef.java:259)
    at oracle.iam.provisioning.api.ProvisioningService_p7m7x_ProvisioningServiceRemoteImpl_1036_WLStub.provisionx(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at weblogic.ejb.container.internal.RemoteBusinessIntfProxy.invoke(RemoteBusinessIntfProxy.java:85)
    at $Proxy2.provisionx(Unknown Source)
    at oracle.iam.provisioning.api.ProvisioningServiceDelegate.provision(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at Thor.API.Base.SecurityInvocationHandler$1.run(SecurityInvocationHandler.java:68)
    at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
    at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:120)
    at weblogic.security.Security.runAs(Security.java:41)
    at Thor.API.Security.LoginHandler.weblogicLoginSession.runAs(weblogicLoginSession.java:52)
    at Thor.API.Base.SecurityInvocationHandler.invoke(SecurityInvocationHandler.java:79)
    at $Proxy3.provision(Unknown Source)
    at OIM.provisioning.DirectProvisionApplicationInstance.provisionResource(DirectProvisionApplicationInstance.java:118)
    at OIM.provisioning.DirectProvisionApplicationInstance.main(DirectProvisionApplicationInstance.java:179)
    Caused by: oracle.iam.provisioning.exception.GenericProvisioningException: An error occurred in oracle.iam.provisioning.spi.DOBProvisioningMechanism/provision while provisioning application instance with key 16907 to user with name TESETUSER the cause of error is oracle.iam.provisioning.exception.GenericProvisioningConfigException: Entitlement attribute not marked as key in reconciliation field mapping for UD_ADUSRC.
    at oracle.iam.provisioning.util.ProvisioningUtil.throwGenericProvisioningException(ProvisioningUtil.java:216)
    at oracle.iam.provisioning.spi.DOBProvisioningMechanism.provision(DOBProvisioningMechanism.java:401)
    at oracle.iam.provisioning.impl.ProvisioningServiceImpl$4.process(ProvisioningServiceImpl.java:488)

    I am new to the Windows programming environment (I'm running Windows 7).
    I am looking for sample code that will do the following:
    1.
    12.
    If you expect a useful answer here, you'll have to narrow your thread(s) to one specific
    issue. Posting a (virtually) complete application specification is far too broad and
    comprehensive for any one thread in these forums.
    Pick *one* aspect of this project and describe what problems you're having writing the code.
    Post a new thread for each specific problem.
    As posted, you appear to be hoping to find code already completely written for this project.
    Most sample code illustrates *one* task, not a dozen. If you aren't able or willing to do
    the lion's share of the coding yourself, you may have to consider contracting a developer.
    - Wayne

  • Hello Gurus..... ISSUE with child Table update

    I have an issue with child table update
    I have created a GTC with one parent table and two child tables. I'm able to update the parent table and the values are found in db, but the ISSUE is the child Table values are not updating the db.
    please give me a solution
    regards
    Srikanth

    If you are keeping referential integrity in the database, not in the application, it is easy to find the child and parent tables. Here is a quick and dirty query. You can join this to dba_cons_columns to find out on which columns the referential constraints are defined. This lists all child-parent table including SYS and SYSTEM users. You can run this for specific users of course.
    select cons1.owner child_owner,cons1.table_name child_table,
    cons2.owner parent_owner,cons2.table_name parent_table
    from dba_constraints cons1,dba_constraints cons2
    where cons1.constraint_type='R'
    and cons1.r_constraint_name=cons2.constraint_name;

  • I want to make an iDVD with 9 menus.  Please help.

    I want to make a DVD with 9 menus.  There are 10 movies that will be on the DVD.  Two of the movies
    would just have the title.  Eight of the movies would have multiple chapter markers.  There would be an opening
    menu.  The opening menu would have 3 buttons on it.  One would play a short movie.  The other two would go to separate
    menus.  Each menu would have 4 selections.  One selection would play a movie.  The other 3 selections would go to separate
    menus.  Each final menu would have the play button and scene buttons.
    Any help would sure be appreciated, or if you could steer me to a tutorial or article that would work.  It may be that this is too many
    menus.  In trying to simplify the DVD, I may be making it too complicated.  If I need to I will look to a more powerful DVD creation software.
    I am working on  iDVD11
    Thank you

    I think I have it figured out. 
    Thanks

  • InDesign version with English menus and Middle Eastern production capabilities

    I need a version of InDesign CC that has English menus and Middle Eastern (Arabic & Farsi) book production capabilities. I've spoken with 5 Adobe support techs but I've not yet received a download link.

    Do you have the Creative Cloud app installed? Click on the settings "gear" in the upper-right-hand corner, go to Preferences, choose Apps, and then select "English (الشرق الأوسط)". Then when you download InDesign you'll get the Middle East edtion with English menus and controls for spine-right binding, kashidas, text direction, et cetera.

  • JPopupMenu with multiline JMenuItem ?

    Hi there.
    Is it possible to do something like the subject says, a JPopupMenu with multiline JMenuItem's, without using html? I would like to create a JMenuItem with a MultiLineLabel as the argument instead of a String. I'm trying to do this because if i add the MultiLineLabel directly to the JPopupMenu, it displays as i want, but i loose the behaviour inherent to a JMenuItem, the highlighted index, etc.. Any help would be appreciated.

    Here's a workaround:
    JPopupMenu popupMenu = new JPopupMenu();
    // Workaround to stop first menu item being selected
    JMenuItem dummyItem = popupMenu.add(new JMenuItem());
    dummyItem.setPreferredSize(new Dimension(0, 0));
    popupMenu.add("Item 1");
    popupMenu.add("Item 2");
    popupMenu.add("Item 3");
    It works for me!

Maybe you are looking for

  • Dynamic Number of Column in a table

    Hi guys, I have a requirement that needs dynamic number of column in a tale. It is possible to do this in Adobe forms. Thanks, Chirantan

  • Project Server 2010 report issue

    Hi all, I am having a problem where our users are only able to produce a summary report. Upon printing a report we are usually presented with a menu with many options prior to printing. The farm is fully up to date and no changes have been made admin

  • Safari reloads the page when I move the pointer?

    Currently running 10.6.8 with Safari 5.1.7 on my 1.83 Macbook Pro... Several weeks ago I noticed an odd bit of behavior from Safari. If I click the back button (or hot-key back one page), and then move the pointer using my trackpad, the displayed pag

  • Set selected text as variable (CS3 with JS)

    How can I set a piece of selected text as a string variable? I'm running InDesign with InCopy CS3 on a Windows XP computer.

  • I have not been able to activate spell checker in my new installation, help.

    I have installed the newest available version of Thunderbird by automatic download. I cannot activate the spell checker. All the apparent steps have been completed; however, there are no flags as I write and no response when I ask for check at the en