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 be enabled. i need for this i need for this

View Answers

November 16, 2011 at 4:51 PM

import javax.swing.*;
import java.awt.event.*;
class TextFieldAndButton 
{
    public static void main(String[] args) 
    {
        JFrame f=new JFrame();
        final JTextField text=new JTextField(20);
        final JButton b=new JButton("Check");
        b.setEnabled(false);
        text.addKeyListener(new KeyAdapter(){
        public void keyTyped(KeyEvent keyEvent) {
       if((text.getText()).equals("")){
        b.setEnabled(false);
       }
       else{
        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 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
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
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 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
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
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 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
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 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 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
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 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 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
I need to launch multiple instances of IE browser from one windows M/C on the another windows M/C
I need to launch multiple instances of IE browser from one windows M/C on the another windows M/C  multiple instances of IE browser from one windows M/C on the another windows M/C
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 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
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
I need an example of sessionfactory
I need an example of sessionfactory  Hi, I need an example of session factory in hibernate. If you can provide me one with, that would be great...Thanks
hi .. need help ASAP ..i have a project buit in eclipse , i have installed jasper. i want the steps to work on it ..
hi .. need help ASAP ..i have a project buit in eclipse , i have installed jasper. i want the steps to work on it ..   hi .. need help ASAP ..i have a project buit in eclipse , i have installed jasper. i want the steps to work
hello there i need help
OPtions: once i have chosen an option then i should proceed here if i choose b... me with the codes and please explain to me how it works. i only need to use...hello there i need help  : i need to do a program like
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
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 crude application
I have crude application   I have crude application, how to load into this roseindia.net
in my project, i have to add scrollbars to a panel,. i need some example on it,how to doit.
in my project, i have to add scrollbars to a panel,. i need some example on it,how to doit.  in my project, i have to add scrollbars to a panel,. i need some example on it,how to doit. Thanks In Advance   Please
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
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
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
i need project
i need project  can u send online shoppin project 2 my mailid.   Please visit the following links: Struts2 Shopping cart JSP-Servlet Shopping cart
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
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
i need a help in this please
i need a help in this please  The factorial of a nonnegative integer n is written n! (pronounced â?? n factorialâ??) and is defined as follows: n!=n...=input.nextInt(); long num=m; for(int i=m;i>1;i
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 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 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 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
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
how can i use one dbase conection in serveral pages - JSP-Servlet
connections many times whereever i need in several pages. How can I avoid 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
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
I need to develop a gui like this
I need to develop a gui like this  Hai Friends, I need to develop... field Gained focus. then the list appear with some string values...someone please help me   sorry goes through this link I need to develop like
I have problem in my Project
I have problem in my Project  Dear Sir, i have problem in my project about Jtable i have EDIT JButton whenevery i was click on edit he is display all data from database but i want to select any row

Ads