Here you can find the source of isEmptyStr(javax.swing.JTextField input)
Parameter | Description |
---|---|
input | the JTextField object |
public static boolean isEmptyStr(javax.swing.JTextField input)
//package com.java2s; /*/* w ww. j a v a 2 s.c o m*/ * @(#)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()); } }