Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.awt.Color;

import javax.swing.JTextField;

public class Main {
    public static boolean verifyIntegerTextField(JTextField field) {
        try {
            Integer.valueOf(field.getText());
            field.setBackground(Color.WHITE);
        } catch (NumberFormatException e) {
            field.setBackground(Color.LIGHT_GRAY);
            return false;
        }

        return true;
    }
}