Home Answers Viewqa Java-Beginners switch CAPSLOCK button in my progranm...

 
 


didar sham
switch CAPSLOCK button in my progranm...
2 Answer(s)      2 years and a month ago
Posted in : Java Beginners

I found that function which does the Capslocks job,when am running my program if the capslock button switched on the letters on the keyboard becomes capital,and if switched off the letters become small,but i want of this to happen during the run time,i mean the capslocks switch button to become a button that i can switch it between on and off during the runtime,like that is present in the window, please help me,please!

View Answers

April 5, 2011 at 1:07 PM


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

public class CapslockKey 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 CapslockKey(){
JPanel pane = new JPanel();
add(pane);
}
public static void main(String s[])
{
JFrame frame = new JFrame();
CapslockKey keys= new CapslockKey();
frame.getContentPane().add(keys,"Center");
keys.key();
frame.setSize(500,200);
frame.setVisible(true);
}
}

April 5, 2011 at 1:26 PM


i think u soooo respectable , thank u so much so much so much,.....,thank u to share it. can u give me same idea for ALT , SHIFT and CTRL button ?? and if instead of array {String st = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";} use Stack or ArrayList ?. if we can how ? thank u ...









Related Pages:
switch CAPSLOCK button in my progranm...
switch CAPSLOCK button in my progranm...  I found that function which does the Capslocks job,when am running my program if the capslock button... the capslocks switch button to become a button that i can switch it between on and off
iPhone Switch Changes Toolbar Color
iPhone Switch Changes Toolbar Color In this tutorial we will use Switch button to change the Color of Toolbar. The Switch is added through the Interface... Application. Final View will look like this: My project name
switch Statement - Overview
Java Notes switch Statement - Overview Purpose of switch: select one of many possible statements to execute... on a boolean value (only two possible values). The switch statement allows
how can i use toggle button in my application
how can i use toggle button in my application  i want a on/off toggle button by dragging left-right..not by pressing on button
iPhone Button Click Sound
the sound. In my application i am using a button to give the action to play a sound. You can add and switch the button with action in Interface builder. If you... iPhone Button Click Sound In this series of iPhone button tutorial, we
create a button
create a button  i have created button inhtml but my jsp is not working,so can u guide me
How to disable Browser's back button (at the same time i want my own back button to be enabled) :p
How to disable Browser's back button (at the same time i want my own back button to be enabled) :p  Hi, I have designed a "back" button for jsp page. Now I want to disable Browser's default button So that people will use "back
How to disable Browser's back button (at the same time i want my own back button to be enabled) :p
How to disable Browser's back button (at the same time i want my own back button to be enabled) :p  Hi, I have designed a "back" button for jsp page. Now I want to disable Browser's default button So that people will use "back
Save the content in my wysiwyg editor into specified location of user when clicked on save button in my web page
Save the content in my wysiwyg editor into specified location of user when clicked on save button in my web page  I am using wysiwyg editor to display some static content.My requirement is that This static content can be edited
Some additions for my previous question - Java Beginners
Some additions for my previous question  This is the question I.... The first button when pressed should tell the user if that number is prime or not. When the second button is pressed the program has to calculate the prime
uikeyboard done button/return button
uikeyboard done button/return button  Hi everyone!!! Just worried about ..how to return the UIKeyboard on done or return button click in my iPhone... to return the uikeyboard on done button click. Do not forget to call <
How to use switch statement in jsp code
How to use switch statement in jsp code       switch is a type of control statement used to control the flow of program execution. Its body is known as a switch block
button tag
button tag  how do i change button color to black. meant to say i want black button with white text on it   Hi Friend, Try the following... Message: <input type="text" id="msg"><br> <input type="button" value
Switch application
are going to add Switch to Window. Create a new project by selecting Window... file and add a Switch from the library.   here we are declaring Switch... UISwitch *mswitch;   we are writing the action on button i.e. (-(void
i need to replace this if statement code with switch case code
i need to replace this if statement code with switch case code   i need to replace this code with switch case for(int i=0;i<100;i++){ if((i%3..."); if((i%15)==0) system.out.println("java technology"); } my email
how can i add wirecard option(or button ) at my web page plz tell all steps? View Answers
how can i add wirecard option(or button ) at my web page plz tell all steps? View Answers  how can i add wirecard option(or button ) at my web page plz tell all steps? View Answers
attach file in my web page
attach file in my web page  hide button in input typ=file button in jsp
plz solve my query?
plz solve my query?  how to remove all the options from select control in html using java script?   JavaScript remove all items <...;/select> <br> <input type="button" value="Remove All Item" onClick
switch statement
switch statement   i want to write a java program that computes Fibonacci,factorial,string reversal and ackerman using switch case to run as a single program
switch case
switch case  program to input 2 numbers and a choice.Using switch case we need to perform all the mathematical operation.Print a suitable error message if the choice is wrong
switch case
switch case  program to input 2 numbers and a choice.Using switch case we need to perform all the mathematical operation.Print a suitable error message if the choice is wrong
Switch
Switch      ... statements. To avoid this we can use Switch statements in Java. The switch statement... of a variable or expression. The switch statement in Java is the best way to test
next button in servlet
next button in servlet  i want to add next,previous button to get next record in my servlet. can you explain the logic to do
Switch databases
Switch databases  How do you inter-change between relational databases without code changes
get a value when a radio button clicked - JSP-Servlet
get a value when a radio button clicked  sorry sir my actual probs... button to access a value(also used u r code),then in this jsp i m having a forms to call a servlet,then in a servlet i m using a switch case to call a jsps
The Switch statement
Switch       Sometimes.... To avoid this we can use Switch statements in Java. The switch statement is used... of a variable or expression. The switch statement in Java is the best way to test
navigation item back button
navigation item back button  I wants to add a navigationBar on the top of my UIWebView also a navigation item "back button". can anyone please explain how the back and refresh button works
Switch Statement
Switch Statement  How we can use switch case in java program ?   Note:-Switch case provides built-in multiway decision statement.It...); switch(days){ case 1: System.out.println("Sunday
button actions in struts
button actions in struts  in my jsp page i have two buttons add and sub.when i clicking the add button one action is performed and clicking the sub button another action is performed.how i will handle it using struts.i am using
uinavigationcontroller back button action
uinavigationcontroller back button action  Hi, Tell me how to back to my root or main view in my uinavigationcontroller based application. I will display the back view on click of a button in my iPhone and iPad based application
PushViewController back button
PushViewController back button  How can i hide the back button that is displayed on the view called by PushViewController in my iPhone application. My application is navigation based and whenever i push the view controller
iPhone Radio Button Example
iPhone Radio Button Example  Can you please suggest me how to create Radio button in my iPhone application. Actually, in my application i have two... click on that button it get selected and by default it should display unselected
programes on switch
=input.nextInt(); switch(choice){ case 1
java radio button and exception
java radio button and exception  Dear Sir/Madam, I have problem with my addBagelRadioButton and addCheeseRadioButton. There should be only 1 radio button can be selected, but somehow 2 can be selected the same time. Also, I
changing selection color of <button>
in border less button tag when button is selected with tab key i get brown color... of rectangle with blue. please help. here is my code snippet. <td align=center valign=middle > <figure> <button style="background-color:black
Query on radio button
Query on radio button  I am having a multiple row in jsp page.They are dynamically coming. For each row there is one radio button. I want to select..., the values should got to a ActionClass. My query is that how do i send all
Paypal integration to my website - Struts
Paypal integration to my website  Hi there, I am working on paypal.My question is....I have one webiste and in that I kept a button called... the payment details(acknowledgement)....My question is.....instead of getting
Please Help To Solve My Problem
Please Help To Solve My Problem  PHP I Have 6 Textbox and 1 ok button. 6 Textbox to Add the 6 Team Name. Each Team Name In String(Like- A,B,C,D,E,F) When I Add This Six Team Name In Six Text Box Then I Will Click On Ok Button
Button
Button  How to use image for button in JSF
passing value of radio button
the GUi editor in net beans 6.9. i have two radio button in the first jframe.i have... for the jframes and radiobutton are already generated when using the Editor. my pseudo code... else print second. please help me I try this code in my 3rd jFrame
Button in Flex4
Button in Flex 4: The rectangular button is usually used by the Button... is the default label of this button.Whenever the select the control button to perform any actioin, it uses event listeners. As soon as the button control is clicked
java button - Java Beginners
button thich will open new pop-up page, where will be shown only this checkboxes whitch have been marked. please help me pleas wright me on my e-mail address..."); private JCheckBox cb4 = new JCheckBox("Check Box 4"); private JButton button
get a value when a radio button clicked - JSP-Servlet
get a value when a radio button clicked  Here is my code sir please help me if any changes in the code please give me sir thanks in advance... strMatterFile; int intEmpid1; switch (intAct) { case 1:// For a New Entry
button to accept user input
button to accept user input  private void jButton1ActionPerformed... the radiobutton and spinner.The user input does not show on my Studentinfo.mdb...); JButton button=new JButton("Submit"); text=new JTextField(15
Download Button - JSP-Servlet
Download Button  HI friends, This is my maiden question at this site. I am doing online banking project, in that i have "mini statement" link... how to implement the download button so that on clicking that the mini
button
button  can i give multiple commands on click of a button? if yes how can i do that?? multiple commands can we retriving dat from database, capturing data, moving to next page.. etc
button
button  can i give multiple commands on click of a button? if yes how can i do that?? multiple commands can be retriving dat from database, capturing data, moving to next page.. etc
pls review my code - Struts
pls review my code  Hello friends, This is the code in struts. when i click on the submit button. It is showing the blank page. Pls respond soon its urgent. Thanks in advance. public class LOGINAction extends Action
Radio Button Problem in jsp.
Radio Button Problem in jsp.  I have a small doubt in my application, my requirement is to get a "single selectible row", I generated a radio button... clear my doubt.and disabled all previous values. myjsp is like that <
radio button - Development process
radio button  hello,i want to creat two radio button.out of which only one can be selected.and can show the contain of selected radio box   Hi friend, Code to solve the problem : My Page Radio 11

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.