Wednesday 26 June 2013

How to check Caps Lock on

I've been using this method to confirm if caps lock key on the keyboard is on or not. Here it is, Just thought of sharing it might ne useful to you
I've been using this method to confirm if caps lock key on the keyboard is on or not. Here it is, Just thought of sharing it might ne useful to you

import java.awt.Toolkit //for the Toolkit class

public static boolean checkCapsLock(){
     boolean pressed = false
     if(Toolkit.getDefaultToolkit().getLockingKeyState(KeyEvent.VK_CAPS_LOCK) == true){
          pressed = true;
     }
     return pressed;
}

Welcome

You are welcome to JCorpus:
A Programming blog for JAVA programmers. Feel free to ask questions and check for tutorials for your JAVA development.Also, If you've got any super code you want the world to know about, please feel free to drop it here.
Note: All posts are subject to administrator's verification.