How to get Mouse Screen Coordinates

Hi
I have code:
JButton btn  = new JButton("button");
btn.addActionListener(new ActionListener()
    public void actionPerformed(ActionEvent e)
          //  HEAR I WANT TO GET MOUSE
          //  SCREEN COORDS!!!
}I want to get Coordinates!!!

If you have a MouseEvent you can convert it as follows:
Point point = mouseEvent.getPoint();
SwingUtilities.convertPointToScreen((Component)mouseEvent.getSource(), point);However, that won't work from your actionPerformed method. If possible, use a MouseListener and intercept the mousePressed/mouseClicked events.
If you want to capture the mouse position when someone presses a button (e.g, by using an keyboard shortcut) then you'll need a MouseMotionListener to track the mouse pointer as it moves over your component.
Hope this helps.

Similar Messages

  • How to get 10 screens on a Mac Pro

    Hi All:
    I'm trying to figure out how to get 10 screens working together like one big desktop on a Mac Pro.
    Currently I have a 12core 2010 Mac Pro with 2 ATI 5770 cards driving 6 30" cinema displays.  Each of these cards are double wide.
    I want to connect 4 65" LED displays. 
    Does anyone have an idea how I can do this?  The Mac Pro has only 4 slots.  The two 5770s take up 3 spaces (because of their doulbe wide size).  The last slot has a OWC solidstate drive there.  I guess I could remove that and use just a regular SATA SSD if need be, but would love to get this done with just 3 slots.
    So some thoughts. There are two possible ways (ideal, and less ideal) that I can think of:
    IDEAL way:
    The ideal would be to find a single wide card that supports 5 or 6 displays, and use that.  I know that some people have had success flashing single wide cards, but it's not clear if all the ports are usable.  See here for an ATI card with 3 ports, single slot, that's been flashed:
    http://www.ebay.com/itm/Apple-Mac-Pro-ATI-Radeon-HD-5770-1GB-Video-Card-Single-S lot-5870-/150928552679?pt=PCC_Video_TV_Cards&hash=item23240af2e7
    Also, it's not clear if you could get 4 of those cards working to drive all 10 screens.
    However, there are single wide 5/6 display cards like this:
    http://www.newegg.com/Product/Product.aspx?Item=N82E16814150566&nm_mc=AFC-C8Junc tion&cm_mmc=AFC-C8Junction-_-na-_-na-_-na&AID=10440897&PID=3332167&SID=u00000687
    Has any seen or know of a 5 port card like the above that has been flashed to work in a Mac Pro?
    LESS ideal way:
    My guess is there are some PCI expansion chasis, and I can just put in 2 more regular ATI 5770s there.  I found this:
    http://www.jmr.com/en/products/14/3-slot-pcie-extender/
    and this
    http://www.magma.com/catalog/classic-pci-expansion
    I'm not sure how well these extenders work.
    EVEN LESS ideal way:
    Perhaps getting another Mac or PC and somehow VNC'ing in is an option, but this likely would be too laggy to run video from one computer to the other.  The ideal is to just treat the system like one giant screen, but I'm open to hearing any experiences/suggestions on getting this to work.
    Thanks so much!

    After reading up on it, it seems that the 6850 supports 3 displays. So perhaps I could do one 6870 (4 displays) in slot one, and then 2 single slot 6850's or 5770's in slots 2 and 3. This would give 10 displays.
    I have 3 questions then:
    (1) What is the quietest 6870 card people have successfully used in a Mac Pro?
    (2) What is quietest single slot 6850 or 5770 card successfully used in a Mac Pro?
    (3) Has anyone gotten thiis 5770 single slot card to work on a Mac Pro, and have they gotten 5 display ports to work?
    http://xfxforce.com/en-gb/Products/Graphics-Cards/AMD/ATI-Radeon-HD-5000/ATI-Rad eon-HD-5770-Single-Slot.aspx

  • How to get full screen caller pic in ios 7.1

    How to get full screen caller pic in ios 7.1.Please help me

    Haha .. I have seen one million post on this issue since 7.1 was released. Everybody hates it and it is perhaps Apple's stupidest design decision. I, personally, happen to like it ... or not mind it as much either way, I should say.
    But that's not what you asked ... Apple thought it was best for some odd reason to change the full screen pics to an itty bitty circle. As a previous poster said, it cannot be changed. But be sure to go to Apple's feedback website and let them know you are unhappy about it. I sense an iOS 7.1.1 coming out REAL soon!

  • How to get ICH Screen Element Objects

    Would anyone tell me how to get ICH Screen element objects i.e Screen ID like ALRTOVW

    Hi Bris,
    You can run the transaction only from the normal SAPGUI. Try it once again in this format:
    /N/SCF/SCREENCFG.
    Best regards,
    attila

  • How to get absolute screen position for component in borderlayout?

    I am trying to get the screen location for a point in a component in a panel. The panel has a borderlayout(). The component is currently in the CENTER position of the layout. When I use the getBounds() method for this component I can get the <x,y> coordinates relative to the client area of the panel. But that does not include the frame. I
    Does anyone know how I can do this?

    There is a convertPointToScreen method in SwingUtilities:
    http://java.sun.com/j2se/1.5.0/docs/api/javax/swing/SwingUtilities.html

  • Getting mouse click coordinates with image button

    I'm using ADF Rich Client components in JDeveloper 11g Technology preview.
    I have to get the mouse click coordinates with an image button. In the page I put something like this:
    <af:commandButton text="commandButton1" icon="ambiente.jpg"
    actionListener="#{prova.listen}" action="#{prova.esegui}" />
    In the listener method of the managed bean I try to get the coordinates with this code:
    public void listen(ActionEvent e)
    FacesContext context = FacesContext.getCurrentInstance();
    String clientId = e.getComponent().getClientId(context);
    Map requestParams =
    context.getExternalContext().getRequestParameterMap();
    int x =
    new Integer((String) requestParams.get(clientId + ".x")).intValue();
    int y =
    new Integer((String) requestParams.get(clientId + ".y")).intValue();
    but it doesn't work. It seems that there aren't in the request the coordinates of the image point clicked. Is it true? How can I do that with ADF ?

    Hi,
    the mouse position is not part of the request parameters send. You will have to use client side JavaScript for this
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
    <jsp:directive.page contentType="text/html;charset=windows-1252"/>
    <f:view>
    <af:document>
    <f:verbatim>
    <![CDATA[
    <script>
    function handleMouseCoordinates(event) {      
    alert("x: "+event.getPageX()+" y: "+event.getPageY());
    </script>
    ]]>
    </f:verbatim>
    <af:form>
    <af:commandButton text="My Click Button" icon="/images/jdev_cup.gif">
    <af:clientListener method="handleMouseCoordinates" type="click"/>
    </af:commandButton>
    </af:form>
    </af:document>
    </f:view>
    </jsp:root>
    Frank

  • How to get to screen where agree to license and continue in installing acrobat 9 pro on a macbook pr

    how to get to the screen where request ot agree to license and continue in loading acrobat 9 pro on macbook pro?

    Hi feivey
    Go to Help->Activate -. Put your Serial key to activate

  • How to get outdated screens in sap.

    Hi.
    Can u tell me How to get out dated(or unused) screens in sap or how to omit the outdated screens?
    I.e In  Va01 application there are some  screens such as 130,461,4603,4604..
    in above screens,  for screen element 'vbak-vbeln'  descriptions are shown as 'Repair request'/'mainatain reuqest".
    I want to neglect above screens..

    Hi Micky.
    i want to neglect those screens..
    I want to maintain  screen elements  for tcode va01.
    i'm calling 'Import_dynpro' (it takes program name,screen,language  and gives Screen elements and their descriptions)for each screen of va01.If i'm calling for 130,461 screens, for vbak-vbeln they r showing description as 'Maintain request/repair request..
    i want to maintain updated Va01screens screene elements..

  • How to get selection screen elements and its table reference of a report ?

    halo experts
    How can I get selection screen elements and its table reference of a report ? . I tried rs_refresh_from_select_options. But I am unable to get the table and field it is referring to
    For eg if my selection screen 1000 is
    parameters: p_carrid type spfli-carrid,
    select-options :s-_connid type sflight-connid.
    is there any Fm or method which gives me what are the screen elements( p_carrid and s_connid ) and what table( splfi and sflight ) and field ( carrid and conid )it is referring to ?

    The following code is an example of how you might dynamically determine all your PARAMETERS and SELECT-OPTIONS variables at run time.  The PARAMETERS and SELECT-OPTIONS only point to a dictionary element--not a specific table.  Even though you may say "spfli-carrid" or "sflight-connid", the data type really references the dictionary type and not a specific table/structure.
    REPORT  ZTEST_PROG.
    TABLES sflight.
    DATA:
           screen_tab TYPE STANDARD TABLE OF screen,
           wa_screen TYPE screen,
           scrn_nm TYPE string,
           scrn_leftover TYPE string,
           l_type TYPE REF TO cl_abap_typedescr,
           typ_nm TYPE string,
           typ_pre TYPE string.
    FIELD-SYMBOLS <fs_data> TYPE ANY.
    PARAMETERS p_carrid TYPE spfli-carrid.
    SELECT-OPTIONS s_connid FOR sflight-connid.
    INITIALIZATION.
      LOOP AT SCREEN.
        IF screen-group3 = 'PAR'
          OR screen-group3 = 'LOW'.
            APPEND screen TO screen_tab.
        ENDIF.
      ENDLOOP.
    START-OF-SELECTION.
      LOOP AT screen_tab INTO wa_screen.
        ASSIGN (wa_screen-name) TO <fs_data>.
        l_type = cl_abap_typedescr=>describe_by_data( <fs_data> ).
        IF wa_screen-group3 = 'LOW'.
          SPLIT wa_screen-name AT '-' INTO scrn_nm scrn_leftover.
          TRANSLATE scrn_nm TO UPPER CASE.
        ELSE.
          scrn_nm = wa_screen-name.
        ENDIF.
        SPLIT l_type->absolute_name AT '=' INTO typ_pre typ_nm.
        WRITE:
                 / 'Screen Name:  ', scrn_nm,
                 / 'DDIC Type:    ', typ_nm.
      ENDLOOP.
    When you get into defining internal tables you can determine those at run time with cl_abap_structdescr.  The following is an example of how you might do that.  You can loop through the "components_table" and evaluate each field of the structure in this way.
    DATA: structure_reference TYPE REF TO cl_abap_structdescr,
          components_table TYPE abap_compdescr_tab,
          components_structure LIKE LINE OF components_table.
    structure_reference ?= cl_abap_structdescr=>describe_by_data( any_structure ).
    components_table = structure_reference->components.
    I don't know if this answers any of your questions but I hope that some of it is useful.

  • How to get ME23 screen using selection-screen

    Hi,
    I am trying to get the ME23 screen using selection-screen with following code.
    select-options: purordno for ekko-ebeln NO intervals.
    SUBMIT SAPMM06E VIA SELECTION-SCREEN .
    But at the time of execution i got this error "INCORRECT PROGRAM TYPE WITH SUBMIT".
    Can any one please provide me some sample code how to get the ME23  screen
    using Abap program.
    Regards,
    krishna/rajesh.

    Hi Rajesh,
    You can't submit a pool modul ( SAPMM06E ).
    Only executable prog can be submit .
    What you can try is use "CALL TRANSACTION" statement.
    Hope this helps,
    Erwan

  • How to get the screen to dim after a certain time?

    cant remember how to get screen to dim after no screen activity? anyone remember?

    Settings, general, autolock.  Set it for however long you want it.

  • How to get broken screen repaired?

    What do I do to send my phone back to apple to get repaired (the screen is shattered)?

    Call the local number from http://support.apple.com/kb/HE57 and ask how to get service on an iPhone in Ireland.
    You can also contact Apple via the ExpressLane at https://expresslane.apple.com and click the iPhone area.

  • Getting the screen coordinates of the table

    Hi,
    I need to find the screen coordinate of the table that is displayed in a jsp page. I am only able to get the resolution and not the xy coordinates.
    Can anyone help me pls
    Regards
    Jeyanth

    You may want to find a javascript forum to ask that, as it is not something you can do in JSP

  • How to get the screen groups for the screen field which are on selectionscn

    hiiii Experts,
                   How to know the screen groups for the screen field which are on selection screen.
    Thanks and regards,
    kasyap

         NAME                                             PNPABKRS-LOW
            GROUP1                                             SEL
            GROUP2                                             DBS
            GROUP3                                             LOW
            GROUP4                                             180
    to get this use this:
    AT SELECTION-SCREEN OUTPUT.
      LOOP AT SCREEN.
        if screen-name CS 'ABKRS'.
          BREAK-POINT.
        endif.
      ENDLOOP.

  • SWF in iFrame - How to get mouse wheel to work

    I have been searching for a solution to this for a few days
    without any luck. I was hoping someone here may have come across
    this problem and know of a solution, or know if it just is not
    possible.
    I have a static page which consists of an iframe, picture and
    a div with some links. The image is an image map and set to load
    all links within the iframe. The flash itself is a 360 degree
    panoramic view with hotspots (links) within the file that also
    point to other pages. My issue is that the mouse wheel scroll is
    supposed to be a zoom in/out feature, which work with the flash
    file and full screen view. However, when the file is loaded within
    the iframe, the scroll wheel on the mouse will only scroll the page
    and will not interact with the flash file at all.
    The problem seems to be with the following browsers (PC):
    Chrome 0.4
    Opera 9.5
    Firefox 3.0
    The zoom works in IE6, although the page does scroll with it.
    When I disabled the page from scrolling (see index2.html) the zoom
    stops working. This is probably due to the code used to disable the
    mouse. I really need to try to get the mouse wheel to zoom in
    FireFox 3 though. The large majority of our visitors are PC users
    with FireFox 3 or IE 7, so these are the two most important
    browsers to have working.
    The pages are still currently under development but examples
    are online here:
    http://www.utoledo.edu/campus/virtualtour/maincampus/index.html
    -Normal page
    http://www.utoledo.edu/campus/virtualtour/maincampus/index2.html
    -Page with scrolling disabled
    Does anyone have any ideas for a possible solution? Thanks
    for taking the time to help.

    As far as I know,there is no facility for detecting mouse scrolling wheel in JDK 1.3.
    Check it in the later releases of JDK.

Maybe you are looking for

  • How can I change a standard webservice

    What steps are necessary for me to change the SAP webservice from SAP ESR? I WANT to do this in ABAP. I know that there are some BADIs and Enhancements spots available . But how does this fit into the whole Wesbservice interface. For example : I want

  • How to Install Premiere Pro Title Templates Properly

    Hi everyone. I know this might seem like second nature to the PC iniated but I just don't have a clue how to install... well anything on a PC. I've found the content I need to install here: http://helpx.adobe.com/x-productkb/multi/library-functional-

  • DataProvider syntax error -why cant 2 components have the same dataProvider

    Hi, I am getting the following error: Multiple Initializers for property 'dataProvider' (note: 'dataProvider' is the default property of mx.controls.TitleList'). setup i have two components one that is a lineChart the other is a titleList. for each I

  • Is my battery life ok?

    Hello, I just got my MacBook about 3 months ago. I want to know if my battery performance is good. The stats are below: Charge Reaming: 4727 Full Charge Capacity: 5237 Cycle Count: 5

  • Why does jitter graph smooth out when we add Codec to IP SLA

    We use NetQos to monitor jitter, delay and MOS.  On a single tunnel, we have three IPSLA measurements, one with the defaults, one with ToS=184, and one with ToS=184 plus Codec=g711alaw.   The bona fide data traversing the link is time sensitive, but