Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our User Agreement and Privacy Policy.

Slideshare uses cookies to improve functionality and performance, and to provide you with relevant advertising. If you continue browsing the site, you agree to the use of cookies on this website. See our Privacy Policy and User Agreement for details.

Java Virtual Keyboard Using Robot, Toolkit and JToggleButton Classes

A Virtual Keyboard is considered to be a component to use on computers without a real keyboard e.g. Touch Screen Computers and Smart Phones; where a mouse can utilize the keyboard functionalities and features.
In addition, Virtual Keyboard used for the following subjects: Foreign Character Sets, Touchscreen, Bypass Key Loggers, etc.

Great work but still i think it's not a perfect implementation for Touch Screens Your Virtual Keyboard will work really fine with Mouse but with Touch i think there are going to be little issues. Please view this link: http://www.codeproject.com/Articles/13596/Touchscreen-Keyboard-UserControl it's implementation in C# but nice and effective. I will look forward for your feedback. Thanks for your slide

5.
Introduction to Virtual Keyboard
» A virtual keyboard is considered to be a
component to use on computers without a
real keyboard e.g.
˃ touch screen computer
» A mouse can utilize the keyboard
functionalities and features. 5
https://www.facebook.com/Oxus20

8.
Exception Handling
» A program can be written assuming that nothing unusual or
incorrect will happen.
˃ The user will always enter an integer when prompted to do so.
˃ There will always be a nonempty list for a program that takes an entry from the list.
˃ The file containing the needed information will always exist.
» Unfortunately, it isn't always so.
» Once the core program is written for the usual, expected
case(s), Java's exception-handling facilities should be
added to accommodate the unusual, unexpected case(s).
8

13.
JToggleButton Class
» JToggleButton is an implementation of a two-state
button and is used to represent buttons that can be
toggled ON and OFF
» The JRadioButton and JCheckBox classes are
subclasses of this class.
» The events fired by JToggleButtons are slightly
different than those fired by JButton. 13
https://www.facebook.com/Oxus20

14.
JToggleButton Demo
» The following example on next slide demonstrates
a toggle button. Each time the toggle button is pressed,
its state is displayed in a label.
» ﻿Creating JToggleButton involves these steps:
1. Create an instance of JToggleButton.
2. Register an ItemListener to handle item events generated by the button.
3. To determine if the button is on or off, call isSelected().
14
https://www.facebook.com/Oxus20

19.
Java Robot Class
» This class is used to generate native
system input events for the
purposes of
˃ test automation
˃ self-running demos
˃ and other applications where control of the mouse
and keyboard is needed.
» This class has three main
functionalities:
˃ mouse control
˃ keyboard control
˃ and screen capture.
https://www.facebook.com/Oxus20
19

20.
Robot Class Demo
» Perform keyboard operation with help of java Robot class.
» The following example on next slide will demonstrate the
Robot class usage to handle the keyboard events.
» The program will write the word "OXUS20" inside the
TextArea automatically after running the program.
» The word "OXUS20" will be written character by character
with one second delay between each on of the
characters. 20
https://www.facebook.com/Oxus20

24.
Toolkit class
» Toolkit is an AWT class acting as a base class for all
implementations of AWT.
» This class offers a static method getDefaultToolkit() to return
a Toolkit object representing the default implementation of
AWT.
» You can use this default toolkit object to get information of the
default graphics device, the local screen, and other purposes.
» Next slide demonstrate an example finding out the actual size
and resolution of your screen. 24
https://www.facebook.com/Oxus20

27.
Another Toolkit Example
» Change the state of the Caps Lock key
˃ If Caps Lock key is ON turn it OFF
˃ Otherwise, if Caps Lock key is OFF turn it ON
» Toolkit.getDefaultToolkit().setLockingKeyState(
KeyEvent.VK_CAPS_LOCK, false);
˃ This line of code will change the state of the Caps Lock key OFF.
» Toolkit.getDefaultToolkit().setLockingKeyState(
KeyEvent.VK_CAPS_LOCK, true);
˃ This line of code will change the state of the Caps Lock key ON.
» Accordingly the keyboard LEDs flash will become
ON or OFF. 27
https://www.facebook.com/Oxus20