Getting mouse events outside of nodes

Does anyone know how to get a mouse event to trigger outside of a nodes clip area? I am trying to write a game and follow the model/viewer/controller outline. I want the controller to handle the mouse events and the controller have no substance on the screen. Mouse events only seen to work when they are inside a node. My current fix is to make the controller appear on the screen as a giant rectangle of the background color. However if there is a better way I would appreciate it.

My current fix is to make the controller appear on the screen as a giant rectangle of the background color.That's indeed the classical and recommended way. Or make it transparent. Can be in the background (let the nodes handle the clicks (they can block mouse or not), get all "lost" clicks) or in the foreground (get all clicks, letting them pass through to be handled also by nodes).

Similar Messages

  • How to get mouse events inside the components of a JTable

    Hi!
    I have question, I think this is related to very basics of swing, however I couldn't find a solution/answer on the web.
    I have a JMyTable(a descendant of JTable), and one value on a row/column is a special class, ie. MyClass. for this class I registered a cell renderer, MyRenderer. and this renderer returns a JMyComponent, which is actually a descendant of JComponent.
    Now, if I call enableEvents(AWTEvent.MOUSE_EVENT_MASK) in the constructor of JMyTable I get events posted on processMouseEvent method. However, the same doesn't work for JMyComponent. I mean, I call enableEvents, however processMouseEvent method is not triggered.
    Could someone explain/help me with this issue?
    Thanks,
    Ozgur

    Your cell renderer components are just that: renderers. They're not added to the table and do not appear in the component hierarchy. This is because tables may be very large and adding components in would be very resource hungry.
    See here for details
    http://java.sun.com/docs/books/tutorial/uiswing/components/table.html
    If you want to detect events you will need to listen to events on the JTable itself, and use the rowAtPoint()/columnAtPoint() methods to determine the cell. So for instance where you might want mouseEntered() on your cell component you would have to use mouseMoved() on the table and detect when the cursor moves to a new cell.

  • Get mouse position outside application

    Hi,
    I need to know the position outside my java application, but I don't know on what I should add the MouseMotionListener. Any suggestions anyone?
    I'm running Microsoft Windows..
    Thanx,
    Jesse

    can't do that without JNI and a mouse hook.

  • Problem with TextLine not getting mouse events when expected

    Hi All,
    I am cross-posting the discussion I put on the TLF forum here (sample code is in that post)
    http://forums.adobe.com/message/3768763#3768763
    The issue is to do with non/slow response when clicking to edit multiple TLF text elements on a base group. Thanks to some extra work by Jin-Huang the problem is apparently that when the edit functionality is set (by setting the interactionManager), the TLF class cannot receive any more events until the mouse leaves and re-enters the TextLine you are supposed to be editing. This sounds like a Flex bug.
    I guess my questions are (1) is this actually a Flex bug? and (2) does anyone know a workaround so the thing can start accepting input immediately without further mouse actions?
    Thanks,
    Darryl.

    What happens if you use two RichEditableText controls or two TextAreas
    instead?  By trying to install your own editing controls, you might have to
    fully conform to the IFocusManagerComponent interface for focusable
    components otherwise you might run into issues like this.

  • Mouse-events outside application

    Dear sir,
    >
    Please can you help me,
    I want my java containers wthin my java-application to listen to mouclickevents outside my java-application (so I can close some windows)
    Is this possible?
    Hope you can help me

    The best I can think of is to use the Robot Class in Java 1.3 or later. I am not sure this is what you are looking for though.

  • How to distinguish is cell get key event or mouse event in table?

    Hi!
    I have a JTable.
    1.Select cell and double click. As result caret is show
    2.Select cell and start type. As result caret is show
    How distinguish is caret is show, because cell get mouse event or key event?
    Thank you.

    Hm ...
    the problem with the key events is, that they are partically taking place in an editor component - but the double click of the mouse clicked on a cell, which is not currently edited, can be get by a MouseListener added to the JTable.
    My idea to that is as follows - hold the double_clicked state in a boolean variable hold by your JTable subclass - it is set by a MouseListener added to the JTable - and reset by the overwritten prepareEditor(...) method. This method should do the following:
    // say, double_clicked is a boolean field in your JTable subclass
    public Component prepareEditor(TableCellEditor editor,int row,int column) {
    Component c = super.prepareEditor(editor,row,column);
    if ((!double_clicked)&&(c instanceof JTextField)) { ((JTextField) c).setText(""); }
    double_clicked = false;
    return c;
    }now you have only to implement an add a MouseListener to your JTable subclass which detects this double click and sets the double_clicked field accordingly.
    This is an idea on the fly - hope it is helpful for you.
    greetings Marsian

  • Transparent parts of component are preventing mouse events

    Hello,
    I am working with a bunch of components that are layered over top of eachother.
    Some of the components are odd shaped and have a transparent background.
    When I try to click on components that are behind others the mouse event is not fireing.
    is ther a way I can fix this?
    Drew

    There is a difference between transparent background and no background.  If I take a Sprite and draw a filled triangle like this:
    moveTo(0,0)
    lineTo(100, 100)
    lineTo(100, 0)
    lineTo(0,0)
    Then any component under the half I didn't draw on is "visible" to the mouse and my Sprite will not get mouse events.
    If I fill that area with a background with alpha=0, then I've effectively placed a piece of glass in my component and it will get mouse events even though you can see through to things behind it.
    Alex Harui
    Flex SDK Developer
    Adobe Systems Inc.
    Blog: http://blogs.adobe.com/aharui

  • Handling events outside components..

    Hi there,
    I would like to handle mouse events outside a components.
    After that my application is started, I want to run another thread
    when mouse is pressed.
    Is it possible?

    you can add mouse listener to frame itself or if you are using jpanel to add your components than you can add mouse listener to jpanel too

  • Can i get mouse location and event outside JFrame?

    Can i get mouse location and event outside JFrame?
    any related link or document? thx~

    what I figure out from your question is that, you want to get the coordinates even if the mouse is not directly interacting with any of the java components of your application.
    I would consider this as an interaction with the OS so that it sends a call to your java program as well when ever the mouse event occurs. If you use JNI to catch system events, I think it should work.

  • To Get the value of a node in a XML file which is outside the envelope

    Hi Everyone,
    I am uploading data in a XML file into Oracle tables. I am using oracle 9i release 2. How to get a value of a node outside the envelope.
    Here is my xml file.
    <Response>
    <TaskNo>14</TaskNor>
    <ZoneResponse>
    <GetServiceStatusResponse xmlns="http://mws.zonemws.com/Shipment/2010-10-01/">
    <GetServiceStatusResult>
    <Status>GREEN</Status>
    <Date>2011-06-03</Date>
    </GetServiceStatusResult>
    <Metadata>
    <Id>c9488a06</Id>
    </Metadata>
    </GetServiceStatusResponse>
    </ZoneResponse>
    </Response>
    This is the response xml we are getting from the supplier. I do want to store all the values in an oracle table, including TaskNo(14). TaskNo is the main value
    here. I am using dbms_xmlparser and dbms_xmldom in PL/SQL. I am able to get the values inside the envelope, but not the outside(taskno). It is not showing any errors. It is processing all
    other values. I Posted this in the XML DB section also. Please help me to solve this issue. Any help,tips and suggesstion will be highly appreciated. Thanks in advance
    --Vimal                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       

    Hi,
    I am providing some additional info like procedure, table structure and sample xml file so that you can get a clear idea about my problem and help me.
    My Procedure
    PROCEDURE xml_upload (
    p_directory IN VARCHAR2,
    p_server_directory IN VARCHAR2,
    p_filename IN VARCHAR2
    AS
    l_bfile BFILE;
    l_clob CLOB;
    l_parser DBMS_XMLPARSER.parser;
    l_doc DBMS_XMLDOM.domdocument;
    l_noderowset DBMS_XMLDOM.domnode;
    l_noderow DBMS_XMLDOM.domnode;
    l_nodecount NUMBER;
    l_Resultlist DBMS_XMLDOM.domnodelist;
    l_request_id VARCHAR2 (300);
    l_task_number NUMBER;
    l_tasknum_list DBMS_XMLDOM.domnodelist;
    l_service_list DBMS_XMLDOM.domnodelist;
    l_time_list     DBMS_XMLDOM.domnodelist;
    l_tasknode DBMS_XMLDOM.domnode;
    l_servicenode DBMS_XMLDOM.domnode;
    l_temp VARCHAR2 (1000);
    l_table_name VARCHAR2 (100);
    l_cmd_execution VARCHAR2 (1000);
    l_orig_file_with_path VARCHAR2 (1000);
    l_dest_file_with_path VARCHAR2 (1000);
    l_status custom.task_status.status%TYPE;
    l_time custom.task_status.timestamps%TYPE;
    l_rows NUMBER;
    l_message SYS.XMLTYPE;
    l_return_status NUMBER;
    TYPE tab_type IS TABLE OF custom.task_status%ROWTYPE;
    t_tab tab_type := tab_type ();
    PROCEDURE write_exception (
    p1_filename VARCHAR2,
    p_comments VARCHAR2,
    p_rows_created NUMBER
    IS
    BEGIN
    read_xml_file (p_directory, p_filename, l_message, l_return_status);
    -- Convert the xml to a clob
    l_clob := l_message.getclobval();
    -- Create a parser.
    l_parser := DBMS_XMLPARSER.newparser;
    -- Parse the document and create a new DOM document.
    DBMS_XMLPARSER.parseclob (l_parser, l_clob);
    l_doc := DBMS_XMLPARSER.getdocument (l_parser);
    -- Free any resources associated with the CLOB and Parser
    -- dbms_lob.freetemporary(v_clob);
    DBMS_XMLPARSER.freeparser (l_parser);
    l_noderowset :=
    DBMS_XMLDOM.item
    (DBMS_XMLDOM.getchildnodes (DBMS_XMLDOM.makenode (l_doc)),
    0
    l_nodecount :=
    DBMS_XMLDOM.getlength (DBMS_XMLDOM.getchildnodes (l_noderowset))
    - 1;
    t_tab.EXTEND;
    FOR i IN 0 .. l_nodecount
    LOOP
    l_noderow :=
    DBMS_XMLDOM.item (DBMS_XMLDOM.getchildnodes (l_noderowset), i);
    l_Resultlist :=
    DBMS_XMLDOM.getelementsbytagname
    (DBMS_XMLDOM.makeelement (l_noderow),
    'RequestId'
    l_request_id :=
    DBMS_XMLDOM.getnodevalue
    (DBMS_XMLDOM.getfirstchild
    (DBMS_XMLDOM.item (l_Resultlist,
    0
    END LOOP;
    FOR i IN 0 .. l_nodecount
    LOOP
    l_noderow :=
    DBMS_XMLDOM.item (DBMS_XMLDOM.getchildnodes (l_noderowset), i);
    l_service_list:=
    DBMS_XMLDOM.getelementsbytagname
    (DBMS_XMLDOM.makeelement (l_noderow),
    'Status'
    l_status:=
    DBMS_XMLDOM.getnodevalue
    (DBMS_XMLDOM.getfirstchild
    (DBMS_XMLDOM.item (l_service_list,
    0
    l_time_list:=
    DBMS_XMLDOM.getelementsbytagname
    (DBMS_XMLDOM.makeelement (l_noderow),
    'Timestamp'
    l_time:=
    DBMS_XMLDOM.getnodevalue
    (DBMS_XMLDOM.getlastchild
    (DBMS_XMLDOM.item (l_time_list,
    0
    END LOOP;
    select
    extractvalue(column_value,'/Response/TaskNumber') into l_task_number
    from
    table(xmlsequence(xmltype('<Response>
    <TaskNumber>14</TaskNumber>
    <ZoneResponse>
    <GetServiceStatusResponse xmlns="http://mws.zoneaws.com/InboundShipment/2010-10-01/">
    <GetServiceStatusResult>
    <Status>GREEN</Status>
    <Timestamp>2011-06-03T22:17:17.313Z</Timestamp>
    </GetServiceStatusResult>
    <Metadata>
    <RequestId>c9488a06-73c6-474e-b356-51d5f8feec00</RequestId>
    </Metadata>
    </GetServiceStatusResponse>
    </ZoneResponse>
    </Response>
    t_tab (t_tab.LAST).status:= l_status;
    t_tab (t_tab.LAST).timestamps:= l_time;
    t_tab (t_tab.LAST).amz_request_id:= l_request_id;
    t_tab (t_tab.LAST).tasknumber:= l_task_number;
    -- Insert data into the real Staging table from the table collection.
    FORALL i IN t_tab.first .. t_tab.last
    INSERT INTO custom.task_status VALUES t_tab(i);
    COMMIT;
    DBMS_XMLDOM.freedocument (l_doc);
    DBMS_LOB.freetemporary (l_clob);
    DBMS_XMLPARSER.freeparser (l_parser);
    DBMS_XMLDOM.freedocument (l_doc);
    DBMS_LOB.freetemporary (l_clob);
    DBMS_XMLPARSER.freeparser (l_parser);
    DBMS_XMLDOM.freedocument (l_doc);
    END rrs_xml_upload;
    Sample File:
    <Response>
    <TaskNumber>14</TaskNumber>
    <ZoneResponse>
    <GetServiceStatusResponse xmlns="http://mws.zoneaws.com/InboundShipment/2010-10-01/">
    <GetServiceStatusResult>
    <Status>GREEN</Status>
    <Timestamp>2011-06-03T22:17:17.313Z</Timestamp>
    </GetServiceStatusResult>
    <Metadata>
    <RequestId>c9488a06-73c6-474e-b356-51d5f8feec00</RequestId>
    </Metadata>
    </GetServiceStatusResponse>
    </ZoneResponse>
    </Response>
    Table: task_status
    tasknumber number,
    status varchar2(100),
    timestamps varchar2(100),
    requestid varchar2(100)
    all I want is to populate the data from xml file to the particulare table. I can do that with the above procedure.
    But In this below mentioned part of my procedure , I want to pass the file name instead of giving the entire content.
    select
    extractvalue(column_value,'/Response/TaskNumber') into l_task_number
    from
    table(xmlsequence(xmltype('<Response>
    <TaskNumber>14</TaskNumber>
    <ZoneResponse>
    <GetServiceStatusResponse xmlns="http://mws.zoneaws.com/InboundShipment/2010-10-01/">
    <GetServiceStatusResult>
    <Status>GREEN</Status>
    <Timestamp>2011-06-03T22:17:17.313Z</Timestamp>
    </GetServiceStatusResult>
    <Metadata>
    <RequestId>c9488a06-73c6-474e-b356-51d5f8feec00</RequestId>
    </Metadata>
    </GetServiceStatusResponse>
    </ZoneResponse>
    </Response>
    Alex or any other oracle pl/sql experts please help me to solve this issue.
    FYI : I am using Oracle 9.2.0.8.0
    Thanks,
    Vimal..
    Edited by: Vimal on Jun 13, 2011 4:10 PM

  • Capturing Mouse Click Event Outside a Canvas/Component

    Hello Guys
    I have a canvas based component and i want to capture a mouse click event outside that component.
    How is it possible?
    Thanks a lot

    Thanks a lot Morphic
    I solved it using focusout method from my component;s textinput but your method is also good and will help me in later stages.

  • Get all mouse events no matter what component the mouse is over

    Is there anyway to get all the mouse events, in for example, an applet? Usually, the only component that recieves the mouse event is the component which is being hoverred by the mouse. Is there anyway to just get all the mouse events without adding listeners to every component?
    Problem:
    Well, the real problem is that I have an Applet, that the componentCount() method returns 0. I want to get all mouse events on the applet, but if I just do a appletInstance.addMouseListener(this), it doesn't recieve the mouse clicks. It does however, get mouse exit and mouse enter events.
    Thanks for any support.

    Use an AWTEventListener:
    http://forum.java.sun.com/thread.jspa?forumID=57&threadID=727731&start=1

  • How can flex tell if  it's a mouseup event when the user releases the mouse button outside the flex application?

    how can flex tell if it's a mouseup event when the user
    releases the mouse button outside the flex application? Say for
    instance mousedown was done within a 500x500 embedded flex app but
    mouseup is outside or relased on the HTML background. One more
    thing, when we have something draggable, Flex doesn't execute the
    stopDrag() when the user releases the mouse button outside the
    embedded swf or fles app. Pls. help me with this. Thanks!

    I don't think the flex app can tell what happens outside the
    app. But it can detect when it leaves the app, so I have found the
    following line works fine inside initApp():
    this.stage.addEventListener(Event.MOUSE_LEAVE, yourFunction);
    and you have to:
    import flash.display.Stage;
    Doug

  • [HELP] Problem on JTree node mouse event !

    I implement a JTree component in my application. Now, I want it acts like
    windows XP's file explorer:
    When mouse cursor hovers over some tree node, that node's text became underlined,
    (font may be also changed as well) and the cursor changes to a 'hand'.
    After mouse moves out, that node return to normal display status.
    But I don't know how to do.
    Any ideas?
    Thanks a lot!

    anybody out there?

  • When both plug-in objects and jQuery mouse events are present, Firefox re-starts the plug-in object (eg Flash movie) after a jQuery mouse event occurs. This doesn't happen in any other browser. How can I get around this?

    Please check http://www.syus.com for an example. There is a Flash movie underneath the main navigation. The main navigation has a jQuery mouse event, and when you mouse over a button in the main navigation, the Flash movie re-starts. I can confirm that this happens not only on Flash swf files, but on standard <object> YouTube embeds.

    Ok, I promise this is my last post without your help. I did some more troubleshooting and it only seems to happen when jQuery appends elements to the body that were previously invisible. In other words, I can simply change the css in jQuery from using element.css('display','inline'), but if I try to use something like slideDown or other jQuery tooltip functions that append and/or remove elements or style definitions it causes the "object restart" bug.
    It is impossible for any developer to eliminate this bug without changing the actual source of jQuery, which I can't do. My only other option is not to use sophisticated show/hide jQuery elements like drop-down menus and tooltips on the same page as an embedded object, but I don't want to do this since Safari, Chrome and even IE (dear God) users won't have a problem with this. I think this is a major major bug that should be fixed in Firefox 4 as more and more sites will be looking to use the latest jQuery plugins.

Maybe you are looking for

  • Geospatial Registration Tool Missing from Acrobat 9 Pro

    I'm running Acrobat 9 Pro for Windows and am trying to georegister a PDF, however when I bring up the Analysis toolbar there are only three tools: Object Data Measuring Tool Geospatial Location Tool The fourth tool (the Geospatial Registration Tool)

  • Ipad 4 connecting to a snow leopard Imac?

    I just got an Ipad 4, I am running snow leopard on both of my computers, when I plug my Ipad into my computer it says I need the newest version of Itunes, but the newest version of Itunes requires that I have at least lion OS. Anyone have any suggest

  • Records are not showing

    what is wrong with this code? it is not showing my 7 records. the output is this [LINK|http://i338.photobucket.com/albums/n440/googleb0y/album1/output01.jpg] when i use the debugger, intenal table is empty. [LINK|http://i338.photobucket.com/albums/n4

  • How do I fix the sound on my brand new 4th gen iPod touch?

    I recently ordered a refurbished 4th gen iPod touch and it arrived today. Everything seems to be working fine except the sound. I'll play a song or video and the sound will either come on for a couple seconds sounding distorted, or not come on at all

  • Mountain Lion bug clock

    Hi, i have found a bug in Mountain Lion. I m a german user with 24h clock. During normal use i see a 24h clock. If Macbook Pro 13 logout automatic for energy safe and i have to login, the clock is swich to 12h (am pm). After login, clock swich to 24h