i have one txt field and one button.when i entere any test in testfield then only button should be enabled.

i have one txt field and one button.when i entere any test in testfield then only button should be enabled.

i have one txt field and one button.when i entere any test in testfield then only button should be enabled. i need for this

thanks in advance

View Answers

November 16, 2011 at 11:40 AM

import javax.swing.*;
import java.awt.event.*;
class TextFieldAndButton 
{
    public static void main(String[] args) 
    {
        JFrame f=new JFrame();
        JTextField text=new JTextField(20);
        final JButton b=new JButton("Check");
        b.setEnabled(false);
        text.addKeyListener(new KeyAdapter(){
      public void keyPressed(KeyEvent keyEvent) {
        b.setEnabled(true);
      }
      public void keyReleased(KeyEvent keyEvent) {
        b.setEnabled(true);
      }
      public void keyTyped(KeyEvent keyEvent) {
        b.setEnabled(true);
      }
    });
    text.setBounds(10,10,150,20);
    b.setBounds(10,30,100,20);
    f.setLayout(null);
    f.add(text);
    f.add(b);
    f.setVisible(true);
    f.setSize(300,100);
  }
}









Related Tutorials/Questions & Answers:
i have one txt field and one button.when i entere any test in testfield then only button should be enabled.
i have one txt field and one button.when i entere any test in testfield then only button should be enabled.  i have one txt field and one button.when i entere any test in testfield then only button should be enabled. i need
i have one txt field and one button.when i entere any test in testfield then only button should be enabled. i need for this
i have one txt field and one button.when i entere any test in testfield then only button should be enabled. i need for this   i have one txt field and one button.when i entere any test in testfield then only button should
Advertisements
I have only one day to visit the Jaipur..
I have only one day to visit the Jaipur..  Hi, I have only a day to travel in Jaipur ..hence, bit worried about what to see first
how to highlight the field in image,when i have entered into that corresponding field's textbox-any one help out
how to highlight the field in image,when i have entered into that corresponding field's textbox-any one help out  how to highlight the field in image,when i have entered into that corresponding field's textbox. Here webpage
I have posted a number of question but no one has answered?
I have posted a number of question but no one has answered?  No one has responded for ten days now. However my first question was answered on the same day. Is there a limit to the number of questions you can ask or am I doing
I want only one method goes to sleep but both method goes to sleep together
I want only one method goes to sleep but both method goes to sleep together  I built a TicTacToe game for android. And i want that there should... want like a sleep() or any other method should be invoked between User's turn
I want only one method goes to sleep but both method goes to sleep together
I want only one method goes to sleep but both method goes to sleep together  I built a TicTacToe game for android. And i want that there should... want like a sleep() or any other method should be invoked between User's turn
how can i define only one method from the interface. - Java Beginners
how can i define only one method from the interface.  If i am having an interface with 3 methods(declaration) . If i want to use only one method... the solution for that. please i want it immediately.  Hi friend
I have to retrieve these data from the field table
I have to retrieve these data from the field table  Hi. I have... as single values like chennai as one value, trichy as one value. and i have... chennai,trichy,kanchipuram for a single record. I have to retrieve these data from
I want to Transfer only 1/3rd of contents from one folder to other but my code is transferring all contents
I want to Transfer only 1/3rd of contents from one folder to other but my code...("No files in directory: " + src); } for (int i = 0; i < entries.length; i++) { File file = entries[i
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
hi , i cant make this programmer , can any one help me to make it pls - Java Beginners
hi , i cant make this programmer , can any one help me to make it pls  ... ? -Update record(s)? -Delete record(s)? -Make one copy of a specific text file... blocks. 3- Write a driver class to test your created system by creating a text
I have doubt in jsp file.
on start then only stop should be enabled. Other wise it should be disabled. When we click on start button, stop should be enabled and start should be disabled. When we click on stop button, start should be enabled and stop should be disabled
I am trying to develop a Image Sliding application but unfortunately its not working... Can any one help me in this
I am trying to develop a Image Sliding application but unfortunately its not working... Can any one help me in this  Can Anyone Help Me In This import java.awt.*; import javax.swing.*; import java.awt.event.*; class SlideShow
How can I master Java in one month?
How can I master Java in one month?  Hi, I wish to learn Java programming in one month. I have little experience in c programming and PHP programming. Is there any way to learn Java quickly. How can I master Java in one month
i want validation for one text field and text area,email,combobox, in that email will validte by useing regular expressions?
i want validation for one text field and text area,email,combobox, in that email will validte by useing regular expressions?  i want validation for one text field and text area,email,combobox, in that email will validte by useing
does any one have sudoku in java - Java Beginners
does any one have sudoku in java   i need soduko in java using applets
have any one tried ajaxanywhere with jsp/servlet please provide sample
have any one tried ajaxanywhere with jsp/servlet please provide sample ... it explains how to use this with struts but not with simple jsp servlet(or i am confused ) also in netbeans when i added this jar as said ,it shows me the method name
actually i want to knw how to include an google page inside a tab(suppose in 2nd tab).can any one help me....
how to include an google page inside a tab(suppose in 2nd tab).can any one help me....  actually i want to knw how to include an google page inside a tab(suppose in 2nd tab).can any one help me
I have one small doubt , does this code read Microsoft Office suit file format data such as .doc , .docx etc ?
I have one small doubt , does this code read Microsoft Office suit file format data such as .doc , .docx etc ?  import java.io.BufferedReader; import java.io.FileReader; import java.io.IOException; public class ReadFileExample
How do I learn Java programming in one day from zero?
. Is there any way of really learning Java in one day? How do I learn Java programming in one day from zero? I am aware of C and C++ programming language. I have used...How do I learn Java programming in one day from zero?  Hi, I am
How do I learn Java programming in one day from zero?
. Is there any way of really learning Java in one day? How do I learn Java programming in one day from zero? I am aware of C and C++ programming language. I have used...How do I learn Java programming in one day from zero?  Hi, I am
one error but i dont know how to fix it o_O!!!
one error but i dont know how to fix it o_O!!!  where is the mistake...+"Secends have"+houres+"houres,"+minutes+"minutes and"+new Secends+"secends"); } } the compilar told me that there is only one error... thx
How can I learn machine learning in one day?
How can I learn machine learning in one day?  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: How can I learn machine learning in one day? Try to provide me good
Works only for one row
Works only for one row   Hi, My below code is working only if there is a single row. could you please help me in doing it for all the rows...; <td><input type="button" value="Update Answer" onClick
in my project, i have to add only vertical scrollbar to a panel,but not horizontal scrollbar. i need some example on it,how to doit.
in my project, i have to add only vertical scrollbar to a panel,but not horizontal scrollbar. i need some example on it,how to doit.  in my project, i have to add only vertical scrollbar to a panel,but not horizontal scrollbar
i want to create an application with only a button which on click displays table from database using struts2 and hibernate on eclipse
i want to create an application with only a button which on click displays table from database using struts2 and hibernate on eclipse  please help me i have to submit this soon
can any one explain this
can any one explain this  class Clidder { private final void flipper() { System.out.println("Clidder"); } } public class Ex3 extends Clidder { public final void flipper() { System.out.println
We just have one file on the hard disk. But we can create directories, sub-directories and files in that file only
We just have one file on the hard disk. But we can create directories, sub-directories and files in that file only  We just have one file on the hard... only
We just have one file on the hard disk. But we can create directories, sub-directories and files in that file only
We just have one file on the hard disk. But we can create directories, sub-directories and files in that file only  We just have one file on the hard... only
I have a tex box. in that i want user should enter data in the format specified(for eg--a_b_c_d_e_)how to write code for it.
I have a tex box. in that i want user should enter data in the format specified(for eg--a_b_c_d_e_)how to write code for it.  I have a tex box. in that i want user should enter data in the format specified(for eg--abcde_)how
I have crude application
I have crude application   I have crude application, how to load into this roseindia.net
What is Hibernate one to one relation?Any example..
What is Hibernate one to one relation?Any example..  Hello, What is Hibernate one to one relation? Is there any example of it.. Thanks..   Dear Friend, Here are detailed tutorials and examples of Hibernate One-to-one
I am creating one jsp page in which I read in a text file, then display that data in tabular format. Now I need to calculate a total.
I am creating one jsp page in which I read in a text file, then display that data in tabular format. Now I need to calculate a total.  I am reading...... } The output displays 4 rows and 2 columns. How can I calculate the total
could any one help me?
could any one help me?  I'm a student in the faculty of computer and information science we will make graduation project "taxi dispatcher" we need... exist in mobile to our server I want to know which programming language shall I
how can i use one dbase conection in serveral pages - JSP-Servlet
this....that means i want to write only one time and i want to call that in other pages...how can i use one dbase conection in serveral pages  Hi! Thanks for sending code... But my actual requirement is In my project i am writing dbase
i have problem with classnofounderror
i have problem with classnofounderror   import java.sql.*; public class Tyagi { public static void main (String args[])throws SQLException { ResultSet rs; try { Class.forName
i have problem with classnofounderror
i have problem with classnofounderror   import java.sql.*; public class Tyagi { public static void main (String args[])throws SQLException { ResultSet rs; try { Class.forName
I have need to help
I have need to help  Write a program that, for four points A, B, C and P, draws a triangle formed by ABC and a small cross showing the position of P; and displays a line of text indicating which of the following three cases
should i learn spring in 2021
should i learn spring in 2021  Hello, I am planning for 2021... in Spring Framework. Should I learn Spring Framework in 2021? Thanks... the technologies. (adsbygoogle = window.adsbygoogle || []).push({}); I just
i have a problem in spring - Spring
i have a problem in spring  spring Aop: how to configure proxyfactorybean in xml file for providing advices for one particular class
Should I study data science?
Should I study data science?  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: Should I... can learn the topic "Should I study data science?". Also tell me
Should I learn Python 2020?
Should I learn Python 2020?  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: Should I... can learn the topic "Should I learn Python 2020?". Also tell me which
Should I learn PHP or Python?
Should I learn PHP or Python?  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: Should I... that I can learn the topic "Should I learn PHP or Python?". Also tell me
Should I learn R and Python?
Should I learn R and Python?  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: Should I... can learn the topic "Should I learn R and Python?". Also tell me
How should I learn coding?
How should I learn coding?  Hello Programmers, How should I learn coding? I want to start it from beginning. Its better if someone provides me urls... towards making your career in programming. You can choose any of following
When should I learn tensorflow
When should I learn tensorflow  Hi, TensorFlow is now getting used in industry. I am planning to learn it. When should I learn tensorflow? Thanks... TensorFlow is being used in industry now so you should learn it asap. First of you
When should I learn tensorflow
When should I learn tensorflow  Hi, TensorFlow is now getting used in industry. I am planning to learn it. When should I learn tensorflow? Thanks... TensorFlow is being used in industry now so you should learn it asap. First of you
How can I get experience in data science if no one would hire me?
How can I get experience in data science if no one would hire me?  Hi, I am beginner in Data Science and machine learning field. I am searching for the tutorials to learn: How can I get experience in data science if no one

Ads