SlideShare uma empresa Scribd logo
1 de 35
Baixar para ler offline
https://www.facebook.com/Oxus20
oxus20@gmail.com JAVA
Virtual
Keyboard
» Exception
Handling
» JToggleButton Class
» Robot Class
» Toolkit Class
Prepared By: Nahid Ahmadi
Edited By: Abdul Rahman Sherzad
Agenda
» Virtual Keyboard
» Exception Handling
» JToggleButton Class
» Robot Class
» Toolkit Class
» Virtual Keyboard Implementation
2
https://www.facebook.com/Oxus20
https://www.facebook.com/Oxus20
3
Virtual Keyboard Using JAVA
4
https://www.facebook.com/Oxus20
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
Virtual Keyboard Usage
» It is possible to obtain keyboards for the
following specific purposes:
˃ Keyboards to fill specific forms on sites
˃ Special key arrangements
˃ Keyboards for dedicated commercial sites
˃ etc.
» In addition, Virtual Keyboard used for the
following subjects:
˃ Foreign Character Sets
˃ Touchscreens
˃ Bypass key loggers
6
https://www.facebook.com/Oxus20
https://www.facebook.com/Oxus20
7
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
Exception Hierarchy
9
https://www.facebook.com/Oxus20
Exception Handling Demo
Source code
public class ExceptionHandlingDemo {
public static void main(String args[]) {
try {
int scores[] = { 90, 85, 75, 100 };
System.out.println("Access element nine:" + scores[9]);
} catch (ArrayIndexOutOfBoundsException e) {
System.out.println("Exception thrown:" + e);
}
System.out.println("nWithout Exception Handling I was
not able to execute and print!");
}
}
10
https://www.facebook.com/Oxus20
Exception Handling Demo
OUTPUT
Exception
thrown:java.lang.ArrayIndexOutOfBoundsEx
ception: 9
Without Exception Handling I was not
able to execute and print!
11
https://www.facebook.com/Oxus20
https://www.facebook.com/Oxus20
12
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
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
JToggleButton Demo
Source Code
import java.awt.FlowLayout;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JToggleButton;
class JToggleButtonDemo {
JLabel lblOutput;
JToggleButton btnOnOff;
JFrame win;
JToggleButtonDemo() {
// JFrame Customization
win = new JFrame("Using JToggleButton");
win.setLayout(new FlowLayout());
win.setSize(300, 80);
win.setLocationRelativeTo(null);
win.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
15
https://www.facebook.com/Oxus20
// JToggleButton and JLabel Customization
lblOutput = new JLabel("State : OFF");
btnOnOff = new JToggleButton("On / Off", false);
// Add item listener for JToggleButton.
btnOnOff.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent ie) {
if (btnOnOff.isSelected()) {
lblOutput.setText("State : ON");
} else {
lblOutput.setText("State : OFF");
}
}
});
// Add toggle button and label to the content pane.
win.add(btnOnOff);
win.add(lblOutput);
win.setVisible(true);
}
public static void main(String args[]) {
new JToggleButtonDemo();
}
} 16
https://www.facebook.com/Oxus20
JToggleButton Demo
OUTPUT
17
https://www.facebook.com/Oxus20
https://www.facebook.com/Oxus20
18
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
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
Robot Class Demo
Source Code
import java.awt.AWTException;
import java.awt.BorderLayout;
import java.awt.Robot;
import java.awt.event.KeyEvent;
import javax.swing.JFrame;
import javax.swing.JTextArea;
public class RobotDemo extends JFrame {
public RobotDemo() {
// JFrame with TextArea Settings
setTitle("OXUS20 Robot Demo");
setSize(400, 200);
setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
setLocationRelativeTo(null);
JTextArea txtOXUS = new JTextArea();
add(txtOXUS, BorderLayout.CENTER);
setVisible(true);
} 21
https://www.facebook.com/Oxus20
public static void main(String[] args) {
new RobotDemo();
// Store Keystrokes "OXUS20" in an array
int keyInput[] = { KeyEvent.VK_O, KeyEvent.VK_X, KeyEvent.VK_U,
KeyEvent.VK_S, KeyEvent.VK_2, KeyEvent.VK_0 };
try {
Robot robot = new Robot();
// press the shift key
robot.keyPress(KeyEvent.VK_SHIFT);
// This types the word 'OXUS20' in the TextArea
for (int i = 0; i < keyInput.length; i++) {
if (i > 0) {
robot.keyRelease(KeyEvent.VK_SHIFT);
}
robot.keyPress(keyInput[i]);
// pause typing for one second
robot.delay(1000);
}
} catch (AWTException e) {
System.err.println("Exception is happening!");
}
} // end of main()
} // end of RobotDemo class 22
https://www.facebook.com/Oxus20
https://www.facebook.com/Oxus20
23
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
Toolkit Class Demo
Source Code
import java.awt.Dimension;
import java.awt.Toolkit;
public class ToolkitDemo {
public static void main(String[] a) {
Toolkit tk = Toolkit.getDefaultToolkit();
Dimension d = tk.getScreenSize();
System.out.println("Screen size: " + d.width + "x" + d.height);
System.out.println("nScreen Resolution: " +
tk.getScreenResolution());
}
}
25
https://www.facebook.com/Oxus20
Toolkit Class Demo
OUTPUT
Screen Size: 1366x768
Screen Resolution: 96
26
https://www.facebook.com/Oxus20
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
Another Toolkit Class Demo
Source Code
import java.awt.FlowLayout;
import java.awt.Toolkit;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.KeyEvent;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JToggleButton;
class ChangeCapsLockStateDemo {
JLabel lblOutput;
JToggleButton btnOnOff;
JFrame win;
ChangeCapsLockStateDemo() {
// JFrame Customization
win = new JFrame("Using JToggleButton");
win.setLayout(new FlowLayout());
win.setSize(300, 80);
win.setLocationRelativeTo(null);
win.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 28
https://www.facebook.com/Oxus20
// JToggleButton and JLabel Customization
lblOutput = new JLabel("CapsLock : OFF");
Toolkit.getDefaultToolkit().setLockingKeyState(KeyEvent.VK_CAPS_LOCK, false);
btnOnOff = new JToggleButton("On / Off", false);
// Add item listener for JToggleButton.
btnOnOff.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent ie) {
if (btnOnOff.isSelected()) {
lblOutput.setText("CapsLock : ON");
Toolkit.getDefaultToolkit().setLockingKeyState(KeyEvent.VK_CAPS_LOCK, true);
} else {
lblOutput.setText("CapsLock : OFF");
Toolkit.getDefaultToolkit().setLockingKeyState(KeyEvent.VK_CAPS_LOCK, false);
}
}
});
// Add toggle button and label to the content pane.
win.add(btnOnOff);
win.add(lblOutput);
win.setVisible(true);
}
public static void main(String args[]) {
new ChangeCapsLockStateDemo();
}
}
29
https://www.facebook.com/Oxus20
Another Toolkit Class Demo
OUPUT
30
https://www.facebook.com/Oxus20
https://www.facebook.com/Oxus20
31
Java Virtual Keyboard
Source Code
import java.awt.AWTException;
import java.awt.Color;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.ItemEvent;
import java.awt.event.ItemListener;
import java.awt.event.KeyEvent;
import javax.swing.ImageIcon;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JToggleButton;
public class JavaVirtualKeyboard implements ActionListener, ItemListener {
32
https://www.facebook.com/Oxus20
Java Virtual Keyboard
OUTPUT
33
https://www.facebook.com/Oxus20
Complete Source Code will
be published very soon
Check Our Facebook Page
(https://www.facebook.com/Oxus20)
34
https://www.facebook.com/Oxus20
END
https://www.facebook.com/Oxus20
35

Mais conteúdo relacionado

Mais procurados

Manual Pengelolaan Indonesia Onesearch
Manual Pengelolaan Indonesia OnesearchManual Pengelolaan Indonesia Onesearch
Manual Pengelolaan Indonesia OnesearchDwi Fajar Saputra
 
Dampak penyalahgunaan iptek bagi kehidupan klp 7
Dampak penyalahgunaan iptek bagi kehidupan klp 7Dampak penyalahgunaan iptek bagi kehidupan klp 7
Dampak penyalahgunaan iptek bagi kehidupan klp 7devi harisandi
 
Abstract syntax semantic analyze
Abstract syntax semantic analyzeAbstract syntax semantic analyze
Abstract syntax semantic analyzeHyunJoon Park
 
Chapter 18: Transitions, Transforms, and Animation
Chapter 18: Transitions, Transforms, and AnimationChapter 18: Transitions, Transforms, and Animation
Chapter 18: Transitions, Transforms, and AnimationSteve Guinan
 
JIRA 업무 생산성 향상 및 프로젝트 관리
JIRA 업무 생산성 향상 및 프로젝트 관리JIRA 업무 생산성 향상 및 프로젝트 관리
JIRA 업무 생산성 향상 및 프로젝트 관리KwangSeob Jeong
 
JavaScript Timers, Power Consumption, and Performance
JavaScript Timers, Power Consumption, and PerformanceJavaScript Timers, Power Consumption, and Performance
JavaScript Timers, Power Consumption, and PerformanceNicholas Zakas
 
Belajar Excel Tingkat Mahir
Belajar Excel Tingkat MahirBelajar Excel Tingkat Mahir
Belajar Excel Tingkat MahirAYU LESTARI
 
RESTful Architecture
RESTful ArchitectureRESTful Architecture
RESTful ArchitectureKabir Baidya
 
MongoDB - Aggregation Pipeline
MongoDB - Aggregation PipelineMongoDB - Aggregation Pipeline
MongoDB - Aggregation PipelineJason Terpko
 
서버 개발자가 되기 위한 첫 걸음
서버 개발자가 되기 위한 첫 걸음서버 개발자가 되기 위한 첫 걸음
서버 개발자가 되기 위한 첫 걸음nexusz99
 
2017 Pycon KR - Django/AWS 를 이용한 쇼핑몰 서비스 구축
2017 Pycon KR - Django/AWS 를 이용한 쇼핑몰 서비스 구축2017 Pycon KR - Django/AWS 를 이용한 쇼핑몰 서비스 구축
2017 Pycon KR - Django/AWS 를 이용한 쇼핑몰 서비스 구축Youngil Cho
 
Data Management (Database Environment)
Data Management (Database Environment)Data Management (Database Environment)
Data Management (Database Environment)Adam Mukharil Bachtiar
 
지금 당장 (유사) DDD 시작하기
지금 당장 (유사) DDD 시작하기지금 당장 (유사) DDD 시작하기
지금 당장 (유사) DDD 시작하기대원 서
 
Cara Membuat Website Menggunakan CMS Wordpress & XAMPP
Cara Membuat Website Menggunakan CMS Wordpress & XAMPPCara Membuat Website Menggunakan CMS Wordpress & XAMPP
Cara Membuat Website Menggunakan CMS Wordpress & XAMPPMuhammad Iqbal
 

Mais procurados (20)

Manual Pengelolaan Indonesia Onesearch
Manual Pengelolaan Indonesia OnesearchManual Pengelolaan Indonesia Onesearch
Manual Pengelolaan Indonesia Onesearch
 
Data Management (Relational Database)
Data Management (Relational Database)Data Management (Relational Database)
Data Management (Relational Database)
 
Dampak penyalahgunaan iptek bagi kehidupan klp 7
Dampak penyalahgunaan iptek bagi kehidupan klp 7Dampak penyalahgunaan iptek bagi kehidupan klp 7
Dampak penyalahgunaan iptek bagi kehidupan klp 7
 
React Hooks
React HooksReact Hooks
React Hooks
 
Mini Google Design Sprint
Mini Google Design SprintMini Google Design Sprint
Mini Google Design Sprint
 
Abstract syntax semantic analyze
Abstract syntax semantic analyzeAbstract syntax semantic analyze
Abstract syntax semantic analyze
 
Bab 2 - Sekilas Tentang Proyek
Bab 2 - Sekilas Tentang ProyekBab 2 - Sekilas Tentang Proyek
Bab 2 - Sekilas Tentang Proyek
 
Chapter 18: Transitions, Transforms, and Animation
Chapter 18: Transitions, Transforms, and AnimationChapter 18: Transitions, Transforms, and Animation
Chapter 18: Transitions, Transforms, and Animation
 
JIRA 업무 생산성 향상 및 프로젝트 관리
JIRA 업무 생산성 향상 및 프로젝트 관리JIRA 업무 생산성 향상 및 프로젝트 관리
JIRA 업무 생산성 향상 및 프로젝트 관리
 
JavaScript Timers, Power Consumption, and Performance
JavaScript Timers, Power Consumption, and PerformanceJavaScript Timers, Power Consumption, and Performance
JavaScript Timers, Power Consumption, and Performance
 
Belajar Excel Tingkat Mahir
Belajar Excel Tingkat MahirBelajar Excel Tingkat Mahir
Belajar Excel Tingkat Mahir
 
Modul PBO Bab-08 - Java GUI
Modul PBO Bab-08 - Java GUIModul PBO Bab-08 - Java GUI
Modul PBO Bab-08 - Java GUI
 
RESTful Architecture
RESTful ArchitectureRESTful Architecture
RESTful Architecture
 
MongoDB - Aggregation Pipeline
MongoDB - Aggregation PipelineMongoDB - Aggregation Pipeline
MongoDB - Aggregation Pipeline
 
서버 개발자가 되기 위한 첫 걸음
서버 개발자가 되기 위한 첫 걸음서버 개발자가 되기 위한 첫 걸음
서버 개발자가 되기 위한 첫 걸음
 
PDO (php data object)
PDO (php data object)PDO (php data object)
PDO (php data object)
 
2017 Pycon KR - Django/AWS 를 이용한 쇼핑몰 서비스 구축
2017 Pycon KR - Django/AWS 를 이용한 쇼핑몰 서비스 구축2017 Pycon KR - Django/AWS 를 이용한 쇼핑몰 서비스 구축
2017 Pycon KR - Django/AWS 를 이용한 쇼핑몰 서비스 구축
 
Data Management (Database Environment)
Data Management (Database Environment)Data Management (Database Environment)
Data Management (Database Environment)
 
지금 당장 (유사) DDD 시작하기
지금 당장 (유사) DDD 시작하기지금 당장 (유사) DDD 시작하기
지금 당장 (유사) DDD 시작하기
 
Cara Membuat Website Menggunakan CMS Wordpress & XAMPP
Cara Membuat Website Menggunakan CMS Wordpress & XAMPPCara Membuat Website Menggunakan CMS Wordpress & XAMPP
Cara Membuat Website Menggunakan CMS Wordpress & XAMPP
 

Destaque

How to replace linux system call by module
How to replace linux system call by moduleHow to replace linux system call by module
How to replace linux system call by moduleYU-CHENG Hsu
 
Java Regular Expression PART II
Java Regular Expression PART IIJava Regular Expression PART II
Java Regular Expression PART IIOXUS 20
 
Fal-e-Hafez (Omens of Hafez) Cards in Persian using Java
Fal-e-Hafez (Omens of Hafez) Cards in Persian using JavaFal-e-Hafez (Omens of Hafez) Cards in Persian using Java
Fal-e-Hafez (Omens of Hafez) Cards in Persian using JavaOXUS 20
 
Java Regular Expression PART I
Java Regular Expression PART IJava Regular Expression PART I
Java Regular Expression PART IOXUS 20
 
Everything about Object Oriented Programming
Everything about Object Oriented ProgrammingEverything about Object Oriented Programming
Everything about Object Oriented ProgrammingAbdul Rahman Sherzad
 
TKP Java Notes for Teaching Kids Programming
TKP Java Notes for Teaching Kids ProgrammingTKP Java Notes for Teaching Kids Programming
TKP Java Notes for Teaching Kids ProgrammingLynn Langit
 
Java Virtual Keyboard Using Robot, Toolkit and JToggleButton Classes
Java Virtual Keyboard Using Robot, Toolkit and JToggleButton ClassesJava Virtual Keyboard Using Robot, Toolkit and JToggleButton Classes
Java Virtual Keyboard Using Robot, Toolkit and JToggleButton ClassesOXUS 20
 
Java Unicode with Cool GUI Examples
Java Unicode with Cool GUI ExamplesJava Unicode with Cool GUI Examples
Java Unicode with Cool GUI ExamplesOXUS 20
 
Conditional Statement
Conditional Statement Conditional Statement
Conditional Statement OXUS 20
 
Java Applet and Graphics
Java Applet and GraphicsJava Applet and Graphics
Java Applet and GraphicsOXUS 20
 
PHP Basic and Fundamental Questions and Answers with Detail Explanation
PHP Basic and Fundamental Questions and Answers with Detail ExplanationPHP Basic and Fundamental Questions and Answers with Detail Explanation
PHP Basic and Fundamental Questions and Answers with Detail ExplanationOXUS 20
 
Object Oriented Concept Static vs. Non Static
Object Oriented Concept Static vs. Non StaticObject Oriented Concept Static vs. Non Static
Object Oriented Concept Static vs. Non StaticOXUS 20
 
Java Guessing Game Number Tutorial
Java Guessing Game Number TutorialJava Guessing Game Number Tutorial
Java Guessing Game Number TutorialOXUS 20
 
Structure programming – Java Programming – Theory
Structure programming – Java Programming – TheoryStructure programming – Java Programming – Theory
Structure programming – Java Programming – TheoryOXUS 20
 
Create Splash Screen with Java Step by Step
Create Splash Screen with Java Step by StepCreate Splash Screen with Java Step by Step
Create Splash Screen with Java Step by StepOXUS 20
 
Web Design and Development Life Cycle and Technologies
Web Design and Development Life Cycle and TechnologiesWeb Design and Development Life Cycle and Technologies
Web Design and Development Life Cycle and TechnologiesOXUS 20
 
Everything about Database JOINS and Relationships
Everything about Database JOINS and RelationshipsEverything about Database JOINS and Relationships
Everything about Database JOINS and RelationshipsOXUS 20
 
Note - Java Remote Debug
Note - Java Remote DebugNote - Java Remote Debug
Note - Java Remote Debugboyw165
 
Core java notes with examples
Core java notes with examplesCore java notes with examples
Core java notes with examplesbindur87
 
Java Unicode with Live GUI Examples
Java Unicode with Live GUI ExamplesJava Unicode with Live GUI Examples
Java Unicode with Live GUI ExamplesAbdul Rahman Sherzad
 

Destaque (20)

How to replace linux system call by module
How to replace linux system call by moduleHow to replace linux system call by module
How to replace linux system call by module
 
Java Regular Expression PART II
Java Regular Expression PART IIJava Regular Expression PART II
Java Regular Expression PART II
 
Fal-e-Hafez (Omens of Hafez) Cards in Persian using Java
Fal-e-Hafez (Omens of Hafez) Cards in Persian using JavaFal-e-Hafez (Omens of Hafez) Cards in Persian using Java
Fal-e-Hafez (Omens of Hafez) Cards in Persian using Java
 
Java Regular Expression PART I
Java Regular Expression PART IJava Regular Expression PART I
Java Regular Expression PART I
 
Everything about Object Oriented Programming
Everything about Object Oriented ProgrammingEverything about Object Oriented Programming
Everything about Object Oriented Programming
 
TKP Java Notes for Teaching Kids Programming
TKP Java Notes for Teaching Kids ProgrammingTKP Java Notes for Teaching Kids Programming
TKP Java Notes for Teaching Kids Programming
 
Java Virtual Keyboard Using Robot, Toolkit and JToggleButton Classes
Java Virtual Keyboard Using Robot, Toolkit and JToggleButton ClassesJava Virtual Keyboard Using Robot, Toolkit and JToggleButton Classes
Java Virtual Keyboard Using Robot, Toolkit and JToggleButton Classes
 
Java Unicode with Cool GUI Examples
Java Unicode with Cool GUI ExamplesJava Unicode with Cool GUI Examples
Java Unicode with Cool GUI Examples
 
Conditional Statement
Conditional Statement Conditional Statement
Conditional Statement
 
Java Applet and Graphics
Java Applet and GraphicsJava Applet and Graphics
Java Applet and Graphics
 
PHP Basic and Fundamental Questions and Answers with Detail Explanation
PHP Basic and Fundamental Questions and Answers with Detail ExplanationPHP Basic and Fundamental Questions and Answers with Detail Explanation
PHP Basic and Fundamental Questions and Answers with Detail Explanation
 
Object Oriented Concept Static vs. Non Static
Object Oriented Concept Static vs. Non StaticObject Oriented Concept Static vs. Non Static
Object Oriented Concept Static vs. Non Static
 
Java Guessing Game Number Tutorial
Java Guessing Game Number TutorialJava Guessing Game Number Tutorial
Java Guessing Game Number Tutorial
 
Structure programming – Java Programming – Theory
Structure programming – Java Programming – TheoryStructure programming – Java Programming – Theory
Structure programming – Java Programming – Theory
 
Create Splash Screen with Java Step by Step
Create Splash Screen with Java Step by StepCreate Splash Screen with Java Step by Step
Create Splash Screen with Java Step by Step
 
Web Design and Development Life Cycle and Technologies
Web Design and Development Life Cycle and TechnologiesWeb Design and Development Life Cycle and Technologies
Web Design and Development Life Cycle and Technologies
 
Everything about Database JOINS and Relationships
Everything about Database JOINS and RelationshipsEverything about Database JOINS and Relationships
Everything about Database JOINS and Relationships
 
Note - Java Remote Debug
Note - Java Remote DebugNote - Java Remote Debug
Note - Java Remote Debug
 
Core java notes with examples
Core java notes with examplesCore java notes with examples
Core java notes with examples
 
Java Unicode with Live GUI Examples
Java Unicode with Live GUI ExamplesJava Unicode with Live GUI Examples
Java Unicode with Live GUI Examples
 

Semelhante a Java Virtual Keyboard Using Robot, Toolkit and JToggleButton Classes

JAVA GUI PART I
JAVA GUI PART IJAVA GUI PART I
JAVA GUI PART IOXUS 20
 
Build your first rpa bot using IBM RPA automation
Build your first rpa bot using IBM RPA automationBuild your first rpa bot using IBM RPA automation
Build your first rpa bot using IBM RPA automationWinton Winton
 
The java swing_tutorial
The java swing_tutorialThe java swing_tutorial
The java swing_tutorialsumitjoshi01
 
Session2-J2ME development-environment
Session2-J2ME development-environmentSession2-J2ME development-environment
Session2-J2ME development-environmentmuthusvm
 
What Web Developers Need to Know to Develop Windows 8 Apps
What Web Developers Need to Know to Develop Windows 8 AppsWhat Web Developers Need to Know to Develop Windows 8 Apps
What Web Developers Need to Know to Develop Windows 8 AppsDoris Chen
 
Applet Architecture - Introducing Java Applets
Applet Architecture - Introducing Java AppletsApplet Architecture - Introducing Java Applets
Applet Architecture - Introducing Java Appletsamitksaha
 
React Native custom components
React Native custom componentsReact Native custom components
React Native custom componentsJeremy Grancher
 
Create Splash Screen with Java Step by Step
Create Splash Screen with Java Step by StepCreate Splash Screen with Java Step by Step
Create Splash Screen with Java Step by StepAbdul Rahman Sherzad
 
Why You Shouldn't Write OO
Why You Shouldn't Write OO Why You Shouldn't Write OO
Why You Shouldn't Write OO Yehuda Katz
 
Organizing jQuery Projects Without OO
Organizing jQuery Projects Without OOOrganizing jQuery Projects Without OO
Organizing jQuery Projects Without OOYehuda Katz
 
Top 3 SWT Exceptions
Top 3 SWT ExceptionsTop 3 SWT Exceptions
Top 3 SWT ExceptionsLakshmi Priya
 
MOPCON 2014 - Best software architecture in app development
MOPCON 2014 - Best software architecture in app developmentMOPCON 2014 - Best software architecture in app development
MOPCON 2014 - Best software architecture in app developmentanistar sung
 

Semelhante a Java Virtual Keyboard Using Robot, Toolkit and JToggleButton Classes (20)

Java Applet and Graphics
Java Applet and GraphicsJava Applet and Graphics
Java Applet and Graphics
 
JAVA GUI PART I
JAVA GUI PART IJAVA GUI PART I
JAVA GUI PART I
 
UIAutomator
UIAutomatorUIAutomator
UIAutomator
 
Build your first rpa bot using IBM RPA automation
Build your first rpa bot using IBM RPA automationBuild your first rpa bot using IBM RPA automation
Build your first rpa bot using IBM RPA automation
 
Swtbot
SwtbotSwtbot
Swtbot
 
The java swing_tutorial
The java swing_tutorialThe java swing_tutorial
The java swing_tutorial
 
The java rogramming swing _tutorial for beinners(java programming language)
The java rogramming swing _tutorial for beinners(java programming language)The java rogramming swing _tutorial for beinners(java programming language)
The java rogramming swing _tutorial for beinners(java programming language)
 
Session2-J2ME development-environment
Session2-J2ME development-environmentSession2-J2ME development-environment
Session2-J2ME development-environment
 
SWTBot Tutorial
SWTBot TutorialSWTBot Tutorial
SWTBot Tutorial
 
What Web Developers Need to Know to Develop Windows 8 Apps
What Web Developers Need to Know to Develop Windows 8 AppsWhat Web Developers Need to Know to Develop Windows 8 Apps
What Web Developers Need to Know to Develop Windows 8 Apps
 
Dojo1.0_Tutorials
Dojo1.0_TutorialsDojo1.0_Tutorials
Dojo1.0_Tutorials
 
Dojo1.0_Tutorials
Dojo1.0_TutorialsDojo1.0_Tutorials
Dojo1.0_Tutorials
 
Applet Architecture - Introducing Java Applets
Applet Architecture - Introducing Java AppletsApplet Architecture - Introducing Java Applets
Applet Architecture - Introducing Java Applets
 
React Native custom components
React Native custom componentsReact Native custom components
React Native custom components
 
Create Splash Screen with Java Step by Step
Create Splash Screen with Java Step by StepCreate Splash Screen with Java Step by Step
Create Splash Screen with Java Step by Step
 
Why You Shouldn't Write OO
Why You Shouldn't Write OO Why You Shouldn't Write OO
Why You Shouldn't Write OO
 
Organizing jQuery Projects Without OO
Organizing jQuery Projects Without OOOrganizing jQuery Projects Without OO
Organizing jQuery Projects Without OO
 
Basic of Applet
Basic of AppletBasic of Applet
Basic of Applet
 
Top 3 SWT Exceptions
Top 3 SWT ExceptionsTop 3 SWT Exceptions
Top 3 SWT Exceptions
 
MOPCON 2014 - Best software architecture in app development
MOPCON 2014 - Best software architecture in app developmentMOPCON 2014 - Best software architecture in app development
MOPCON 2014 - Best software architecture in app development
 

Mais de Abdul Rahman Sherzad

Data is the Fuel of Organizations: Opportunities and Challenges in Afghanistan
Data is the Fuel of Organizations: Opportunities and Challenges in AfghanistanData is the Fuel of Organizations: Opportunities and Challenges in Afghanistan
Data is the Fuel of Organizations: Opportunities and Challenges in AfghanistanAbdul Rahman Sherzad
 
PHP Unicode Input Validation Snippets
PHP Unicode Input Validation SnippetsPHP Unicode Input Validation Snippets
PHP Unicode Input Validation SnippetsAbdul Rahman Sherzad
 
Sorting Alpha Numeric Data in MySQL
Sorting Alpha Numeric Data in MySQLSorting Alpha Numeric Data in MySQL
Sorting Alpha Numeric Data in MySQLAbdul Rahman Sherzad
 
Cross Join Example and Applications
Cross Join Example and ApplicationsCross Join Example and Applications
Cross Join Example and ApplicationsAbdul Rahman Sherzad
 
Applicability of Educational Data Mining in Afghanistan: Opportunities and Ch...
Applicability of Educational Data Mining in Afghanistan: Opportunities and Ch...Applicability of Educational Data Mining in Afghanistan: Opportunities and Ch...
Applicability of Educational Data Mining in Afghanistan: Opportunities and Ch...Abdul Rahman Sherzad
 
Web Application Security and Awareness
Web Application Security and AwarenessWeb Application Security and Awareness
Web Application Security and AwarenessAbdul Rahman Sherzad
 
Database Automation with MySQL Triggers and Event Schedulers
Database Automation with MySQL Triggers and Event SchedulersDatabase Automation with MySQL Triggers and Event Schedulers
Database Automation with MySQL Triggers and Event SchedulersAbdul Rahman Sherzad
 
Evaluation of Existing Web Structure of Afghan Universities
Evaluation of Existing Web Structure of Afghan UniversitiesEvaluation of Existing Web Structure of Afghan Universities
Evaluation of Existing Web Structure of Afghan UniversitiesAbdul Rahman Sherzad
 
PHP Basic and Fundamental Questions and Answers with Detail Explanation
PHP Basic and Fundamental Questions and Answers with Detail ExplanationPHP Basic and Fundamental Questions and Answers with Detail Explanation
PHP Basic and Fundamental Questions and Answers with Detail ExplanationAbdul Rahman Sherzad
 
Fundamentals of Database Systems Questions and Answers
Fundamentals of Database Systems Questions and AnswersFundamentals of Database Systems Questions and Answers
Fundamentals of Database Systems Questions and AnswersAbdul Rahman Sherzad
 
Everything about Database JOINS and Relationships
Everything about Database JOINS and RelationshipsEverything about Database JOINS and Relationships
Everything about Database JOINS and RelationshipsAbdul Rahman Sherzad
 
Fal-e-Hafez (Omens of Hafez) Cards in Persian using Java
Fal-e-Hafez (Omens of Hafez) Cards in Persian using JavaFal-e-Hafez (Omens of Hafez) Cards in Persian using Java
Fal-e-Hafez (Omens of Hafez) Cards in Persian using JavaAbdul Rahman Sherzad
 
Web Design and Development Life Cycle and Technologies
Web Design and Development Life Cycle and TechnologiesWeb Design and Development Life Cycle and Technologies
Web Design and Development Life Cycle and TechnologiesAbdul Rahman Sherzad
 
Object Oriented Concept Static vs. Non Static
Object Oriented Concept Static vs. Non StaticObject Oriented Concept Static vs. Non Static
Object Oriented Concept Static vs. Non StaticAbdul Rahman Sherzad
 

Mais de Abdul Rahman Sherzad (20)

Data is the Fuel of Organizations: Opportunities and Challenges in Afghanistan
Data is the Fuel of Organizations: Opportunities and Challenges in AfghanistanData is the Fuel of Organizations: Opportunities and Challenges in Afghanistan
Data is the Fuel of Organizations: Opportunities and Challenges in Afghanistan
 
PHP Unicode Input Validation Snippets
PHP Unicode Input Validation SnippetsPHP Unicode Input Validation Snippets
PHP Unicode Input Validation Snippets
 
Iterations and Recursions
Iterations and RecursionsIterations and Recursions
Iterations and Recursions
 
Sorting Alpha Numeric Data in MySQL
Sorting Alpha Numeric Data in MySQLSorting Alpha Numeric Data in MySQL
Sorting Alpha Numeric Data in MySQL
 
PHP Variable variables Examples
PHP Variable variables ExamplesPHP Variable variables Examples
PHP Variable variables Examples
 
Cross Join Example and Applications
Cross Join Example and ApplicationsCross Join Example and Applications
Cross Join Example and Applications
 
Applicability of Educational Data Mining in Afghanistan: Opportunities and Ch...
Applicability of Educational Data Mining in Afghanistan: Opportunities and Ch...Applicability of Educational Data Mining in Afghanistan: Opportunities and Ch...
Applicability of Educational Data Mining in Afghanistan: Opportunities and Ch...
 
Web Application Security and Awareness
Web Application Security and AwarenessWeb Application Security and Awareness
Web Application Security and Awareness
 
Database Automation with MySQL Triggers and Event Schedulers
Database Automation with MySQL Triggers and Event SchedulersDatabase Automation with MySQL Triggers and Event Schedulers
Database Automation with MySQL Triggers and Event Schedulers
 
Mobile Score Notification System
Mobile Score Notification SystemMobile Score Notification System
Mobile Score Notification System
 
Herat Innovation Lab 2015
Herat Innovation Lab 2015Herat Innovation Lab 2015
Herat Innovation Lab 2015
 
Evaluation of Existing Web Structure of Afghan Universities
Evaluation of Existing Web Structure of Afghan UniversitiesEvaluation of Existing Web Structure of Afghan Universities
Evaluation of Existing Web Structure of Afghan Universities
 
PHP Basic and Fundamental Questions and Answers with Detail Explanation
PHP Basic and Fundamental Questions and Answers with Detail ExplanationPHP Basic and Fundamental Questions and Answers with Detail Explanation
PHP Basic and Fundamental Questions and Answers with Detail Explanation
 
Fundamentals of Database Systems Questions and Answers
Fundamentals of Database Systems Questions and AnswersFundamentals of Database Systems Questions and Answers
Fundamentals of Database Systems Questions and Answers
 
Everything about Database JOINS and Relationships
Everything about Database JOINS and RelationshipsEverything about Database JOINS and Relationships
Everything about Database JOINS and Relationships
 
Fal-e-Hafez (Omens of Hafez) Cards in Persian using Java
Fal-e-Hafez (Omens of Hafez) Cards in Persian using JavaFal-e-Hafez (Omens of Hafez) Cards in Persian using Java
Fal-e-Hafez (Omens of Hafez) Cards in Persian using Java
 
Web Design and Development Life Cycle and Technologies
Web Design and Development Life Cycle and TechnologiesWeb Design and Development Life Cycle and Technologies
Web Design and Development Life Cycle and Technologies
 
Java Regular Expression PART II
Java Regular Expression PART IIJava Regular Expression PART II
Java Regular Expression PART II
 
Java Regular Expression PART I
Java Regular Expression PART IJava Regular Expression PART I
Java Regular Expression PART I
 
Object Oriented Concept Static vs. Non Static
Object Oriented Concept Static vs. Non StaticObject Oriented Concept Static vs. Non Static
Object Oriented Concept Static vs. Non Static
 

Último

The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxShobhayan Kirtania
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Krashi Coaching
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...anjaliyadav012327
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfsanyamsingh5019
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...Sapna Thakur
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...Pooja Nehwal
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsTechSoup
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfchloefrazer622
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformChameera Dedduwage
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 

Último (20)

The byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptxThe byproduct of sericulture in different industries.pptx
The byproduct of sericulture in different industries.pptx
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
Kisan Call Centre - To harness potential of ICT in Agriculture by answer farm...
 
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
JAPAN: ORGANISATION OF PMDA, PHARMACEUTICAL LAWS & REGULATIONS, TYPES OF REGI...
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
Sanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdfSanyam Choudhary Chemistry practical.pdf
Sanyam Choudhary Chemistry practical.pdf
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
BAG TECHNIQUE Bag technique-a tool making use of public health bag through wh...
 
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...Russian Call Girls in Andheri Airport Mumbai WhatsApp  9167673311 💞 Full Nigh...
Russian Call Girls in Andheri Airport Mumbai WhatsApp 9167673311 💞 Full Nigh...
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
Introduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The BasicsIntroduction to Nonprofit Accounting: The Basics
Introduction to Nonprofit Accounting: The Basics
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Disha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdfDisha NEET Physics Guide for classes 11 and 12.pdf
Disha NEET Physics Guide for classes 11 and 12.pdf
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 
A Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy ReformA Critique of the Proposed National Education Policy Reform
A Critique of the Proposed National Education Policy Reform
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 

Java Virtual Keyboard Using Robot, Toolkit and JToggleButton Classes

  • 1. https://www.facebook.com/Oxus20 oxus20@gmail.com JAVA Virtual Keyboard » Exception Handling » JToggleButton Class » Robot Class » Toolkit Class Prepared By: Nahid Ahmadi Edited By: Abdul Rahman Sherzad
  • 2. Agenda » Virtual Keyboard » Exception Handling » JToggleButton Class » Robot Class » Toolkit Class » Virtual Keyboard Implementation 2 https://www.facebook.com/Oxus20
  • 4. Virtual Keyboard Using JAVA 4 https://www.facebook.com/Oxus20
  • 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
  • 6. Virtual Keyboard Usage » It is possible to obtain keyboards for the following specific purposes: ˃ Keyboards to fill specific forms on sites ˃ Special key arrangements ˃ Keyboards for dedicated commercial sites ˃ etc. » In addition, Virtual Keyboard used for the following subjects: ˃ Foreign Character Sets ˃ Touchscreens ˃ Bypass key loggers 6 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
  • 10. Exception Handling Demo Source code public class ExceptionHandlingDemo { public static void main(String args[]) { try { int scores[] = { 90, 85, 75, 100 }; System.out.println("Access element nine:" + scores[9]); } catch (ArrayIndexOutOfBoundsException e) { System.out.println("Exception thrown:" + e); } System.out.println("nWithout Exception Handling I was not able to execute and print!"); } } 10 https://www.facebook.com/Oxus20
  • 11. Exception Handling Demo OUTPUT Exception thrown:java.lang.ArrayIndexOutOfBoundsEx ception: 9 Without Exception Handling I was not able to execute and print! 11 https://www.facebook.com/Oxus20
  • 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
  • 15. JToggleButton Demo Source Code import java.awt.FlowLayout; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JToggleButton; class JToggleButtonDemo { JLabel lblOutput; JToggleButton btnOnOff; JFrame win; JToggleButtonDemo() { // JFrame Customization win = new JFrame("Using JToggleButton"); win.setLayout(new FlowLayout()); win.setSize(300, 80); win.setLocationRelativeTo(null); win.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 15 https://www.facebook.com/Oxus20
  • 16. // JToggleButton and JLabel Customization lblOutput = new JLabel("State : OFF"); btnOnOff = new JToggleButton("On / Off", false); // Add item listener for JToggleButton. btnOnOff.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent ie) { if (btnOnOff.isSelected()) { lblOutput.setText("State : ON"); } else { lblOutput.setText("State : OFF"); } } }); // Add toggle button and label to the content pane. win.add(btnOnOff); win.add(lblOutput); win.setVisible(true); } public static void main(String args[]) { new JToggleButtonDemo(); } } 16 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
  • 21. Robot Class Demo Source Code import java.awt.AWTException; import java.awt.BorderLayout; import java.awt.Robot; import java.awt.event.KeyEvent; import javax.swing.JFrame; import javax.swing.JTextArea; public class RobotDemo extends JFrame { public RobotDemo() { // JFrame with TextArea Settings setTitle("OXUS20 Robot Demo"); setSize(400, 200); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setLocationRelativeTo(null); JTextArea txtOXUS = new JTextArea(); add(txtOXUS, BorderLayout.CENTER); setVisible(true); } 21 https://www.facebook.com/Oxus20
  • 22. public static void main(String[] args) { new RobotDemo(); // Store Keystrokes "OXUS20" in an array int keyInput[] = { KeyEvent.VK_O, KeyEvent.VK_X, KeyEvent.VK_U, KeyEvent.VK_S, KeyEvent.VK_2, KeyEvent.VK_0 }; try { Robot robot = new Robot(); // press the shift key robot.keyPress(KeyEvent.VK_SHIFT); // This types the word 'OXUS20' in the TextArea for (int i = 0; i < keyInput.length; i++) { if (i > 0) { robot.keyRelease(KeyEvent.VK_SHIFT); } robot.keyPress(keyInput[i]); // pause typing for one second robot.delay(1000); } } catch (AWTException e) { System.err.println("Exception is happening!"); } } // end of main() } // end of RobotDemo class 22 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
  • 25. Toolkit Class Demo Source Code import java.awt.Dimension; import java.awt.Toolkit; public class ToolkitDemo { public static void main(String[] a) { Toolkit tk = Toolkit.getDefaultToolkit(); Dimension d = tk.getScreenSize(); System.out.println("Screen size: " + d.width + "x" + d.height); System.out.println("nScreen Resolution: " + tk.getScreenResolution()); } } 25 https://www.facebook.com/Oxus20
  • 26. Toolkit Class Demo OUTPUT Screen Size: 1366x768 Screen Resolution: 96 26 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
  • 28. Another Toolkit Class Demo Source Code import java.awt.FlowLayout; import java.awt.Toolkit; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.awt.event.KeyEvent; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JToggleButton; class ChangeCapsLockStateDemo { JLabel lblOutput; JToggleButton btnOnOff; JFrame win; ChangeCapsLockStateDemo() { // JFrame Customization win = new JFrame("Using JToggleButton"); win.setLayout(new FlowLayout()); win.setSize(300, 80); win.setLocationRelativeTo(null); win.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); 28 https://www.facebook.com/Oxus20
  • 29. // JToggleButton and JLabel Customization lblOutput = new JLabel("CapsLock : OFF"); Toolkit.getDefaultToolkit().setLockingKeyState(KeyEvent.VK_CAPS_LOCK, false); btnOnOff = new JToggleButton("On / Off", false); // Add item listener for JToggleButton. btnOnOff.addItemListener(new ItemListener() { public void itemStateChanged(ItemEvent ie) { if (btnOnOff.isSelected()) { lblOutput.setText("CapsLock : ON"); Toolkit.getDefaultToolkit().setLockingKeyState(KeyEvent.VK_CAPS_LOCK, true); } else { lblOutput.setText("CapsLock : OFF"); Toolkit.getDefaultToolkit().setLockingKeyState(KeyEvent.VK_CAPS_LOCK, false); } } }); // Add toggle button and label to the content pane. win.add(btnOnOff); win.add(lblOutput); win.setVisible(true); } public static void main(String args[]) { new ChangeCapsLockStateDemo(); } } 29 https://www.facebook.com/Oxus20
  • 30. Another Toolkit Class Demo OUPUT 30 https://www.facebook.com/Oxus20
  • 32. Java Virtual Keyboard Source Code import java.awt.AWTException; import java.awt.Color; import java.awt.Robot; import java.awt.Toolkit; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.ItemEvent; import java.awt.event.ItemListener; import java.awt.event.KeyEvent; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JPanel; import javax.swing.JToggleButton; public class JavaVirtualKeyboard implements ActionListener, ItemListener { 32 https://www.facebook.com/Oxus20
  • 34. Complete Source Code will be published very soon Check Our Facebook Page (https://www.facebook.com/Oxus20) 34 https://www.facebook.com/Oxus20