How to issue a warning if required text field is empty?

I am trying to make an executable JButton (which opens a new window)radiobutton is chosen and the textfiled is filled within a specific range (the textfield should be from 1800 to 2013) . For the radiobuttons I made a default choise for now, but I cannot figure out how can I return a warning that the textfield should be filled (a number between 1800 and 2013) and if it is there then it run the program.

EDIT: So if my code is:

JFrame ....
JPanel ....

JTextField txt = new JTextField();
JButton button = new JButton("run");
button.addActionListener(new ActionListener(){
public void actionPerformed(ActionEvent e) {
//Do things here
txt.addFocusListener(new FocusListener() {

how can I use the ItemStateListener. Should I define a listener and then what?


public void actionPerformed(ActionEvent e)  
    String s = txt.getText();  
    char[] cArr = s.toCharAray();  
    ArrayList<Character> chars = new ArrayList<Character>();  
    for (char c : cArr)  
        if (c.isDigit())  
    cArr = new char[chars.size()];  
    for (int i = 0;i<chars.size();i++)  
        cArr[i] = char.get(i);  
    s = new String(cArr);  
    if (s.equals(""))  
        // issue warning  
    int input = Integer.parseInt(s);  
    if (input >=  1800 && input <= 2013)  
        // do stuff  

Basically, read the string in the text field, remove all non-numeric characters from it, and only proceed if it is in the range specified.

Need Your Help

Could not get the fontStyle property in IE8

javascript jquery

Hello I am creating a web application where I am creating a font property like this :

Objective-C Multiple Initialisers

objective-c initialization object-initializers

I have a simple question about creating multiple initialisers within an objective-c class.