Latest Tutorials| Questions and Answers|Ask Questions?|Site Map



Home Answers Viewqa Swing-AWT virtual onscreen keyboard project using java and swings
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


shirisha
virtual onscreen keyboard project using java and swings
1 Answer(s)      5 years and 6 months ago
Posted in : Swing AWT



Advertisement
View Answers

June 24, 2009 at 5:37 PM


Hi Friend,

Try the following code:

import java.util.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.text.*;
import javax.swing.border.*;

public class SpaceKey extends JPanel implements ActionListener
{
static final String st = "ABCDE";
JButton buttonList[];
String buffer = "";
JTextField text;
JButton backspace, spaceBar;

public void key() {
text = new JTextField(20);
text.setActionCommand(""+ buffer);
add(text);
int n = st.length();
buttonList = new JButton[n];
for (int i = 0; i < n; i++) {
buttonList[i] = new JButton( "" + st.charAt(i) );
add(buttonList[i]);
buttonList[i].addActionListener(this);
}
spaceBar = new JButton("Spacebar Key");
add(spaceBar);
spaceBar.addActionListener(this);

backspace = new JButton("BackSpace Key");
add(backspace);
backspace.addActionListener(this);
}
public void actionPerformed( ActionEvent e) {
int n = st.length();
if (e.getSource() == backspace) {
buffer = buffer.substring(0,buffer.length()-1);
text.setText("" + buffer);
}
else if (e.getSource() == spaceBar){
buffer += " ";
}
else{
for (int i = 0; i < n; i++){
if (e.getSource() == buttonList[i]){
buffer += st.toLowerCase().charAt(i);
text.setText(""+ buffer);
break;
}
}
}
}
public SpaceKey(){
JPanel pane = new JPanel();
add(pane);
}
public static void main(String s[])
{
JFrame frame = new JFrame();
SpaceKey keys= new SpaceKey();
frame.getContentPane().add(keys,"Center");
keys.key();
frame.setSize(500,100);
frame.setVisible(true);
}
}

Thanks


Related Tutorials/Questions & Answers:
virtual onscreen keyboard project using java and swings - Swing AWT
virtual onscreen keyboard project using java and swings  sir thanks a lot for ur reply for my last question, can u please send me the entire project code of virtual on screen keyboard.i did but im not sure as it was right
virtual onscreen keyboard project using java and swings - Swing AWT
virtual onscreen keyboard project using java and swings  Im doing virtual on screen keyboard as my project. i didnt get the method to performthe backspace and space operation using swings in java.can please help me  Hi
Advertisements
virtual on screen keyboard project - Swing AWT
virtual on screen keyboard project  Hi im doing my project work on virtual onscreen keyboard. i want the code for key function of shift and capslock.please send me the code   Hi Friend, For CapsLock key,try
How can i Change Button Label Value Randomly in VIRTUAL KEYBOARD using JAVA or Net Beans ???
How can i Change Button Label Value Randomly in VIRTUAL KEYBOARD using JAVA... i start Virtual Keyboard, Means ,if 1st time Button1=''a'' then next login time... Distribution & Counter...? ? ? . . Try to Give me Solution..in JAVA if its
How can i Change Button Label Value Randomly in VIRTUAL KEYBOARD using JAVA or Net Beans ???
How can i Change Button Label Value Randomly in VIRTUAL KEYBOARD using JAVA... i start Virtual Keyboard, Means ,if 1st time Button1=''a'' then next login time... Distribution & Counter...? ? ? . . Try to Give me Solution..in JAVA if its
How to display windows virtual keyboard
How to display windows virtual keyboard  Hi, I have a jsp file which contains my website design. In my jsp website design, there's a button. I need to display windows virtual keyboard when i press the button. how to do
java code using swings
java code using swings  code that should be able to enter data of student details using all swings into the access database using jdbc connectivity
write a java pogram to add elements to linked list using keyboard and display it
write a java pogram to add elements to linked list using keyboard and display it  write a java pogram to add elements to linked list using keyboard and display
java keyboard shortcuts - Struts
java keyboard shortcuts  hi, i hav an application already developed using struts framework.now i would like to add some keboard shortcuts to my application, so that the user need not to go for the usage of the mouse every time
want a program for date picker by using java swings
want a program for date picker by using java swings  to write a program for the date picker by using java swings.any one please help me by providing the code to this java date picker by using the java swings.previously a program
How to Create Keyboard in JAVA
How to Create Keyboard in JAVA  please help me to create On-Screen Keyboard with java and please give me an another idia to make it ..............iam waiting for your help ,think u so much
Java Virtual Machine
Java Virtual Machine  What is Java Virtual Machine? Are JVM different for each OS? Thanks   Hello, JVM or Java Virtual Machine is run... more at Java Virtual Machine Technology. Thanks
java virtual machine
java virtual machine  please give some detail about JVM
disable keyboard in java applet
disable keyboard in java applet  How to disable key board of my client in an java applet embedded in a website while the applet is running.? Plz help
core java project by using databse
core java project by using databse  hello sir, i'm a b.tech final year student.... i wantto make a project on java with database... can u plzz suggest me how i can start for it.... means on which topic i can make project
Virtual Fuction invokation in java
is virtual method in java?Please explain...Virtual Fuction invokation in java  Please help me. If i have create a Employee class,which is the super class of Manager. And I create an object
Virtual Fuction invokation in java
is virtual method in java?Please explain...Virtual Fuction invokation in java  Please help me. If i have create a Employee class,which is the super class of Manager. And I create an object
Java Virtual Machine Technology
Java Virtual Machine Technology Java development kit termed as  JDK have more than one implementation of the JVM. Java HotSpot Client VM also termed.... This is the Virtual machine implementation comes with JDK.It is basically designed to cut
Java Swings
Java Swings  I am doing one project on java Swings, in this i have created one jframe where i defined some JButtons and Jcombobox's, here i need to insert one JTable with headers(IN CURRENT JFrame only).pls help me urgently
Image Movement using Swings
Image Movement using Swings  How to move image using Swings
An application using swings and vector methods
An application using swings and vector methods   Hi, I want an application in Java swings which uses good selection of Vectors methods
making of dynamic textfields using swings
making of dynamic textfields using swings  How to make dynamic textfields using java swings
Java Virtual Machine
Java Virtual Machine The Java Virtual Machine is a software package that comes... on Linux and vice versa. JVM - Execution Environment JVM or Java Virtual Machine... independence by using the network byte order in Java class files So, JVM
how to use marathi keyboard in java programming?
how to use marathi keyboard in java programming?  how to use Marathi keyboard in java programming
Non-virtual Methods in Java - java tutorials
: #000000; } Non Virtual Methods in Java Lets see the concept of virtual... hierarchy. In Java programming language all the methods are virtual, i.e.... The better way to achieve the non-virtual function in java is that make all
Project on mailing system using Java/JSP
Project on mailing system using Java/JSP  I am making a project on mailing system in Java/JSP. How could I display the inbox messages on the home page of user? Please tell me about how to handle these messages in database
how to store data in table using swings - Java Beginners
how to store data in table using swings  Hi, I am doing a project in which i need to store some data in the table using swings.......Iam using... , whether do i have any option in swings to increase my output look (my target
Looking for sample project in java using netbeans
Looking for sample project in java using netbeans  Hi all, i am novice in developing desktop application in java using netbeans. can anyone pls help me by sending project built in netbeans as soon as possible. so that i could
write a program to remove the element from hashset using keyboard.
write a program to remove the element from hashset using keyboard.  write a program to remove the element from hashset using keyboard
java swings - Swing AWT
java swings  I am doing a project for my company. I need a to show the performance of the employees by using bar bharts. Please give me how can we write the code for bar charts using java swings.  Hi friend, I am
Java Virtual Machine
Java Virtual Machine       In this section, you will learn about the java virtual machine (JVM) and how to work? Java Virtual Machine (JVM) Java Virtual Machine is a set of computer
Advertisements
 

 

 

DMCA.com