Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
/*
 * @(#)VerifyUtil.java   
 *
 * Copyright (C) 2006 www.interpss.com
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU LESSER GENERAL PUBLIC LICENSE
 * as published by the Free Software Foundation; either version 2.1
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * @Author Mike Zhou
 * @Version 1.0
 * @Date 09/15/2006
 * 
 *   Revision History
 *   ================
 *
 */

public class Main {
    /**
     * Check if the JTextField input is empty
     * 
     * @param input the JTextField object
     * @return true or false
     */
    public static boolean isEmptyStr(javax.swing.JTextField input) {
        return "".equals(input.getText().trim());
    }

    /**
     * Check if the JComboBox selection is empty
     * 
     * @param input the JComboBox object
     * @return true or false
     */
    public static boolean isEmptyStr(javax.swing.JComboBox input) {
        String str = (String) input.getSelectedItem();
        return str == null || "".equals(str.trim());
    }
}