How to know the point where one menu popUp is showed ?

hi,
I need know the point where one popUp menu is showed, but I have problems to do it....
I can install actionListener for method actionPerformed of class AbstractAction but the event I get does not able to say the point...
In the documentation, I read it is possible install a listener for the mouse and select the popUpMenu with the condition
"if (e.isPopupTrigger())"
but it is not confortable to do it and in that case it is not easy too to manage the choice for the item selected...
Some advice please ?
I write down the code I use...
thank you to have one answer..
regards tonyMrsangelo
import java.awt.AWTEvent;
import java.awt.event.*;
import javax.swing.*;
enum OpzPopMenu
{NuovoAppuntamento, CancellaAppuntamento, SpostaAppuntamento};
public class MenuPopUpTestOne {
    public static void main(String[] args) {
        MenuFrameXmenuTestOne frame = new MenuFrameXmenuTestOne();
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setVisible(true);
A frame with a sample menu bar.
class MenuFrameXmenuTestOne extends JFrame {
    JPopupMenu popupMenu;
    public static final int DEFAULT_WIDTH = 300;
    public static final int DEFAULT_HEIGHT = 200;
    public MenuFrameXmenuTestOne() {  // costruttore
        setTitle("MenuTest");
        setSize(DEFAULT_WIDTH, DEFAULT_HEIGHT);
        popupMenu = new JPopupMenu();
        Action nuovo = new PopupMunuAction("nuovo");
        Action sposta = new PopupMunuAction("sposta");
        Action cancella = new PopupMunuAction("cancella");
        JPanel jp = new JPanel();
        add(jp);
        // item1
        JMenuItem item1 = new JMenuItem(OpzPopMenu.NuovoAppuntamento.toString());
        item1.addActionListener(nuovo);
        popupMenu.add(item1);
        // item2
        JMenuItem item2 = new JMenuItem(OpzPopMenu.SpostaAppuntamento.toString());
        item2.addActionListener(sposta);
        popupMenu.add(item2);
        //item3
        JMenuItem item3 = new JMenuItem(OpzPopMenu.CancellaAppuntamento.toString());
        item3.addActionListener(cancella);
        popupMenu.add(item3);
        jp.setComponentPopupMenu(popupMenu);
        enableEvents(AWTEvent.MOUSE_EVENT_MASK);
    // aggiungere il popupMenu FINE   -----------------
    } // costruttore
* Serve per gestire il menu popUp
class PopupMunuAction extends AbstractAction {
//    String itemOne = "nuovo";
//    String itemTwo = "cancella";
//    String itemTree = "sposta";
    public PopupMunuAction(String nome) {
        super(nome);
    public void actionPerformed(ActionEvent e) {
        String command = e.getActionCommand();
        if (command.compareTo(OpzPopMenu.NuovoAppuntamento.toString()) == 0) {
            JOptionPane.showMessageDialog(null, "NUOVO  one");
        if (command.compareTo(OpzPopMenu.SpostaAppuntamento.toString()) == 0) {
            JOptionPane.showMessageDialog(null, "SPOSTA  one");
        if (command.compareTo(OpzPopMenu.CancellaAppuntamento.toString()) == 0) {
            JOptionPane.showMessageDialog(null, "CANCELLA  one");
} // inner class PopupAction

tonyMrsangelo wrote:
I need know the point where one popUp menu is showed, but I have problems to do it....Do you mean where the JPanel was clicked, or where the pop up appears on the screen.
If you mean where the panel was clicked, then it's as simple as adding this to your program:
        jp.addMouseListener(new MouseAdapter()
            @Override
            public void mousePressed(MouseEvent e)
                if (e.getButton() == MouseEvent.BUTTON3) // if right clicked
                    // do whatever in here with the e.getX() and e.getY() results
                    System.out.println("[" + e.getX() + ", " + e.getY() + "]");                   
        });

Similar Messages

  • HT3939 how to know the carrier for iphone 5 if its showing activation failed please insert a sim card

    how to know the carrier of iphone 5 if its showing activation failed please insert a sim card and i don't know what sim card goes in it and if it is cdma or gsm.
    i stuck on this step. i can't go further it just shows imei and meid number but iccid is displayed unknown. please help me to move further. thank u.

    contact apple.

  • How to know the dir where my jar program is stored

    I write a swing editor text files.
    I make the jar of my program: Editor.jar
    Then with jsmooth (open source java wrapper) i make the exe: Editor.exe.
    The user can put the exe anywhere in a folder and use it, example:
    User have a text file on desktop and want to open it:
    User make a double click on file.txt --> Microsoft Windows Xp open my program and load the file.
    All work correctly but there is one problem.
    My program Editor.exe when is close make a Editor.properties file. I would like this file to be created in the same dir where Editor.exe is stored.
    I don't know how to do this thing. I write this code:
    public static void save(Properties propertiesFile) {     URL jarURL = (PropertiesFile.class.getClassLoader().getResource("."));          FileOutputStream out;     System.out.println("dir \n" + jarURL.getFile());          File f = new File(jarURL.getFile()+"Editor.settings");     try {          out = new FileOutputStream(f);                    propertiesFile.store(out, "Program settings");          out.close();     } catch (IOException ioe) {          ioe.printStackTrace();     }}
    This code is wrong because jarURL.getFile() is the directory where file.txt is stored but i want the dir where Editor.exe is stored.
    I try with this line of code:
    URL location = getClass().getProtectionDomain().getCodeSource().getLocation();
    i get this dir:
    /C:/Documents%20and%20Settings/Andrew/Settings%20local/Temp/temp10
    .jar
    This is a correct dir, because the program is stored ind dir
    c:\program files\editor\Editor.exe
    Anybody can help me?
    THX

    try below...
    public java.net.URL getResource(String strName)throws java.net.MalformedURLException
                String baseURL = getClass().getResource("/resources").getFile(); // ("/resources" ):- is a file /dir stored in in jar
                try{
                        baseURL = java.net.URLDecoder.decode(baseURL,"UTF-8");
                }catch(Exception e){}
                if(baseURL.startsWith("file:"))
                        baseURL = baseURL.substring(baseURL.indexOf(":")+1);
                java.io.File fBase = new java.io.File(baseURL);                    // Original URL Ref. To Jar Archive
                java.io.File jarFile = fBase.getParentFile();                    // Jar File Reference
                java.io.File rootDir = jarFile.getParentFile();                    // Root Directory which Contains Jar File
                java.io.File fileApp = new java.io.File(rootDir,strName);               // Requested File/Directory     
                if(fileApp.exists())
                    return fileApp.toURL();
                else
                    return null;
        }Timir

  • How to know the stage where a running report is? - in Reports 3.0

    Hi!
    Thanks for paying attention.
    I have a problem with running the reports. When I call a report from the forms using the built-in, RUN_PRODUCT, the report is running. The problem is, some times, it may take few min and some times more than 10 min and some times, it stops responding. So, how do I know at what stage the report is in.
    For ex, if the report is run in Reports Designer, it shows a screen with client and server activity. Can I get the same effect by using the RUN_PRODUCT built-in.
    Please help me or suggest me with some solution
    Thank you
    regards
    RHR PRASAD

    Hello rhr_pras
    this is quotation form Report 3.0 manual:
    Description PRINTJOB specifies whether the Print Job dialog box should be displayed before running a report.
    Syntax
    [PRINTJOB]YES
    Values
    YES or NO
    Default
    YES
    Usage Notes
    n When a report is run as a spawned process (i.e., one executable, such as R30RUN, is called from within another executable, such as R30DES), the Print Job dialog box will not appear, regardless of PRINTJOB.
    n When DESTYPE=MAIL, the Print Job dialog box will not appear, regardless of PRINTJOB.
    Also look for other parameters in paramlist for Run_Product (maybe BATCH) and maybe report mode (SYNCHR/ASYNCHR)
    Hope this helps

  • How to know the complete root of my application

    Hi all i want if someone could help me how to know the root where my application is installed or is running, for example if i have two computers with two partitions each, and in one computer i put my application in the root c:\App1 and in the other computer i put the same application i the d:\AppEx\App1 i want to know the complete root because depending on it i will copy a file which is essential for my application, i wonder if someone could help me with that thanks a lot

    Hi all i want if someone could help me how to know
    the root where my application is installed or is
    running, for example if i have two computers with two
    partitions each, and in one computer i put my
    application in the root c:\App1 and in the other
    computer i put the same application i the
    d:\AppEx\App1 i want to know the complete root
    because depending on it i will copy a file which is
    essential for my application, i wonder if someone
    could help me with that thanks a lotYou almost certainly do NOT need to know this, if you design your app correctly.

  • I have an ipod I want to sell, but I don't know how to determine the specs, which one it is, how much memory, etc. Where can I find this information?

    I have an ipod I want to sell, but I don't know how to determine the specs, which one it is, how much memory, etc. Where can I find this information?

    See this Apple support document.
    http://support.apple.com/kb/ht1353
    B-rock

  • I can't seem to get rid of OR use Adobe Reader after I let it into Safari 7.  How do I get to the point where Reader is not my preferred anything, but can still be used if Preview won't open something?

    I can't seem to get rid of OR use Adobe Reader after I let it into Safari 7.  How do I get to the point where Reader is not my preferred anything, but can still be used if Preview won't open something?

    Back up all data before making any changes. Please take each of the following steps until the problem is resolved.
    Step 1
    If Adobe Reader or Acrobat is installed, and the problem is just that you can't print or save PDF's displayed in Safari, you may be able to do so by moving the cursor to the the bottom edge of the page, somewhere near the middle. A black toolbar should appear under the cursor. Click the printer or disk icon.
    Step 2
    There should be a setting in its preferences of the Adobe application such as Display PDF in Browser. I don't use those applications myself, so I can't be more precise. Deselect that setting, if it's selected.
    Step 3
    If you get a message such as ""Adobe Reader blocked for this website," then from the Safari menu bar, select
              Safari ▹ Preferences... ▹ Security
    and check the box marked
              Allow Plug-ins
    Then click
              Manage Website Settings...
    and make any required changes to the security settings for the Adobe PDF plugin.
    Step 4
    Triple-click anywhere in the line of text below on this page to select it, the copy the selected text to the Clipboard by pressing the key combination command-C:
    /Library/Internet Plug-ins
    In the Finder, select
              Go ▹ Go to Folder
    from the menu bar, or press the key combination shift-command-G. Paste into the text box that opens by pressing command-V, then press return.
    From the folder that opens, move to the Trash any items that have "Adobe" or “PDF” in the name. You may be prompted for your login password. Then quit and relaunch Safari.
    Step 5
    The "Silverlight" web plugin distributed by Microsoft can interfere with PDF display in Safari, so you may need to remove it, if it's present. The same goes for a plugin called "iGetter," and perhaps others—I don't have a complete list. Don't remove Silverlight if you use the "Netflix" video-streaming service.
    Step 6
    Do as in Step 4 with this line:
    ~/Library/Internet Plug-ins
    If you don’t like the results of this procedure, restore the items from the backup you made before you started. Relaunch Safari.

  • Why does my iPhoto seem to get "stuck" a lot of times to the point where I have to force quit it and how do I fix it?

    Why does my iphoto seem to get "stuck" a lot of the times when I try to exit it to the point where I have to "force quit" it and how do I fix the problem that causes it?

    With the amount of information you've provided it's impossible to offer a potential solution.  We can't see your computer so we need to know the details of your problem and setup, i.e.:
    what version of iPhoto are you using?
    what system version are you running?
    does this only happen when you try to quit iPhoto?
    what fixes have you tried?
    where is your library located?
    did you apply any updates or upgrades just prior to the problem occurring?
    are you running a "managed" or "referenced" library?
    what type of Mac?
    how much free space on your boot drive?
    Happy Holidays

  • How do you move the point where an audio clip attaches to a video clip?

    I'm talking about the little carrot that sticks from one clip to another to indicate the point where the cips are syncronized. How do you move their position? Thank you!
    Eric

    The manual says ...
    Adjust the connection point of a connected clip
    By default, connected clips and storylines are connected to the primary storyline at their first frame, but you can move the“connection point” of a connected clip or storyline. This is useful when you want to connect a specific frame or audiosample in the connected clip or storyline with a specific frame or audio sample in the primary storyline.
    Hold down the Command and Option keys, and click the connected clip (or the gray border of the storyline) at thepoint where you want to position the connection point.
    The connection point is moved to the point where you clicked.
    For other things ... If you want to move the audio clip in relation to the video clip just click on it and drag it to the left or right.  This is when your audio clip is a separate clip from your video clip.  If you want to move the audio that is part of a video clip, you first have to select that clip then choose Clip/Break Apart Clip Items then do one of the things listed above.  Best wishes.

  • I'm trying to install the os x but I got the point where its's asking for "administrator password". How do I get that password?

    I'm trying to install the os x but I got the point where its's asking for "administrator password". How do I get that password?

    That password should be the one you used on the system *before* you do the upgrade.
    If you got the computer used from someone else, you need to get in touch with them and get the password.

  • My iphone 4 is acting like crap right i can't even restore it everytime i try to reboot it my iphone freezes at the apple logo it is ******* to the point where i just want to smash it how do i solve this problem please help?

    my iphone 4 is acting like crap right i can't even restore it everytime i try to reboot it my iphone freezes at the apple logo it is ******* me off to the point where i just want to smash it how do i solve this problem please help?

    Don't worry, just follow these steps to fix iPhone stuck on Apple logo
    => First of all Start your Computer and then connect with Internet connection, now Download the latest version of the iTunes application
    => Now install the iTunes application in your System and connect your Device with computer via Data cable
    => Now connect your Device with iTunes application and then Tab on summary option, see in the left side bar of iTunes
    => Now Select restore option from iTunes and then confirm the Restore Message for better results. After this unplug your Device and Restart it
    I hope that will surely
    Thank you...

  • I have one file ss_fpga.rbt,abcd.txt how to know the details of the file

    i have  one file  ss_fpga.rbt,abcd.txt how to know  the details  of the file  (when was the date created ,when was date modfied,owner) any function is there like   GetFileInfo

    Yes there is some, called stat(), look the links in your post in stack overflow, there is a lot of link in the anser.
    They talk about sys/stat.h a C header, witch contain the stat() function.
    stat() return a lot of things (size, changes, access etc) about files. look the "here" everywhere in the Yann anser, UP his anser and put the subject as resolved.
    Thanks,

  • How to know the dynamic values for this :AND category_id_query IN (1, :3, )

    Hi Team,
    R12 Instance :
    Oracle Installed Base Agent User Responsibility --> Item Instances -->
    Item Instance: Item Instances > View : Item Instance : xxxxx> Contracts : Item Instance : xxxxx> Service Contract: xxxxx>
    In the above page there are two table regions.
    Notes.
    -------------------------------------Table Region---------------------------
    Attachments
    -------------------------------------Table Region---------------------------
    --the attachments are shown using the query from the fnd_lobs and fnd_docs etc...
    I want to know what are the document types are displayed in this page ?
    --We developed a custom program to attach the attachments to the  services contracts and the above seeded OAF page displays those ..as needed.
    But after recent changes..the Attachments--> table region is not showing the attachments.
    I have verified the query..and could not find any clue in that..
    but i need some help if you guys can provide..
    SELECT *
    FROM
    *(SELECT d.DOCUMENT_ID,*
    d.DATATYPE_ID,
    d.DATATYPE_NAME,
    d.DESCRIPTION,
    DECODE(d.FILE_NAME, NULL,
    *(SELECT message_text*
    FROM fnd_new_messages
    WHERE message_name = 'FND_UNDEFINED'
    AND application_id = 0
    AND language_code  = userenv('LANG')
    *), d.FILE_NAME)FileName,*
    d.MEDIA_ID,
    d.CATEGORY_ID,
    d.DM_NODE,
    d.DM_FOLDER_PATH,
    d.DM_TYPE,
    d.DM_DOCUMENT_ID,
    d.DM_VERSION_NUMBER,
    ad.ATTACHED_DOCUMENT_ID,
    ad.ENTITY_NAME,
    ad.PK1_VALUE,
    ad.PK2_VALUE,
    ad.PK3_VALUE,
    ad.PK4_VALUE,
    ad.PK5_VALUE,
    d.usage_type,
    d.security_type,
    d.security_id,
    ad.category_id attachment_catgeory_id,
    ad.status,
    d.storage_type,
    d.image_type,
    d.START_DATE_ACTIVE,
    d.END_DATE_ACTIVE,
    d.REQUEST_ID,
    d.PROGRAM_APPLICATION_ID,
    d.PROGRAM_ID,
    d.category_description,
    d.publish_flag,
    DECODE(ad.category_id, NULL, d.category_id, ad.category_id) category_id_query,
    d.URL,
    d.TITLE
    FROM FND_DOCUMENTS_VL d,
    FND_ATTACHED_DOCUMENTS ad
    WHERE d.DOCUMENT_ID = ad.DOCUMENT_ID
    *) QRSLT*
    WHERE ((entity_name    ='OKC_K_HEADERS_V'-- :1
    AND pk1_value          IN ( 600144,599046) --:2
    AND category_id_query IN (1, :3, :4, :5, :6, :7) )
    AND datatype_id       IN (6,2,1,5)
    AND (SECURITY_TYPE     =4
    OR PUBLISH_FLAG        ='Y')))
    --='000180931' -- 'ADP118'
    The above seeded query is the one which is used for table region to retrieve the data..
    how to know the dynamic values for this : AND category_id_query IN (1, :3, :4, :5, :6, :7) )
    --Sridhar                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    Hi Patricia,
    is it working for restricted key figure and calculated key figure ??
    Note Number Fisc Period Opening Days
    1 1 2
    2 1 3
    3 1 0
    because I have other restriction, so I create two restricted key figure..
    RK1  with restriction :  Total Number of Note,
    RK2  with restriction :  Total Opening Days ,
    then I Created a calculated key figure, average opening days in a period
    CK1 = RK2 / RK1..
    in this case, I am not sure if it will work or not..
    for example, during RK2 calclation, it might be this   2+3 = 5, the line with 0 will be ignored..
    during RK1 calcualtion, it might be 1 + 1 + 1 = 3. ---> Not sure in this case, the line with opening days 0 will be calculated or not..
    could you please confirm..

  • With a contract number, how to know the total PO release value against it?

    Usually one contract corresponds to multiple PO records, now we know the contract number, then how to know the total PO release value against this contract.  In other word, we would like to know the total release value of all the POs with the same contract number.  To just input the contract number in EKPO table? but then look for which field in this table to add these PO release values up?
    We will give you reward points!
    Thanks!

    hi Mohammad,
    By following your instruction, input the contract number 4800000112 into Document number field, then hit Enter, get the following (only copy two records here for example), but kind of a mess.  Could you let us know which one is the PO release value for this contract?
    Contract   Type Vendor     Name                                 PGp Agmt. date
      Item  Material           Short text                               Mat. group
      D I A Plnt SLoc                 Targ.qty. Un       Net price  Curr.   per Un
    4800000112 WK   2000012012 GULF INTERSTATE FIELD SERVICES       QBH 06/20/2006
    Agreement start06/20/2006 Agreement end 12/31/2007
    Tgt. val.        1,000,000.00  USD   Open          1,000,000.00 USD   100.00 %
      00001                    Inspection Svcs, Construction            R3VNI
      L   U                                  0  UL            0.00  USD       1 EA
      00002                    Chief Inspector                          R3VNI
      L   U                                  0  DAY         390.00  USD       1 DAY

  • HT5012 I have a first generation Iphone 5 and my question is why is my phone heating up so bad to the point where its almost to hot to touch on the back. On top of that the battery is dieing so fast that it usually lasts about 3 hrs on a full charge. Help

    So basically my iPhone 5 has been heating up so bad that it feels like its about to over heat and die. I've never had this happen to any other of my iPhones.  On top of that the battery is dying so fast that on a full charge is lasts about 3 hrs give or take. Ive tried closing all my apps like i usually do anyways, i tuned down the light, I've reset it and booted it back up, reset it and used iCloud backup, ext... Nothing is working. I'm to the point where i  almost want to get a new phone. I even tried calling apple support and they couldn't help me cause from what it sounded like they had no idea what they were doing. If anyone has any comments on how to fix this i would greatly appreciate it . I do love apple products and i have a upgrade and plan on upgrading my phone when the new one comes out but for the time being IDE like to fix the phone i have now that I've only had for a little bit anyways. Thanks  

    You are probably going to have to take a trip to the Apple Store, but you can also make sure that:
    Bluetooth is turned off when not in use
    Location Services are only turned on for those locations that you want a constant update to
    Background App Refresh is turned off
    Automatic Downloads is turned off
    Cellular Roaming is turned off when you don't need it
    Go through your Settings and take a look at all of the settings to determine if you have any turned on that may be using a lot of battery, and which you really don't need.
    Cheers,
    GB

Maybe you are looking for

  • How can I use a JavaBean in another JavaBean?

    I create a JavaBean named "dbBean.java" And I create another JavaBean named "login.java" which want to use the method defined in "dbBean.java". Could anyone tell me the syntax of using it?

  • Problem when running webdynpro from Internet explorer 8

    Hello Dear all, I created a webdynpro and everything i created is right. when i load the webdynpro (F8) to internet explorer 8 i can see the webdynpro . But the IE 8 screen shows no reaction. I thought that my webdynpro was wrong. But i ran the webdy

  • IMac G5 zoom video?

    My sister just called me with a problem on her iMac (17", 2ghz) G5. It seems that zoom video somehow got turned on. The screen size is bigger than the actual screen, and dragging the cursor to the edges drags the screen over until it hits the edge. I

  • Transport order between company codes

    Hi, I have the following question: We are setting up the system where transport orders are being used between two company codes. Is it possible when transport orders are being used and stock is available in the supplying company to not accept the tra

  • Include an interactive Youtube player in Edge Animate - Not working properly!

    Hi folks! I am working on a new project which is based on a interactive web video. In the Edge Animate proyect I have implemented a Youtube fullscreen player which has interactivity. On the one side, in the Edge project I have included a JS which con