Mouse status without event?

Is there any way to get information about the mouse (e.g., which buttons if any are pressed) without an MouseEvent?
I'm listening for Component events, and in the componentResized method I'd like to know if the mouse button is down so I can ignore the resizing events until the user is done resizing. There's no "isAdjusting" option like JSlider has.
Thanks.
-J

What you could do is add a mouse listener to your component, and when you detect a mousePressed event, set an internal flag like "buttonDown" or something so that your componentResized method knows when to ignore that event. Maybe something like this:
  myComponent.addMouseListener(new MouseAdapter()
    public void mousePressed(MouseEvent e)
      mouseButtonDown = true;
    public void mouseReleased(MouseEvent e)
      mouseButtonDown = false;
  myComponent.addComponentListener(new ComponentAdapter()
    public void componentResized(ComponentEvent e)
      if (mouseButtonDown)
        return;
      // now do whatever

Similar Messages

  • How to identify mouse status

    Hello friends,
    Is it possible to identify the mouse status , I stress mouse status not mouse event i would like to identify mouse cursor type at any instant of time is it possible.
    One more thing is it posible to get the mouse cursor type outside a awt component
    Regards
    hari

    You would have to use the public Cursor getCursor() method of java.awt.Component to do what you're talking about. Additionally, without looking into native code, I don't think it would be possible to get the mouse status outside of your application (like if you had your mouse on a system-depent xterm window or visual basic application).
    -bx

  • Mouse wheel scroll event ON CHANGE?

    Colleagues,
    Very simple question:
    How to get mouse wheel scrolling event on change? Without polling?
    Is Acquire Input Data.vi the only way to get it?
    Thank you in advance,
    Andrey.

    Hi Andrey,
    i think it's not build in. I wrote some years ago the attched vi's, because i also miss this feature. These vi's use the "acquire input data.vi", but it only polls if a control has registered for it.
    Hope it helps.
    Mike
    Attachments:
    ScrollEvent_LV71.zip ‏461 KB

  • Capture All Mouse and Keyboard events even if java window NOT in FOCUS

    Hi All,
    Is this possible to capture all mouse and keyboard events even if java window is not in focus or is minimized. This java program should cature each and every event from the user once the program is started. Any help in this regard is appreciated!
    Thanks&Regards
    Sam

    I don't think you can. (without JNI)

  • How to change Pre-Payment invoice status (without applying)

    Hi,
    I have a paid pre-payment invoice. But i don't need to create standard invoice for it now.
    How do i change the Pre-Payment invoice status (without applying)? ......i.e. it should not be able to apply against any standard invoice.
    eg. maybe change status to 'Fully Applied'
    Thanks

    Closed due to non-response.

  • How can I stop coalescing of mouse move/drag events in jdk1.6 ?

    Hello all,
    My application uses a [pen-based tablet|http://en.wikipedia.org/wiki/Graphics_tablet] to draw lines/curves. But the problem is: when I run my application, due to java’s default behavior of discarding the mouse events which occurs during the repaint call, the curves results in the set of joined straight lines.
    To overcome this problem, when searched over net, came across below link:
    [http://forums.sun.com/thread.jspa?messageID=10811388]
    I tried the option provided at the above URL i.e. overriding the below method of Component.java file:
    protected AWTEvent coalesceEvents(AWTEvent existingEvent,AWTEvent newEvent);
    But later found that, overriding this method worked fine for me for jdk1.5 but this solution did not work in case of jdk1.6. When reviewed the source of Component.java and EventQueue.java files in jdk1.6, found that this method is not having any implementation and simply returns “null” and the complete handling of coalescing of events occurs within EventQueue.java file’s local method which is mentioned below:
    private boolean coalesceEvent(AWTEvent e, int priority);
    As this method is part of EventQueue.java and also it is a private method, I am not finding any way to stop the coalescing of mouse move/drag events in jdk1.6.
    The main problem is that my application is purely based on jdk1.6 only.
    Can anybody help me out to solve this problem by providing any option of preventing the coalescing of mouse move/drag events in case of jdk1.6.
    Thank you.

    Look at the link I posted, you aren't double buffering correctly.
    I saw the other post you mistakenly made before you edited it. Not really a big deal, I was just wondering why you did that.

  • In Flashplayer, I can crossover mouse and keyboard events. In IrfanView I cannot. Can this be fixed?

    My client uses IrfanView to play SWF files. Unfortunately, he does not use Flashplayer. In Flashplayer, I can crossover mouse and keyboard events with no problem. In IrfanView, the second I click a button, the keyboard events are disabled. Is there a fix?

    Hi Ned. I may have posted this issue a bit early, but this problem is also happening in Flashplayer 10. It's not exclusive to IrfanView.
    Here is something that I encountered during my testing, when I jump to scene 6 using the menu button, I have a play button to jump from one frame to the next frame that stops -- the keyboard events start working. But if all I am doing is jumping scene to scene with the mouse button, the keyboard events are disabled.
    I feel as if the keyboard events only work if I am playing frames in the scene. And if all I am doing is jumping scene to scene using the buttons, the keys will disable.
    I set up the mouse buttons inside a movieclip that all the scenes share. The mouse actionscript is in the movieclip. On the main timeline of each scene is an actionscript for the keyboard events, even though I had to change each function name.
    I feel the actionscript is setup pretty simple. I just wish clicking the buttons would not disable the keyboard events. This may sound redundant, but the keyboard events do the same thing if you use the mouse buttons. It's just preference for the client even though he will need to understand that using the mouse buttons override the keyboard events. He doesn't really lose functionality.
    Keyboard actionscripting below:
    import flash.events.KeyboardEvent;
    stage.addEventListener(KeyboardEvent.KEY_DOWN, onKeyEvent);
    function onKeyEvent(e:KeyboardEvent):void {
    var character:String=String.fromCharCode(e.charCode);
    if (e.keyCode==72) {
      gotoAndStop(1,"master");
    if (e.charCode==49) {
      gotoAndPlay(1,"Distributor");
    if (e.charCode==50) {
      gotoAndPlay(1,"Mirka");
    if (e.charCode==51) {
      gotoAndPlay(1,"Farm");
    if (e.charCode==52) {
      gotoAndPlay(1,"Check2");
    if (e.charCode==53) {
      gotoAndPlay(1,"Check3");
    if (e.charCode==54) {
      gotoAndPlay(1,"Scene2");
    if (e.charCode==55) {
      gotoAndPlay(1,"Scene1");

  • Bring user status without status number in Notification

    Hi,
    I need to bring user status without status number in Notification infoObject using status concept.
    Please help me to fix this.
    Thanks

    Hi Pria,
    Wht i understand is that you want the status of notifications.
    In the Notif Datasource you wull have OBJNR,Object Number and all the Status are stored in JEST table.
    Pass the OBJNR from Notif to JEST and populate the Status.
    Hope this helps,...else let us know the exact issue,
    rgds
    SVU

  • Changing a Status without having write permission?

    Hi,
    is it possible to change a status without having write permission on the cFolders Dokument Object? It it is possible, how can i do that?
    Thanks!

    I solved this Problem myself!
    It is possible to give permission on status transition. That was what i was searching for!
    Thanks!

  • Razer Abyssus mouse sends click events but no movement in X

    This is very strange: my mouse sends click events to X, but it does not move the cursor.  I don't have any funny packages installed and don't have an xorg.conf.  What can I do to make my mouse work?
    Bus 005 Device 003: ID 1532:001c Razer USA, Ltd RZ01-0036 Optical Gaming Mouse [Abyssus]

    Whooa, ok ... after unplugging it and plugging it back in, it works.  Strange.

  • Lock all mouse and keyboard event.

    i am looking ways to lock up all the mouse and keyboard events in windows...do u guy have ways to solve this?

    Do you mean that people should not be able to start other applications, or switch to other running applications, before they have typed the right password into you java program? I don't think that can be done in java - it requires more control over the computer than Java typically gives you. You may have some success with full-screen AWT, though.
    But why not use log-on-systems incorporated in whatever operating system you are using? Or some other netware thingie? Honestly, I think you are trying to reinvent the wheel, and even with tool that's not very appropriate.

  • 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.

  • How to check repair status without id reference

    I sent my iPhone back over a week ago and have heard nothing.  I cannot check status without id reference but i never received an email with a reference

    Then contact Apple and as them.

  • Status without application toolbar?

    Hi all. Is anybody know if it's possible to set status without application toolbar? I meen if I use status without any buttons on application toolbar, there is a blank line on the screen in place of it. How can i remove it?

    If you are using module pool then you can use a opup screen or subscreen for this purpose.
    For creating buttons on the selection screen without using application toolbar,you can have a look at the following code :
    REPORT demo_sel_screen_pushbutton.
    TABLES sscrfields.
    DATA flag(1) TYPE c.
    SELECTION-SCREEN:
      BEGIN OF SCREEN 500 AS WINDOW TITLE tit,
        BEGIN OF LINE,
          PUSHBUTTON 2(10) but1 USER-COMMAND cli1,
          PUSHBUTTON 12(10) text-020 USER-COMMAND cli2,
        END OF LINE,
        BEGIN OF LINE,
          PUSHBUTTON 2(10) but3 USER-COMMAND cli3,
          PUSHBUTTON 12(10) text-040 USER-COMMAND cli4,
        END OF LINE,
      END OF SCREEN 500.
    AT SELECTION-SCREEN.
      MESSAGE i888(sabapdocu) WITH text-001 sscrfields-ucomm.
      CASE sscrfields-ucomm.
        WHEN 'CLI1'.
          flag = '1'.
        WHEN 'CLI2'.
          flag = '2'.
        WHEN 'CLI3'.
          flag = '3'.
        WHEN 'CLI4'.
          flag = '4'.
      ENDCASE.
    START-OF-SELECTION.
      tit  = 'Four Buttons'.
      but1 = 'Button 1'.
      but3 = 'Button 3'.
      CALL SELECTION-SCREEN 500 STARTING AT 10 10.
      CASE flag.
        WHEN '1'.
          WRITE / 'Button 1 was clicked'.
        WHEN '2'.
          WRITE / 'Button 2 was clicked'.
        WHEN '3'.
          WRITE / 'Button 3 was clicked'.
        WHEN '4'.
          WRITE / 'Button 4 was clicked'.
        WHEN OTHERS.
          WRITE / 'No Button was clicked'.
      ENDCASE.

  • Mouse Enter/Exit Events

    Hi,
    I've got a question regarding mouse enter/exit events. Specifically, I would like to know why so many mouse enter/exit events are generated. Suppose you stack multiple Panes like this:
    @Override
    public void start(Stage frame) throws Exception {
         Pane root = new Pane();
         frame.setScene(new Scene(root));
         addEnterExitHandlers(root, "root");
         Pane fst = new Pane();
         root.getChildren().add(fst);
         addEnterExitHandlers(fst, "first");
         Pane snd = new Pane();
         fst.getChildren().add(snd);
         addEnterExitHandlers(snd, "second");
         Rectangle rect = new Rectangle(0, 0, 100, 100);
         snd.getChildren().add(rect);
         addEnterExitHandlers(rect, "rect");
         frame.show();
    The addEnterExitHandlers() method simply registers event handlers for MouseEvent.MOUSE_ENTERED_TARGET and MouseEvent.MOUSE_EXITED_TARGET which print the event type's name together with the specified string.
    The resulting output looks like this:
    root MOUSE_ENTERED
    first MOUSE_ENTERED
    root MOUSE_ENTERED_TARGET
    second MOUSE_ENTERED
    first MOUSE_ENTERED_TARGET
    root MOUSE_ENTERED_TARGET
    rect MOUSE_ENTERED
    second MOUSE_ENTERED_TARGET
    first MOUSE_ENTERED_TARGET
    root MOUSE_ENTERED_TARGET
    root MOUSE_EXITED
    first MOUSE_EXITED
    root MOUSE_EXITED_TARGET
    second MOUSE_EXITED
    first MOUSE_EXITED_TARGET
    root MOUSE_EXITED_TARGET
    rect MOUSE_EXITED
    second MOUSE_EXITED_TARGET
    first MOUSE_EXITED_TARGET
    root MOUSE_EXITED_TARGET
    This output is not accurate, because I inserted empty lines to visually group related elements.
    As you can see, a MOUSE_ENTERED event is fired for every node and all parent nodes receive MOUSE_ENTER_TARGET events. I just thought that it would be sufficient to only fire the last group of enter/exit events, respectively, i.e.:
    rect MOUSE_ENTERED
    second MOUSE_ENTERED_TARGET
    first MOUSE_ENTERED_TARGET
    root MOUSE_ENTERED_TARGET
    rect MOUSE_EXITED
    second MOUSE_EXITED_TARGET
    first MOUSE_EXITED_TARGET
    root MOUSE_EXITED_TARGET
    Is there a specific reason for the behavior?
    Best regards,
    Matthias

    Hi Matthias,
    yes, there is a reason for this. In vast majority of use-cases, the entered/exited handlers are added on a node to handle the case when mouse enters/exits the node. The _TARGET variants tell you "this node or some of its children was entered/exited", which is not quite it. So right now, if you want to check that fst was entered, you just do:
    fst.setOnMouseEntered(new EventHandler<MouseEvent>() {
      @Override public void handle(MouseEvent e) {
        // your code
    If we generated only the last group of events as you suggest, you would have to do:
    fst.addEventHandler(MouseEvent.MOUSE_ENTERED_TARGET, new EventHandler<MouseEvent>() {
      @Override public void handle(MouseEvent e) {
        if (e.getTarget() == fst) {
          // your code
    Even if we added the convenience handlers for the _TARGET variants (setOnMouseEnteredTarget), having to always check the target would be pretty annoying.
    Cheers,
    Pavel

Maybe you are looking for

  • Unable to Find "Oracle BI Publisher" menu in MS-WORD

    Hi, I have de-installed oracle bi publisher desktop and re-installed it, i could find the "Insert,Data,Preview" toolbar but couldnot get Oracle BI Publisher menu near help menu in MS-WORD. I am using MS-WORD 2003 and have tried re-installing but no l

  • Cannot reduce file size in Acrobat X due to "image masks"

    Occasionally, when I try to reduce the file size of a PDF file in Acrobat X, I am getting the error message that the file was not re-rendered because of "image masks". What precisely does this mean? How are image masks created in the PDF production p

  • How do I get the Interval to keep from repeating after it's used once?

    How do I get the Interval to keep from repeating after it's used once? Because I tried clearInterval but I couldn't get it working. When my code looks like this, with ClearInterval, it refuses to execute my action, which is to change scenes after a s

  • Best value for optimizer_mode

    In my production environment we have to move from Rule based optimizer to cost based optimizer . We work with oracle 10g but until now our application before run queries execute an alter session set optimizer_mode=rule. What is the best value for thi

  • Forms10g failed test

    Hi, I'm developin an application using forms10g and oracle DB9i. I can't test which i'd built. I have IExplorer6 and Opera7 as browser, however none execute successfully the servlet. when i want tested the form, a browser session is opened but with n