Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

import javax.swing.InputVerifier;
import javax.swing.JComponent;
import javax.swing.JTextField;

public class Main {

    public static void main(String[] args) {
        JTextField tf = new JTextField("");
        tf.setInputVerifier(new MyInputVerifier());

    }
}

class MyInputVerifier extends InputVerifier {
    public boolean verify(JComponent input) {
        JTextField tf = (JTextField) input;
        String pass = tf.getText();
        return pass.equals("AA");
    }
}