Java Query(based on swing concept)

Java Query(based on swing concept)

I want a particular submit button to get disabled whenever i write some account number starting with 774 and 775 in a text box of that screen.

View Answers

March 7, 2011 at 5:08 PM

Java swing disable button

import java.awt.*;
import javax.swing.*;
import java.awt.event.*;
class DisableButton{
    public static void main(String[] args){
    JFrame f=new JFrame();
    JLabel label=new JLabel("Account Number: ");
    final JTextField text=new JTextField(20);
    final JButton b=new JButton("Check");
    text.addKeyListener(new KeyAdapter(){
        public void keyReleased(KeyEvent e){
        String value=text.getText();
        if(value.startsWith("774")||value.startsWith("775")){
            b.setEnabled(false);
            }
            else{
            b.setEnabled(true);
            }
        }
    });

        JPanel p=new JPanel(new GridLayout(2,2));
        p.add(label);
        p.add(text);
        p.add(b);
        f.add(p);
        f.setVisible(true);
        f.pack();
    }
}

Ads









Related Tutorials/Questions & Answers:
Java Query(based on swing concept)
Java Query(based on swing concept)  I want a particular submit button to get disabled whenever i write some account number starting with 774 and 775 in a text box of that screen
How to execute mysql query based on checkboxes values in java swing application.
How to execute mysql query based on checkboxes values in java swing application.  Hello Sir, I have a java swing application and i have to execute query based on selection of checkboxes.Means I have to to execute
Advertisements
How to execute mysql query based on checkboxes values in java swing application.
How to execute mysql query based on checkboxes values in java swing application.  Hello Sir, I have a java swing application and i have to execute query based on selection of checkboxes.Means I have to to execute
How to execute mysql query based on checkboxes values in java swing application.
How to execute mysql query based on checkboxes values in java swing application.  Hello Sir, I have a java swing application and i have to execute query based on selection of checkboxes.Means I have to to execute
java query
java query  what is the alternative of fflush(stdin) in java
java query
java query  **strong text**getting an error can not run symbol while running this program..plz help me... import java.util.Scanner; class Great { public static void main(String args[]) { int a; int b; int c; Scanner x
Maven dependency for com.cocosw - query version 0.2 is released. Learn to use query version 0.2 in Maven based Java projects
version 0.2 ) in their Java project if it is based on Maven and Gradle. How...; com.cocosw - query version 0.2 in Java projects. Follow the step by step tutorial...; com.cocosw - query version 0.2 java library in your project. Now you can save
query on java servlet
query on java servlet  hello sir,i am doing online exam using j2ee (i.e) with servlet and back end ms access just like statically after that i will use dynamic connection sir.what queries to be used for data base validation
Maven dependency for cn.jimmyshi - bean-query version 1.0.0 is released. Learn to use bean-query version 1.0.0 in Maven based Java projects
this version ( cn.jimmyshi - bean-query version 1.0.0 ) in their Java project if it is based on Maven and Gradle. How to use  cn.jimmyshi - bean-query version 1.0.0 in project? Steps to use  cn.jimmyshi - bean-query version 1.0.0 in Java
Maven dependency for cn.jimmyshi - bean-query version 1.0.1 is released. Learn to use bean-query version 1.0.1 in Maven based Java projects
this version ( cn.jimmyshi - bean-query version 1.0.1 ) in their Java project if it is based on Maven and Gradle. How to use  cn.jimmyshi - bean-query version 1.0.1 in project? Steps to use  cn.jimmyshi - bean-query version 1.0.1 in Java
Maven dependency for cn.jimmyshi - bean-query version 1.1.0 is released. Learn to use bean-query version 1.1.0 in Maven based Java projects
this version ( cn.jimmyshi - bean-query version 1.1.0 ) in their Java project if it is based on Maven and Gradle. How to use  cn.jimmyshi - bean-query version 1.1.0 in project? Steps to use  cn.jimmyshi - bean-query version 1.1.0 in Java
Maven dependency for cn.jimmyshi - bean-query version 1.1.1 is released. Learn to use bean-query version 1.1.1 in Maven based Java projects
this version ( cn.jimmyshi - bean-query version 1.1.1 ) in their Java project if it is based on Maven and Gradle. How to use  cn.jimmyshi - bean-query version 1.1.1 in project? Steps to use  cn.jimmyshi - bean-query version 1.1.1 in Java
Maven dependency for cn.jimmyshi - bean-query version 1.1.2 is released. Learn to use bean-query version 1.1.2 in Maven based Java projects
this version ( cn.jimmyshi - bean-query version 1.1.2 ) in their Java project if it is based on Maven and Gradle. How to use  cn.jimmyshi - bean-query version 1.1.2 in project? Steps to use  cn.jimmyshi - bean-query version 1.1.2 in Java
Maven dependency for cn.jimmyshi - bean-query version 1.1.3 is released. Learn to use bean-query version 1.1.3 in Maven based Java projects
this version ( cn.jimmyshi - bean-query version 1.1.3 ) in their Java project if it is based on Maven and Gradle. How to use  cn.jimmyshi - bean-query version 1.1.3 in project? Steps to use  cn.jimmyshi - bean-query version 1.1.3 in Java
Maven dependency for cn.jimmyshi - bean-query version 1.1.4 is released. Learn to use bean-query version 1.1.4 in Maven based Java projects
this version ( cn.jimmyshi - bean-query version 1.1.4 ) in their Java project if it is based on Maven and Gradle. How to use  cn.jimmyshi - bean-query version 1.1.4 in project? Steps to use  cn.jimmyshi - bean-query version 1.1.4 in Java
Maven dependency for cn.jimmyshi - bean-query version 1.1.5 is released. Learn to use bean-query version 1.1.5 in Maven based Java projects
this version ( cn.jimmyshi - bean-query version 1.1.5 ) in their Java project if it is based on Maven and Gradle. How to use  cn.jimmyshi - bean-query version 1.1.5 in project? Steps to use  cn.jimmyshi - bean-query version 1.1.5 in Java
Java image query from Rupesh
Java image query from Rupesh  who give web page link to any submenu in menu bar of screen in java so that after click on that submenu, this submenu direct link to web brower or web page
How to make query and abstraction in Java
How to make query and abstraction in Java  Hi, I read the lessons... write. I am very beginner in Java I don't know anything in it. I am using PostgreSQL database, and I want to make a query and abstraction for a table. Could
bigdecimal in java query
bigdecimal in java query  Hello, I want to create a boolean method which compares two objects and returns true if equal. At the same time I want this method to compare the values of variables of the same objects and returns true
Maven dependency for software.amazon.awssdk - aws-query-protocol version 2.15.58 is released. Learn to use aws-query-protocol version 2.15.58 in Maven based Java projects
( software.amazon.awssdk - aws-query-protocol version 2.15.58 ) in their Java project if it is based on Maven and Gradle. How to use  software.amazon.awssdk - aws-query... - aws-query-protocol version 2.15.58 in Java projects. Follow the step by step
Maven dependency for software.amazon.awssdk - aws-query-protocol version 2.15.59 is released. Learn to use aws-query-protocol version 2.15.59 in Maven based Java projects
( software.amazon.awssdk - aws-query-protocol version 2.15.59 ) in their Java project if it is based on Maven and Gradle. How to use  software.amazon.awssdk - aws-query... - aws-query-protocol version 2.15.59 in Java projects. Follow the step by step
Maven dependency for software.amazon.awssdk - aws-query-protocol version 2.15.60 is released. Learn to use aws-query-protocol version 2.15.60 in Maven based Java projects
( software.amazon.awssdk - aws-query-protocol version 2.15.60 ) in their Java project if it is based on Maven and Gradle. How to use  software.amazon.awssdk - aws-query... - aws-query-protocol version 2.15.60 in Java projects. Follow the step by step
Maven dependency for software.amazon.awssdk - aws-query-protocol version 2.15.61 is released. Learn to use aws-query-protocol version 2.15.61 in Maven based Java projects
( software.amazon.awssdk - aws-query-protocol version 2.15.61 ) in their Java project if it is based on Maven and Gradle. How to use  software.amazon.awssdk - aws-query... - aws-query-protocol version 2.15.61 in Java projects. Follow the step by step
Maven dependency for software.amazon.awssdk - aws-query-protocol version 2.15.62 is released. Learn to use aws-query-protocol version 2.15.62 in Maven based Java projects
( software.amazon.awssdk - aws-query-protocol version 2.15.62 ) in their Java project if it is based on Maven and Gradle. How to use  software.amazon.awssdk - aws-query... - aws-query-protocol version 2.15.62 in Java projects. Follow the step by step
Maven dependency for software.amazon.awssdk - aws-query-protocol version 2.15.63 is released. Learn to use aws-query-protocol version 2.15.63 in Maven based Java projects
( software.amazon.awssdk - aws-query-protocol version 2.15.63 ) in their Java project if it is based on Maven and Gradle. How to use  software.amazon.awssdk - aws-query... - aws-query-protocol version 2.15.63 in Java projects. Follow the step by step
Maven dependency for software.amazon.awssdk - aws-query-protocol version 2.15.64 is released. Learn to use aws-query-protocol version 2.15.64 in Maven based Java projects
( software.amazon.awssdk - aws-query-protocol version 2.15.64 ) in their Java project if it is based on Maven and Gradle. How to use  software.amazon.awssdk - aws-query... - aws-query-protocol version 2.15.64 in Java projects. Follow the step by step
Maven dependency for software.amazon.awssdk - aws-query-protocol version 2.15.65 is released. Learn to use aws-query-protocol version 2.15.65 in Maven based Java projects
( software.amazon.awssdk - aws-query-protocol version 2.15.65 ) in their Java project if it is based on Maven and Gradle. How to use  software.amazon.awssdk - aws-query... - aws-query-protocol version 2.15.65 in Java projects. Follow the step by step
Maven dependency for software.amazon.awssdk - aws-query-protocol version 2.15.66 is released. Learn to use aws-query-protocol version 2.15.66 in Maven based Java projects
( software.amazon.awssdk - aws-query-protocol version 2.15.66 ) in their Java project if it is based on Maven and Gradle. How to use  software.amazon.awssdk - aws-query... - aws-query-protocol version 2.15.66 in Java projects. Follow the step by step
Maven dependency for software.amazon.awssdk - aws-query-protocol version 2.15.67 is released. Learn to use aws-query-protocol version 2.15.67 in Maven based Java projects
( software.amazon.awssdk - aws-query-protocol version 2.15.67 ) in their Java project if it is based on Maven and Gradle. How to use  software.amazon.awssdk - aws-query... - aws-query-protocol version 2.15.67 in Java projects. Follow the step by step
Maven dependency for software.amazon.awssdk - aws-query-protocol version 2.15.68 is released. Learn to use aws-query-protocol version 2.15.68 in Maven based Java projects
( software.amazon.awssdk - aws-query-protocol version 2.15.68 ) in their Java project if it is based on Maven and Gradle. How to use  software.amazon.awssdk - aws-query... - aws-query-protocol version 2.15.68 in Java projects. Follow the step by step
Maven dependency for software.amazon.awssdk - aws-query-protocol version 2.15.69 is released. Learn to use aws-query-protocol version 2.15.69 in Maven based Java projects
( software.amazon.awssdk - aws-query-protocol version 2.15.69 ) in their Java project if it is based on Maven and Gradle. How to use  software.amazon.awssdk - aws-query... - aws-query-protocol version 2.15.69 in Java projects. Follow the step by step

Ads