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



Home Answers Viewqa Swing-AWT virtual on screen keyboard project
Login         

View Questions and Answers by Category

Advertisements


 
Have Programming Question? Ask it here!
 
 
 


sandhya
virtual on screen keyboard project
1 Answer(s)      5 years and 5 months ago
Posted in : Swing AWT



Advertisement
View Answers

June 25, 2009 at 5:43 PM


Hi Friend,

For CapsLock key,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 = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
JButton buttonList[];
String buffer = "";
JTextField text;
JButton capsLock;
boolean capslock;

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);
}
capsLock = new JButton("CapsLock Key");
add(capsLock);
capsLock.addActionListener(this);
}
public void actionPerformed( ActionEvent e) {
int n = st.length();
if (e.getSource() == capsLock)
{
if (capslock)
capslock = false;
else capslock = true;
}
else{
for (int i = 0; i < n; i++)
{
if (e.getSource() == buttonList[i])
{
if (capslock)
{
buffer += st.charAt(i);
}
else
{
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,200);
frame.setVisible(true);
}
}

Thanks


Related Tutorials/Questions & Answers:
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
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
Advertisements
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
virtual on screen keyboar - Swing AWT
virtual on screen keyboar  sir i need shift key operation code in my project program of virtual keyboard can uplz send
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
How to connect on screen keyboard to system.
How to connect on screen keyboard to system.  How to connect on screen keyboard to system.I made on screen keyboard in java(swing).Now i want connect to system means when i pressed any button then it type on notepad or any
How to connect on screen keyboard to system.
How to connect on screen keyboard to system.  How to connect on screen keyboard to system.I made on screen keyboard in java(swing).Now i want connect to system means when i pressed any button then it type on notepad or any
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 or Net Beans ???  How can change Button Label value Every Time when i start Virtual Keyboard, Means ,if 1st time Button1=''a'' then next login time
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 or Net Beans ???  How can change Button Label value Every Time when i start Virtual Keyboard, Means ,if 1st time Button1=''a'' then next login time
while playing youtube in iphone appliation, coming black screen in iphone project?
while playing youtube in iphone appliation, coming black screen in iphone project?  while playing youtube in iphone appliation, coming black screen in iphone project
virtual function
virtual function  Explain virtual functions in Java
virtual function
virtual function  can we have virtual functions in java
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
keyboard input
keyboard input  how do I use JOptionPane to accept keyboard input? I know how to import but not specific command on input line   import javax.swing.*; class JOPtionPaneExample { public static void main(String
virtual world
virtual world  i want a program like consider 10 * 10 array. first we are in the middle i.e 5 * 5 position . we have to ask the user that in which direction he is interested to move.i.e east or west or north or south. the output
Screen Capture
Screen Capture  How to capture the screen using jsps and servlets
Ho to get virtual key code.
Ho to get virtual key code.  Hi How to get virtual key code from button.I made on screen keyboard.But it not proper work for windows ,shift,alt and ctrl key. pls suggest me
Screen shot
Screen shot  webpage screenshot source code
splash screen
splash screen  What is splash screen and how can i set splash screen in iphone??   hello, if you want to launch splash screen then add... splash screen will show launching time
hide show keyboard iphone
hide show keyboard iphone  How to hide show keyboard in iPhone programmatically
hide show keyboard iphone
hide show keyboard iphone  How to hide show keyboard in iPhone programmatically
hide show keyboard iphone
hide show keyboard iphone  How to hide show keyboard in iPhone programmatically
Screen Capture
Screen Capture  Hi deepak, I am trying to take a screen shot using java script Activex object. But Iam getting Automation server cant create object exception .how can i solve
hide keyboard iphone
hide keyboard iphone  Can anyone tell me how to hide keyboard in my simple view based application in iphone?   Hiding keyboard in iPhone - (BOOL)textFielsShouldReturn:(UITextField *)textField { [textField
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
Keyboard Done button in iphone
Keyboard Done button in iphone  hii,, how can i set a function on press keyboard done button.   hello, For making keyboard Done button press :- import keyboard displacement by adding this line #define kOFFSET
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
Screen flashing
Screen flashing  Hey I am trying to make my screen flash (like a white flash as if from a camera). This is my code so far: <html> <... I want is that I want the screen to flash white when a link is clicked. Thanks
resign first responder keyboard
resign first responder keyboard  Hi, How I can hide keyboard on click on of done button in keyboard. Give me example of resign first responder keyboard example code. Thanks   Hi, Make your controller delegate to text
uitextfield disable keyboard
uitextfield disable keyboard  How to disable keyboard of UITextView in iPhone SDK application?   There are two ways to disable the keyboard of UITextField in iPhone SDK application - (BOOL)textFieldShouldBeginEditing
Advertisements
 

 

 

DMCA.com