Capture Mouse Focus for Applet

Hey,
I am writing an applet, and would like to capture the mouse focus entirely within my applet. Let me explain what I mean:
- You click the applet, your mouse pointer vanishes.
- Now no matter how far to the right you move your mouse, it will not pop out of the applet. It is "locked" inside.
- You are still receiving mouse events from within this applet. You have essentially changed the area of effect to be the bounds of the applet.
An example of this functioning would be any video game that runs in windowed mode. Focus the game, and you'll see that your mouse never exceeds the bounds of the applet. In windows you alt-tab and now you regain your mouse pointer.
Is this possible? Anyone know how to do it?
Thanks.
Jesse

You can get the focus by:
<script type="text/javascript">
     onload = function()
          document.getElementsByTagName( "applet" )[0].focus();
</script>
In the applet mousemove event:
- Set the mouse cursor to null (invisible in the applet)
- Draw a small graphic at mouse position instead, doing the bounds checking.
- This gives you a game cursor in the applet which behaves as you wish.
- The "real" cursor is only visible outside the applet.
BTW,
KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner())
returns null if the applet does not have focus (handy for pausing your app)
AFAIK, applets themselves cannot grab focus (out of the sandbox)

Similar Messages

  • Capture lost focus for a screen field !!

    I was more into Visual basic programming so the event name "Lost focus" !!
    Basically i want to validate a field after the user enters a value in that and before he moves to the next field.
    how to do that ? if the value entered is wrong I will display a message using MESSAGE IXXX(FF) with ".....".
    whats the event to be captured and where ? how do i code it ?
    thks

    If it is module Pool program then you can use the FIELD Fieldname module Modulename under PAI event.
    in side the module you can raise the error message.
    If it is report programming then you can use AT SELECTION-SCREEN ON <PARMETER>.
    and raise the error message.

  • HTML/JS: Capturing mouse events while Air is out of focus

    Hi,
    I've been trying to determine if it is possible to receive mouse events (like MOUSE_WHEEL) if the Air window does not currently have focus. I'd like my application to support the mouse wheel for scrolling while the cursor is over the application, without requiring the user to click the application and gain focus. My application uses JavaScript to scroll an unordered list within a DIV set to overflow:hidden (to prevent the native scrollbar from appearing).
    Thanks for your help!
    Andrew

    I doubt that AIR would pick up events fired while not having focus. Perhaps you could fake it by creating an AIR project that runs "fullscreen", but has a smaller active window. Anywhere your mouse went it would still capture the scrolling event, but you could conditionalize it so that it only worked in certain areas.

  • Problem with focus on applet  - jvm1.6

    Hi,
    I have a problem with focus on applet in html page with tag object using jvm 1.6.
    focus on applet work fine when moving with tab in a IEbrowser page with applet executed with jvm 1.5_10 or sup, but the same don't work with jvm1.6 or jvm 1.5 with plugin1.6.
    with jvm 1.5 it's possible to move focus on elements of IEbrowser page and enter and exit to applet.
    i execut the same applet with the same jvm, but after installation of plugin 1.6, when applet gain focus don't release it.
    instead if i execute the same applet with jvm 1.6, applet can't gain focus and manage keyevent, all keyevent are intercepted from browser page.
    (you can find an example on: http://www.vista.it/ita_vista_0311_video_streaming_accessibile_demo.php)
    Any idea?
    Thanks

    Hi piotrek1130sw,
    From what you have described, I think the best approach would be to restore the original IDT driver, restart the computer, test that driver, then install the driver update, and test the outcome of installing the newest driver.
    Use the following link for instructions to recovery the ITD driver using Recovery Manager. Restoring applications and drivers.
    Once the driver is restored, restart the computer and test the audio. If the audio is good you can continue to use this driver, or you can reinstall the update and see what happens. IDT High-Definition (HD) Audio Driver.
    If installing the newest driver causes the issue to occur but the recovered driver worked, I suggest recovering again.
    If neither driver works I will gladly follow up and provide any assistance I can.
    Please let me know the outcome.
    Please click the Thumbs up icon below to thank me for responding.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Please click “Accept as Solution” if you feel my post solved your issue, it will help others find the solution.
    Sunshyn2005 - I work on behalf of HP

  • Lightroom and Windows mouse focus issues.

    In one aspect Lightroom have been always behaving different from other Windows application: Its speed of grabbing mouse focus and moving window to the foreground is exaggerated. This problem will be observed only by people using their WinXP computers in "X11 mode", like with Unix, what allows to perform interaction with processes associated with windows without ever clicking on, or raising such window. Should you be working on large computer clusters as I do, this focusing feature its a blessing.
    This how you can reproduce: Use Tweak UI to adjust the mouse behavior. Select "Mouse," step down to "X=Mouse" and check "Activation follows mouse." Do not select "autoraise."
    Now your WinXP will behave similar to the real X11 xterm with mouse having the "no raise selection" policy. Its not quite identical to xterm, but it really works perfectly in most cases.
    Except... well, except with Lightroom. Lightroom grabs the pointer and pushes the window to the foreground in splits of a second. For example, go to
    "Help|About Adobe Lightroom" to see the credit window. It appears than as usual, but since the help menu will be dismisses, the pointer stands on the main Lightroom window, what makes the credits window vanish in split of a second. No chance to see it!
    Another case: Assume that Lightroom uses almost the entire desktop down to the task bar, and your browser window is smaller. Select the browser on the taskbar and try to move mouse to it. No chance! Lightroom will take over and pop itself to the foreground again. The only solution is to minimize Lightroom. And than sometimes something happens that Lightroom will not restore itself anymore! The "Restore" operation is grayed out, one can only Maximize it. We have reported this numerous times before.
    I am aware that this problem relates only to WinXP users with X11 mouse mode, but with Lightroom reaching now a high degree of maturity, maybe we could take a look at this problem as well?

    In order to overcome most of the known navigation and/or focus issues you need to be using the following:
    <li>Forms 10.1.2.3 or newer (latest is 11.1.2). If/when you are using 10.1.2.3 you would also need to install patch ID 9593176 as this contains additional fixes for focus issues.
    <li>JRE 1.6.0_26 or newer (latest is 1.6.0_30). The latest is always recommended as it contains the most up to date fixes for both technical issues and security issues.
    Patches are only available on MyOracleSupport: http://support.oracle.com

  • Mouse Focus Issues

    hi,
    Are there any known mouse focus issues in r12 (r12.6) ?
    we have couple of users who have these problems. this isn't with all but few of them.
    thanks,
    jazz

    Jazz,
    Review the following documents, and see if it helps.
    Note: 457136.1 - On R12 Application, Randomly The Mouse Navigation Stops Working
    https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=457136.1
    Note: 468724.1 - Rel 12 : Mouse Cursor Is Frozen (Loss Of Focus In Applet) After Minimizing And On Restoring the Form To Normal Size
    https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=468724.1
    Note: 824000.1 - Unable to Use Mouse Cursor After Accessed on Folder Tools box
    https://metalink2.oracle.com/metalink/plsql/ml2_documents.showDocument?p_database_id=NOT&p_id=824000.1
    Regards,
    Hussein

  • How can I capture mouse click events on BSP or Web Dynpro ABAP Screen

    hi Guys,
    Currently we have a user inactivity problem,
    the requirement is: if user is clicking on BSP/Web Dynpro ABAP screen, he/she is considered active. so we need an mechanism to capture the mouse click event.
    Using Firebug, we found that this js is in the iframe which contains BSP/web dynpro scrren: /sap/public/bc/ur/nw5/js/languages/urMessageBundle_en.js
    we want to find this js file & put in some javascript code to track user's mouse click, but i cannot find it on server.
    while in ie if we type http://host:port/sap/public/bc/ur/nw5/js/languages/urMessageBundle_en.js
    this file can be downloaded, means this file is there.
    Any one can help on this issue? find the js file or another way to capture the mouse click event.
    Thanks a lot with points!

    Hi  Feng Guo,
                        We can not capture mouse click events on Web Dynpro ABAP Screen . I am not sure about BSP. But as for as I know the portal keep active the iViews until unless mouse clicks happens.
    But for your problem I think you can get solution by setting iView Expiration to some more time period.
    Regards,
    Siva

  • How to set FOCUS on applet (java-plugin)

    I wrote applet using Java 1.3.1, using swing clasess.
    I use java-plugin, defined in <object ..> and <embed ..> tags as described in documentation,
    with MAYSCRIPT parameter and ID and NAME parameters defined.
    How to set up focus on this applet through JavaScript?
    I have tried:
    document.embeds[0].focus()
    document.applets.MyApplet.focus()
    document.objects.MyApplet.focus()
    document.objects[0].focus()
    document.MyApplet.focus()
    But nothing works in my IE5.x or NC4.7. Applet itself works fine.
    Is some special methods need to be defined in JApplet to catch the focus?
    Thanks for any advice.

    I wrote applet using Java 1.3.1, using swing clasess.
    I use java-plugin, defined in <object ..> and <embed
    ..> tags as described in documentation,
    with MAYSCRIPT parameter and ID and NAME parameters
    defined.
    How to set up focus on this applet through
    JavaScript?
    I have tried:
    document.embeds[0].focus()
    document.applets.MyApplet.focus()
    document.objects.MyApplet.focus()
    document.objects[0].focus()
    document.MyApplet.focus()
    But nothing works in my IE5.x or NC4.7. Applet itself
    works fine.
    Is some special methods need to be defined in JApplet
    to catch the focus?
    Thanks for any advice.With IE you should try the following:
    <OBJECT id='MyApplet' ...
    document.MyApplet.requestFocus();
    This worked fine for me, even without specifying additional "MAYSCRIPT" or "scriptable=true" tags. Obviously this construct managed to call the public Java method "requestFocus()" from JavaScript.
    Maybe something similar would also work for Netscape. I felt no need to do this when running in Netscape, because the Netscape browser handled focus management without problems.
    For IE I tried to workaround a problem mentioned by several people in this forum: The focus will not be regained by an applet when the user switched form IE to another application and then returns back to the browser window which contains the applet.
    Unfortunally the following code fragment worked only partially well:
    function activated()
    if (isIE)
    document.MyApplet.requestFocus();
    return true;
    window.onfocus = activated();
    OnFocus is invoked only each second time when the browser window gains back focus.
    I'm still looking for a real solution, so I'd appreciate if anybody could come up with one.
    Hope this helps a bit
    Bernd

  • Event structure does not capture mouse click event on toolbar activeX control

    Hi
    We have a toolbar activeX control on FP.  It works perfectly on my computer, but on my coworkers deskyop,  somehow the event structure doesn't capture mouse click event.
    Any idea?  Thanks a lot for any help.
    Anne

    It's a standard activeX control.  I attach a simple vi .
    thanks  for any help.
    Attachments:
    toolbar test.vi ‏41 KB

  • [Solved] Malicious application capturing mouse

    After using my computer for several hours, I will be unable to click on anything with the mouse until I reboot. On one occasion after continuing to use my computer for a few hours with this condition, a system notification popped up saying that a 'malicious application' was refusing to give up control of the mouse.
    I thought this might be a bug in Xmonad, but I've switched back to Openbox and the problem persists.
    I'm running Archbang Linux on an Eeepc with an external monitor, usb keyboard and mouse. I don't know if it's relevant, as my day always ends with these applications running, but this happens generally with Chromium, Gpodder, Gnome-MPlayer and LBreakout2 running.
    Is there a tool I can use to troubleshoot this?
    Last edited by hobonix (2011-11-07 03:00:51)

    pataphysician wrote:
    hobonix wrote:
    pataphysician wrote:Does this happen when your not using the usb mouse and keyboard?
    Since the problem started, I haven't used my laptop without those for long enough to know if they're related to it.
    Well one possibility is the mouse having a physical problem, or problems on the usb bus. If the problem remains even without the external mouse or the keyboard this can be ruled out.
    ALso have you tried to remove the usb mouse and reinsert it, after it loses focus, to see if you get your mouses focus back?
    The error message about "malicious application" can be ignored, this is a standard error message that is given if an application which needs a password entered is run, and the mouse focus doesn't shift properly. Since we already know there is a clear mouse focus issue in general, it's unlikely your dealing with a keylogger.
    I'll add that to the list of things to check, thanks. I question it being a physical problem though, as it only occurs toward the end of day.

  • How do you Capture Mouse?

    I'm new at Flex and trying to make a graphics editor for which I need the user to be able to resize the graphs the same way most graphics editors do - with a resize box. So what I'm making now is a class (that extends UIComponent) that have 4 little squares (that extend UIComponent too) at the corners that the user should use as handles to resize something. So I all need to do right now is to make them react properly to mouse inputs: the one at the top right should have the same "x" position as the one at the bottom right if the user is moving the bottom right one and so on. What I do is call startDrag in the MOUSE_DOWN event for each square and then in the MOUSE_MOVE event I move the others squares accordingly. The problem is that the square being dragged moves faster than all the others. If I could just capture mouse and then do all the dragging stuff myself that would make it a lot easier. But it seems that they didn't implement that function so, does anyone know any other possible way to do what I'm trying to do?

    Solved my problem. Here's the code in case is useful for anyone:
    // Make an event listener like this for every mouse event
    public function OnMouseDown(event:MouseEvent):void
         if(event.target is DisplayObject){
              if(!MouseOwner.contains(DisplayObject(event.target))) event.stopPropagation();
         else event.stopPropagation();
    public function CaptureMouse(Element:DisplayObjectContainer):void
        this.addEventListener(MouseEvent.MOUSE_DOWN, OnMouseDown, true);
        // Keep adding listeners for every mouse event
        MouseOwner = Element;

  • Capturing Mouse Events on Desktop??

    Is there a way to capture mouse events on the Desktop. I would like to be notified of the Mouse Location and Click Events for the entire Desktop.

    Mouse Events may only be capture INSIDE the java application frame. SO, if your desktop is not a java component, you will not be able to capture the events.
    However, you could maybe use JNI to use native methods so as to get the location of the mouse...
    vincent

  • Creator the right tool for applets?

    Hi.
    beeing new to Sun's Java Studio Creator I would like some opinions whether the Creator is the tool to use if use cases mainly focus on applets that get their data via WebServices.
    My main use case would be an applet with a tree-control showing a lot of machine tools and an area that displayes some charts. Charts would be rendered by a 3rd party component. The Applet should talk to a WebService exchanging XML-Data.
    I just don't know if Creator is the right tool for that.
    Many thanks in advance,
    Christian

    Hi.
    beeing new to Sun's Java Studio Creator I would like
    some opinions whether the Creator is the tool to use
    if use cases mainly focus on applets that get their
    data via WebServices.
    I just don't know if Creator is the right tool for
    that.
    Many thanks in advance,
    Christian<br><br>
    Personally, I would opt for Net Beans 5.0 beta 2 for this type of scenario. The IDE is much better suited for Swing and AWT type of applications. In addition, it has some impressive layout managers for Swing.
    <br><br>

  • Unable to capture Part 2 for exicse materials

    Hi
    In import Purchase order scenario I am unable to capture part 2 for excise materials
    First I have created import PO. Then I did miro where I posted BED,AED,ECS,SECss
    After that I did migo and captured part 1
    After that while I was capturing part 2 with ref to vendor invoice I m getting an error message as
    NO CENVAT AMOUNT TO BE POSTED
    NO CENVAT AMOUNT TO BE REVERSED
    We are using taxinj
    Can u please help me out in solving this issue?
    Rahul

    Hi,
    Once you have entered the needed information about the connection string and container, go to Object Tab and select the objects. then the Start button will enabled.
    Another way to reverse engineer is to use ERD component. Refre to the Note 299067.1 in Metalink.

  • To Capture Excise Duties for Customer Material

    Dear All,
    Issue is regarding to capture excise invoice
    for Customer Material.
    1.
    one of our client receives Customer material which
    should not be reflected in
    stock.
    2. Excise should be captured which
    receiving
    3. Now
    when this Customer material is returned back to
    customer along with
    the assembly (i.e. the material received from
    customer is fixed
    in Assembly and sent back to
    customer),
    4. Now
    the excise
    captured should be transfered back to customer's A/c.
    I tried
    doing by creating a material type as customer material, where in
    Stock will be reflected but value will not be reflected, where exactly
    we
    can capture the excise details for this scenario.
    How
    to
    proceed further to complete his scenario.
    Consider this
    issue
    to be on high priority &  i/p will be of great help.

    Dear Vijayashree
    From your comments what I understood is that for a particular FERT, you are procuring one component from the buyer, assembling it and invoicing to the same customer.
    If this is the scenario, I dont know how you can invoice without maintaining BOM for that.
    If the client don’t want to maintain BOM for the same, the only option is as follows to my knowledge.
    Whenever the client receives the component, take credit of the duty amount by updating <b>J1IH</b>. While doing PGI, since you have not maintained this component in BOM, stock will <i>ONLY</i> reduce for other components.  So no-where, your client can track the customer’s component.
    Parallelly, apart from selling price, to the extent of excise duty value, one more condition (say ABCD,  to be maintained.  So in your pricing procedure, the assessable value should be PR00 + ABCD for which, the excise duty should be captured so that the client can recover the duty amount from customer.
    Finally, for this practice, the client should maintain datas (how many procured and how many invoiced) manually to convince the government officials but then, I am not sure, how far this will be accepted by the officials.
    Thanks
    G. Lakshmipathi

Maybe you are looking for

  • IPhone 4s voice over locked phone

    Hi does anyone know how to unlock the phone as it's saying when I enter my password that it's incorrect as the voice over is locking the keys some how? Any ideas please

  • PO Migration - GR Open ,  IR Done

    Dear All, We are currently in PO data migration. I have this case where our users didnt clean the PO and we cannot do any transactions anymore from the source system. When i migrate the PO, line items with Open GR and IR done were migrated.  IR done

  • Error 'ORA-01403 no data found', if a procedure called through $Universe

    Hello, we use at our customer the scheduling software $Universe. The problem follows is happend at calling PL/SQL-procedures within SQL*Plus: Within the calling procedur another subprogram will be called. This program crashed on select of currval wit

  • Can I Open an HTMLHelp (*.CHM) File from Java GUI Application?

    I ussually use Delphi to develop my applications and I can open an HTMLHelp (*.CHM) file from my application. Can you show me the ways to do it from my Java GUI applications? Thanks for everyone. Budi Raharjo http://budiraharjo.blogspot.com

  • Error in "Create ERP Customer"

    When using "Create ERP Customer", i am getting error message "Enter a relevant role for creation of customer master data".  What specifically am I missing, I believe I configured the CVI. I am on MDG7.0. Thanks for assistance