I'm trying to create an application so when the user tries to enter a capslock letter in a JTextfield or something it will bring up an error informing the user to turn off the capslock.
import java.awt.*;
import java.awt.event.*;
public class NewClass
{
private static String check="false";
public static void main(String[] args)
{
if ( Toolkit.getDefaultToolkit().getLockingKeyState (KeyEvent.VK_CAPS_LOCK ) );
check="true";
if(check.equals(true));
System.out.println("Turn it off");
{
}
}
How can I use a boolean with
( Toolkit.getDefaultToolkit().getLockingKeyState (KeyEvent.VK_CAPS_LOCK ) );
so if it's true show message to turn it off?