JPopupMenu showing only last JMenuItem

Hello,
I have a strange problem with JPopupMenu - only 1 JMenuItem (last one) is shown in the menu although there are 2 of them there.
Menu is created by following sequence:
JPopupMenu popup = new JPopupMenu;
JMenuItem item1 = new JMenuItem();
item.setText( "ft" );
popup.add( item1 );
JMenuItem item2 = new JMenuItem();
item.setText( "m" );
popup.add( item2 );
Menu is activated (shown) after a button is pressed in the code called from button ActionListener:
// parameter is ActionEvent aEvent
popup.show( ( Component ) aEvent.getSource(), 0, 0 );
popup.pack(); // does not affect the behaviour, if omitted
// dubugging: trying to make sure menu has more than 1 element           
MenuElement[] elems = popup.getSubElements();
for( MenuElement elem: elems )
System.out.println( elem );
The code works, menu appears, but only with last item.
The debug printout shows, that menu has 2 elements:
javax.swing.JMenuItem[,0,0,0x0,layout=java.awt.BorderLayout,alignmentX=0.0,align
mentY=0.0,border=javax.swing.plaf.metal.MetalBorders$MenuItemBorder@3b1f38,flags
=264,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,disable
dSelectedIcon=,margin=javax.swing.plaf.InsetsUIResource[top=2,left=2,bottom=2,ri
ght=2],paintBorder=true,paintFocus=false,pressedIcon=,rolloverEnabled=false,roll
overIcon=,rolloverSelectedIcon=,selectedIcon=,text=ft]
javax.swing.JMenuItem[,1,3,39x20,layout=java.awt.BorderLayout,alignmentX=0.0,ali
gnmentY=0.0,border=javax.swing.plaf.metal.MetalBorders$MenuItemBorder@3b1f38,fla
gs=264,maximumSize=,minimumSize=,preferredSize=,defaultIcon=,disabledIcon=,disab
ledSelectedIcon=,margin=javax.swing.plaf.InsetsUIResource[top=2,left=2,bottom=2,
right=2],paintBorder=true,paintFocus=false,pressedIcon=,rolloverEnabled=false,ro
lloverIcon=,rolloverSelectedIcon=,selectedIcon=,text=m]
Do you have an idea, why just last item is shown ?
When I changed
popup.show( ( Component ) aEvent.getSource(), 0, 0 );
to
popup.show( mainFrame, 0, 0 );
the menu appeared in the new location, but on change of behaviour ( my first idea was, that menu is clipped to the size of button).
Thanks.
Martin

Don't show us bits and pieces of code. Show us a demo program of how you are creating and attempting to show the popup menu. The code you post may not be related to the problem.
Also, don't forget to use the "formatting tags" so the code retains its original formatting.

Similar Messages

  • Hierarchy authorization details show only last level

    Hi,
    I am facing on a hierarchy problem displayed on the Bex: The hierarchy has 9 levels, e.g. the organisation structure of the company from level 1 to level 9.
    I made from the transaction RSSM :
    Authorization from the hierarchy i entered for each level from 1 to 9 :
    Type of authorisation : 1 (subtree below node)
    Hierarchy level       : blank
    Validity period       : blank
    Node variable default value : blank
    I made from the transaction PFCG :
    Created a role for the user with the authorization :
    Sap Business information warehouse - reporting (RSR)
    value : 8055 (company code)
    Unique ID for authorization : level_3
    I need to authorize the user to execute a querry of his level (exemple level 3) and all the level below him (to the 9th level)
    When the query is generated,(the query is using a variable hierarchy ) I get the lowest level displayed and shows only 2 key figures and values.
    Any ideas ?
    You assistance will be appreciated.
    Thong VANNAXAY

    Hi,
    1007372 wrote:
    Hi,
    How to get only the last level in Oracle SQL Hierarchy Query?Depending on your requirements:
    WHERE   CONNECT_BY_ISLEAF  = 1 
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only), and also post the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    If you can show what you want to do using commonly available tables (such as scott.emp, which contains a hierarchy), then you don't need to post any sample data; just the results and the explanation.
    Always say which version of Oracle you're using (e.g., 11.2.0.2.0). This is always important, but especially so with CONNECT BY queries, because every version since Oracle 7 has had significant improvements in this area.
    See the forum FAQ {message:id=9360002}

  • How to show only six values in dropdown box in design studio 1.3

    Hi,
    There was an requirement from our client to show only last six months in the drop down, when actually there is almost past 30 months are coming from the database. The data format also looks similar to "2014007", "2014006:..etc. Any idea to achieve this through loop.?
    Thank You,
    Palani

    Hi Karol,
    I like your idea, but i have difficulties to use it
    i have a datasource DS_2 and i just want to show specific Members of my keyfigures.
    When i fill my dropdown with this code it just gets empty and returns an error. Somehow i have to say if i want to show the Key or Text ?
    i also need this infiormation to be able to compare my elements in the if clause ?!
    Can you help me out ?
    Best regards
    Manfred
    DS_2.getMembers("003N81FHQ23D64UTALOPW7MVN",0).forEach(function(element, index) {
    DROPDOWN_2.addItem(index, element);
    /*  if ((element == value1) || (expression2 == value2)) {
       if_statements
      } else {
       else_statements
    EDIT ....
    I've found the way how to access the keys and values ... i have to define an array and then i am able to access the internal keys and Text.
    Just for others searching ....
    var ArrayMem = DS_2.getMembers("003N81FHQ23D64UTALOPW7MVN",0);
    DROPDOWN_2.addItem("#", "No Filter");
    ArrayMem.forEach(function(element, index) {
      if ((element.text == "Anzahl Sätze") || (element.text == "Gepäckgewicht")) {
       DROPDOWN_2.addItem(element.internalKey, element.internalKey + " - " + element.text);
    This SCN article helped me out: http://scn.sap.com/community/businessobjects-design-studio/blog/2014/09/19/learn-about-arrays-in-design-studio-13
    Best regards
    Manfred

  • Aminated gifs only showing the last frame on the 2nd time of viewing

    I have 2 animated gifs and on pressing a button i am changing between the 2 on te first click the animated gif runs sucessfully and clicking the button again the 2nd animated gif runs sucessfully. However when i go to run the first animated gif again it only shows the last frame and this continues no matter how many times you press the button. Is there any way of getting it to start from the first frame. By the way just in case it makes a difference both the animated gifs run once they do not continously keep going and that is how i want them to be.

    public void mousePressed(MouseEvent e){
         if(corner.contains(e.getX(),e.getY())){
         if(reversed){
              setImageFile(gui.getFrontImage());
                   gui.setComponents(true);
                   reversed = false;
         else{
              setImageFile(gui.getBackImage());
                   gui.setComponents(false);
                   reversed = true;
         repaint();
    public void setImageFile(java.lang.String imageFile) {
         fieldImageFile = imageFile;
    /* Get and download the image for the new postcard background */
    backgroundImage = Toolkit.getDefaultToolkit().getImage( fieldImageFile );
         MediaTracker mt = new MediaTracker( this );
         mt.addImage( backgroundImage, 0 );
         try{     
              mt.waitForID( 0 );          
         catch( InterruptedException ie )
         repaint();
         mt.removeImage(backgroundImage, 0);
    public void paint(Graphics g)
    {     if( backgroundImage != null )
         g.drawImage( backgroundImage, 0, 0, this );
    so basically i press an srea area on the screen and every time i do it alternates between these 2 animated gifs gui.getBackImage() just returns te string of the animated gif file. I've checked to make sure that a new instance of the media tracker is being created each time and it is so i'm not really sure where the problem is!!

  • How do I limit my email to show only the last 50 as in previous versions?

    I updated my phone and now I do not see how to limit my emails to show the last 50 only as I did in previous versions. Anyone no how to do this and to select all for deleting emails?

    Hi Katbat,
    I think I've *almost* found out how to do this.. sign up for "BC Backups". Sync file with your dropbox. Open the backup file "Orders" and it will show the columns below. Maybe you can cross compare it with the BC report to get your other columns?
    We use it to see discount codes / a report on value of invoices where discount codes were used. It's like business catalyst reports on steroids. Hope that helps
    Id
    Order ID
    Order Name
    Workflow Id
    Status Type Id
    Order Type
    Invoice Number
    Invoice Date
    User Id Assigned To
    Shipping Amount
    Shipping Tax Rate
    Shipping Attention
    Shipping Instructions
    Shipping Option Id
    Discount Code Id
    Discount Rate
    Total Order Amount
    Direct Debit Type Id
    Direct Debit Days
    Is Recur
    Next Invoice Date
    End Recur Date
    Cycle Type Id
    Create Date
    Last Update Date
    Deleted
    Shipping Street
    Shipping Street2
    Shipping Suburb
    Shipping State
    Shipping Postcode
    Shipping Country
    Billing Street
    Billing Street2
    Billing Suburb
    Billing State
    Billing Postcode
    Billing Country
    Street
    Street2
    Suburb
    State
    Postcode
    Country
    Payment Method Type Id
    Payment Description
    Amount
    Payment Status Id
    Transaction Number
    Transaction Auth Code
    Payment Date

  • I just uploaded lots of pictures.  They are only showing under last import but not in events.  how do I get them to show up under events?

    I just uploaded lots of pictures.  They are only showing under last import but not in events.  how do I get them to show up under events?

    Read this: http://help.apple.com/iphoto/#pht211dc8fc

  • Firefox 4 on Windows 7, Tools- Options- General- Startup- When FireFox Starts: Show my windows & Tabs from last time .. but on startup permanently shows only Firefox Default Home page

    Settings (Firefox 4 on Windows 7), Tools->Options->General->Startup->When FireFox Starts: Show my windows & Tabs from last time ..
    On startup permanently shows only Firefox Default Home page

    Make sure that you do not use [[Clear Recent History]] to clear the "Browsing History" if Firefox is closed.
    See also:
    * http://kb.mozillazine.org/Session_Restore

  • SAPScript:  why the window only show the LAST line

    Dears,
    In my form, one of the window only show the LAST line of the it.
    I have set the window enough space,  also when  debuging the program , open_form, write_form,
    all of those sy-subrc = 0.
    both static texts and dynamic texts are set  in the window,   but only the last line shown.
    Anyone could help me?
    Thanks a lot.
    Sincerely,
    Julie Lv

    Hi,
    There are several possibilities to resolve your problem.
    You can work with 2 main windows on in1 page.
    With NEW-WINDOW you switch to the next main-window
    How to use it.
    make an item in main window with that /: NEW-WINDOW command
    if you are ready with first loop call a WRITE_FORM with that NEW-WINDOW statement.
    to cojntinue in the other main.
    Other possibility is. (in case there are not ot many lines)
    Use for every line other variable names.
    Fill these in the loop. And after loop WRITE FORM
    eg. (if maximum is 3 lines)
    &VAR1_1& &VAR1_2& &VAR1_3& &VAR1_4&
    &VAR2_1& &VAR2_2& &VAR2_3& &VAR2_4&
    &VAR3_1& &VAR3_2& &VAR3_3& &VAR3_4&
    Hope this helps.
    Gr., Frank

  • Why is my podcast now showing only the last 5 episodes?

    My podcast is now only showing the last 5 episodes for some reason. Even when I suvscribe, I can't get past episodes anymore.
    My podcast itunes address is - https://itunes.apple.com/us/podcast/beginner-internet-business/id432758500
    My feed is - http://feeds.feedburner.com/BIBPodcast
    Jonathan

    Here's the iTunes link as well:
    https://itunes.apple.com/us/podcast/animation-fascination/id528946729?mt=2&ign-m pt=uo%3D4

  • HT4623 help me to troubleshoot my ipad2 there is software update and i updated mine from 5.0 to 6 version but now the screen shows only usb cord arrow up sign then itunes and music logo. it has been like this since last night.what i will do?

    help me to troubleshoot my ipad2 there is software update and i updated mine from 5.0 to 6 version but now the screen shows only usb cord arrow up sign then itunes and music logo. it has been like this since last night.what i will do?i even tried turning it off but it doesnt work too. i only see the apple logo and it comes back to cord image and itune then after 30 secs the screen turns black. help me please.

    The iPad is telling you to connect your iPad to iTunes on your computer so do it. You may have to restore the device.
    Restoring iOS Software.
    http://support.apple.com/kb/ht1414
    You may need this as well.
    Unable to update or restore iPad.
    http://support.apple.com/kb/ht4097

  • I was erase all contect and data after it it showing only apple  logo from last 2 hour i need help

    i was erase all contect and data after it it showing only apple  logo from last 2 hour i need help

    You should reset your iPhone,
    Reset your iPhone by pressing the 'Sleep' and 'Home' button at the same time for about 15 seconds or so. Your iPhone will then go through a reset / reboot procedure and will be ready for use within about a minute.
    Don't worry about doing this as you will not lose data or settings.
    Good luck and do report back.

  • ITunes only shows my last 10 podcasts

    I've been submitting Podcasts to my Cabaret Secrets feed for about a year now but iTunes only shows my last 10 Podcasts. The others don't seem to be there anymore. Any ideas?

    iTunes does not limit the number of episodes shown until you get to 300. If you examine the feed you will probably find that there are only the ten episodes in it. Many podcast creation programs and services limit the number of episodes show in the feed, moving older ones to an archive page and out of the feed once the limit is reached. There is usually a setting to increase this number.
    Please always post the URLs of your iTunes Store page and feed; without them one can make only the most general comments.

  • Show only specific columns

    hello,
    using obiee 11g
    I have a requirement like this
    I have 2 prompts, begin date and close date as prompts,Depending upon the date selected i want to show or hide the column.
    By default i made the prompts to show current date and current_date-365
    And also the column header and the data shows properly for the column.
    My only problem is if i select the date as
    01/01/2011 to 30/07/2011 it should show only 7 months data so should show only 7 columns and hide rest 5 columns.
    Its showing from jan to Dec and I want it to show only jan to july?
    Is this possible is my question?
    Thanks

    Hello Deepak,
    Went through the Article,
    I created a filter report which has 2 columns and 1 row->Start And End Date.
    More info on my req--->
    Actually my data is in column wise and not row wise,i.e. my columns are dynamic,headings are start date as col1 and .....and show start date+12 as the last column.
    I have 12 columns in the main report whose header i am taking from the prompt values because i want the header to be dynamic depending upon the date selected.
    So in that prompt i have 12 variables for each 1 headings.So first variable will have the value like startdate prompt and then next variable will have startdate+1.
    In the column formula for each column i am using a filter function to filter the measure column depending
    the month and year of the table.date
    is equal to
    the month and year of the start date prompt.
    So in the main report if i add a filter based on another request,since i have the data as column, no effect its showing.
    Thanks

  • Can Aperture not be set up to show a "Last Import" smart folder?

    I'm trying to make the transfer from using iPhoto to using Aperture.
    One thing I found really great in iPhoto was the smart folder that was simply set to show the last import, no matter when that import was done - whether it was today, yesterday or 6 months ago.
    The reason I found this so handy was because I set my iPad up in iTunes to only sync the photos from that Last Import smart folder, rather than all my photos.
    That way, every time I synced my iPad, I always had my most recent photos on my iPad, no matter when the pictures were taken.
    Now with Aperture, I cannot see a way to create anything similar. The best I can do is to create a smart folder with photos imported within the last month, let's say.
    But the problem with that is that if I haven't imported any new photos for over a month, then the next time I sync my iPad, then all my photos will no longer be on the iPad.
    If I create a longer timeframe, to let's say 3 months, then I might end up with way too many photos trying to sync across, and that's something I don't want. I could end up with hundreds and hundreds of photos, and I don't have the free space to be able to do this!
    When I used "Last Import" with iPhoto, then I always only had around 50 or 60 photos, because that's just generally how many I usually imported at any one time. Sometimes it was more, sometimes less, but the average worked for me.
    So to sum up: Can Aperture not be set up to show a "Last Import" smart folder, regardless of date?
    Or alternatively, is there any way I could "hack" or "trick" Aperture into doing something like this so that I always have a managable amount of the most recent photos on my iPad?

    Hello Brett,
    that does not seem to be an easy probem as you discovered.
    Some Workarounds:
    You might to use a smart album rule "Import session is" instead of a date range, but that will not be automatic.
    Create a folder "recently added" and keep your recent projects inside that folder; create a smart album at the top level of that folder; move older projects somewhere else.
    Or enable the Photo Stream - that is the current replacement for the "most recently added" album; it will (is supposed to) always show the most recent 1000 images.
    If you are familiar with AppleScript, you can make Aperture run an AppleScript on import (Import Settings) to add your imported image to an album of new images. From time to time remove the older images.
    Sorry, but no really convenient way to do it..
    Regards
    Léonie

  • Show the last published documents in a view for a document library.

    Hello!
    At our company we have a document library with many documents. These documents are evolving and are therefore going from major versions to minor versions to major versions again. To be able to get a good overview of the last "official" versions
    we would need to have a view that shows the last "Approved" versions of each document (if any approved versions exist). This is basically the same as watching the document library from a user that only own reading access and therefore only sees the
    "published" versions.
    In our case this view should be used by people that own editing rights as well to the documents. 
    Is it possible to accomplish this?
    I tried to use the tip from the following site: link 
    The "?IncludeVersions=TRUE"
    did not work though. 

    Hi AndersObserve,
    I understand that you have a document library that you have enabled content approval(if not, enable it) and versioning, then
    you want to create a view to filter major(approved) documents, then you can filter on the ApprovalStatus field. Try to create a new standard view, filter the view when the ApprovalStatus is equal to Approved, then the view will display the published version
    document.
    Best Regards.
    Kelly Chen
    TechNet Community Support

Maybe you are looking for

  • Data template datatrigger error

    Hi I have a data template that I'm currently getting an datatrigger error with when trying to generate the xml data. I believe I have my dataTrigger coded correctly and am unsure how to resolve this problem. Below is the data template code, plsql cod

  • Hardware scan not updating

    SCCM 2012 SP1 CU3 We are going through a Windows 7 deployment at the moment (not alone here I'm sure) and we're finding that some of the clients aren't reporting back their hardware inventory after being re-imaged. Client activity is as follows: Poli

  • Urgent (Oracle 8i late with Jdev)

    When I create a new project with the wizard I have a problem with the connection to my scheme (Oralce 8i late)(Polite is the database of the oracle 8i late). I can connect suceful but, I can't see the tables, the program say me that SQL Error POL-513

  • Editing Link Destinations

    I got a template from Template Moster. I am not very good with Adobe Flash CS4, i can just about edit text, thats it, i have been trying to find where the Links are to edit, by default all the pages are, for example: index.html index-1.html index-2.h

  • Auto select u201CView selection only on requestu201D in selection view screen-MM02

    HI Friends, I want to auto set u201CView selection only on requestu201D in selection view screen before entering into various views (Basic data 1 / Basic data 2 . . .etc) for t.code- MM02 for all users. Please let me know where needs to be set. Thank