AWT / CATATAN</>↗AWT02 Jan 2010
The example below show you how to activate the Num Lock button programmatically. Setting the locking state to Boolean.TRUE will turn the Num Lock on. package org.kodejava.awt; import java.awt.Toolkit; import java.awt.event.KeyEvent; public class TurnNumLockOn { public static void main(String[] args) { // Gets the default toolkit. Toolkit toolkit = Toolkit.getDefaultToolkit(); // Update the locking state […]
AWT / CATATAN</>↗AWT28 Des 2009
The code below show you how to activate the Caps Lock button programmatically. Setting the locking state to Boolean.TRUE will turn the Caps Lock on. package org.kodejava.awt; import java.awt.Toolkit; import java.awt.event.KeyEvent; public class TurnCapsLockOn { public static void main(String[] args) throws Exception { // Gets the default toolkit. Toolkit toolkit = Toolkit.getDefaultToolkit(); // Update the […]
AWT / CATATAN</>↗AWT26 Des 2009
This example show you how to detect if the Scroll Lock key is in active mode. If you run the program you will get an output telling you that the Scroll Lock button is active or not active. package org.kodejava.awt; import java.awt.Toolkit; import java.awt.event.KeyEvent; public class ScrollLockState { public static void main(String[] args) { Toolkit […]
AWT / CATATAN</>↗AWT25 Des 2009
This example show you how to detect if the Num Lock key is in active mode. If you run the program you will get an output telling you that the Num Lock button is active or not active. package org.kodejava.awt; import java.awt.Toolkit; import java.awt.event.KeyEvent; public class NumLockState { public static void main(String[] args) { Toolkit […]
AWT / CATATAN</>↗AWT23 Des 2009
This example show you how to detect if the Caps Lock key is in active mode. package org.kodejava.awt; import java.awt.Toolkit; import java.awt.event.KeyEvent; public class CapsLockState { public static void main(String[] args) { // Get the locking state of the Caps Lock button. This method // return boolean true value if it is "on". boolean isOn […]
AWT / CATATAN</>↗AWT11 Mei 2009
MouseInfo provides methods for getting information about the mouse, such as mouse pointer location and the number of mouse buttons. package org.kodejava.awt; import java.awt.*; public class MouseNumberOfButtons { public static void main(String[] args) { // Get the number of buttons on the mouse. On systems without a // mouse, returns -1. HeadlessException if // GraphicsEnvironment.isHeadless() […]