如果按下的按钮是 CapsLk

If button pressed is CapsLk

如何检查按下的键是 CapsLk。

    if(e2.getKeyChar() == ?)
{

text_area.setText("CapsLk is pressed")

}
if(e2.getKeyCode() == KeyEvent.VK_CAPS_LOCK){
    text_area.setText("CapsLk is pressed");
}