Results 1 to 5 of 5
  1. #1
    gib65 is offline Member
    Join Date
    Jun 2010
    Posts
    86
    Rep Power
    0

    Default turning off key-repeat

    Is there a way to turn off key-repeat in a Java program? I'm talking about when you press a key down and after about a second it repeats continuously.

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

    Default

    I think that this is controlled by the OS and not by Java. If I'm correct, then no, there's no way to change this behavior in Java.

  3. #3
    crikey is offline Senior Member
    Join Date
    Jul 2010
    Posts
    125
    Rep Power
    0

    Default

    If this is a GUI, you can right up a key listener. Inside this listener, if the System.getCurrentTimeMillis() between two keytypes is less then 100ms, you can set the JComponent to disabled.

  4. #4
    gib65 is offline Member
    Join Date
    Jun 2010
    Posts
    86
    Rep Power
    0

    Default

    Quote Originally Posted by Fubarable View Post
    I think that this is controlled by the OS and not by Java. If I'm correct, then no, there's no way to change this behavior in Java.
    Does Java have utilities for talking to the OS?

  5. #5
    Dennis's Avatar
    Dennis is offline Member
    Join Date
    May 2010
    Posts
    83
    Rep Power
    0

    Default

    You can use this:
    Java Code:
    			boolean b = false;
    			public void keyPressed(KeyEvent e) {
    				if(!b){
    					//Here the code
    				}
    				b = true;
    			}
    
    			public void keyReleased(KeyEvent e) {
    				b = false;
    			}

Similar Threads

  1. Turning a Bug around.
    By Nightshadow_t2 in forum New To Java
    Replies: 3
    Last Post: 02-17-2010, 09:03 AM
  2. Turning an image to binary
    By morghul in forum New To Java
    Replies: 3
    Last Post: 01-17-2010, 08:47 PM
  3. Help with a repeat
    By leeavital in forum New To Java
    Replies: 1
    Last Post: 01-01-2010, 10:42 PM
  4. Turning numbers into asterisks.
    By BugginVT in forum New To Java
    Replies: 7
    Last Post: 02-25-2009, 08:38 AM
  5. nested <ui:repeat> - problem
    By hackerofcrackers in forum JavaServer Faces (JSF)
    Replies: 0
    Last Post: 06-20-2008, 11:06 AM

Posting Permissions

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