Results 1 to 8 of 8

Thread: Freeze cursor

  1. #1
    Gog
    Gog is offline Member
    Join Date
    Jan 2011
    Posts
    9
    Rep Power
    0

    Smile Freeze cursor

    Hi all,

    Do you know method how freeze mouse (cursor)? :)

    Thx.

  2. #2
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Quote Originally Posted by Gog View Post
    Do you know method how freeze mouse (cursor)? :)

    ....... Yes.....

    ...... but the answer depends completely on the context, something you haven't told us. Please read the link below on how to ask smart questions.

    edit: by context I mean is this a Swing app? AWT? SWT? Console? Other? Where is the cursor? What is the app supposed to be doing? What is it not doing? in other words all the details that make your question answerable.
    Last edited by Fubarable; 01-14-2011 at 03:00 PM.

  3. #3
    Gog
    Gog is offline Member
    Join Date
    Jan 2011
    Posts
    9
    Rep Power
    0

    Default

    Sorry for that,

    Swing app, it is not matter where is the cursor; It start external app (VLC) and VLC start VIDEO - I want freeze cursor so that user cannot changer references (options) of VLC.

    PS: I want freeze mouse and hide cursor (I cant find these metods) :-(

  4. #4
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    So, let me make sure I fully understand what you're trying to do. You are using Java to start an external application (no problem there), and then want to use Java to change how the operating system interacts with this external application. If this is correct then you must understand that you can't do this with core Java, that Java was built to be OS agnostic (as much as possible) and so it is unable to directly control the OS. You're going to have to find another way such as a use a C program and connect this to Java via JNI. Either that or make OS calls via JNA.

    If my assumptions are incorrect, please clarify for me.

    Luck.

  5. #5
    Gog
    Gog is offline Member
    Join Date
    Jan 2011
    Posts
    9
    Rep Power
    0

    Default

    So, let me make sure I fully understand what you're trying to do. You are using Java to start an external application (no problem there), and then want to use Java to change how the operating system interacts with this external application.

    You have right!

    OK, I am begginer so I dont uderstand this.

    Do you have any idea how user cannot change options of VLC player? (On kiosk)

  6. #6
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Quote Originally Posted by Gog View Post
    Do you have any idea how user cannot change options of VLC player? (On kiosk)
    Google JNI and JNA, or better yet, start with the Wikipedia entry on these:

    JNI: Java Native Interface - Wikipedia, the free encyclopedia

    JNA: Java Native Access - Wikipedia, the free encyclopedia

    Note that working with these is not for the faint at heart.

  7. #7
    Gog
    Gog is offline Member
    Join Date
    Jan 2011
    Posts
    9
    Rep Power
    0

    Default

    look at this ->

    Java Code:
    import com.sun.jna.Library;
    import com.sun.jna.Native;
     
    public class BeepExample {
       public interface Kernel32 extends Library {
           public void Sleep(int DURATION);
       }
     
       public static void main(String[] args) {
    	Kernel32 lib = (Kernel32) Native.loadLibrary("kernel32", Kernel32.class);
    	lib.Sleep(500);
       }
    }
    This sleep program, but no cursor, right?

  8. #8
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Quote Originally Posted by Gog View Post
    look at this ->

    Java Code:
    import com.sun.jna.Library;
    import com.sun.jna.Native;
     
    public class BeepExample {
       public interface Kernel32 extends Library {
           public void Sleep(int DURATION);
       }
     
       public static void main(String[] args) {
    	Kernel32 lib = (Kernel32) Native.loadLibrary("kernel32", Kernel32.class);
    	lib.Sleep(500);
       }
    }
    This sleep program, but no cursor, right?
    Per the MSDN, this will cause the current thread to sleep 500 milliseconds: Sleep Function

    Per my review, there is no mention in the documentation that this will do anything to the cursor, and I assume that it in fact should not effect the cursor.

Similar Threads

  1. Serial Comm freeze
    By java_dude in forum Networking
    Replies: 3
    Last Post: 01-13-2011, 10:09 PM
  2. intermittent freeze in JavaWebstart Swing App
    By ambs in forum AWT / Swing
    Replies: 0
    Last Post: 07-27-2010, 04:39 PM
  3. change the mouse cursor - crosshair cursor
    By cassysumandak in forum New To Java
    Replies: 1
    Last Post: 09-28-2009, 01:57 AM
  4. [SOLVED] How To Freeze Tab/s from JTabbedPane
    By javanewbie in forum New To Java
    Replies: 2
    Last Post: 06-10-2009, 09:42 AM
  5. freeze radioButton without disable them
    By itaipee in forum AWT / Swing
    Replies: 5
    Last Post: 05-25-2009, 09:29 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •