Java JTextField Number largeEqualThan(javax.swing.JTextField input, double x)

Here you can find the source of largeEqualThan(javax.swing.JTextField input, double x)

Description

Check if the JTextField input is larger or equal than x

License

Open Source License

Parameter

Parameter Description
input the JTextField object
x parameter x

Return

true or false

Declaration

public static boolean largeEqualThan(javax.swing.JTextField input, double x) throws Exception 

Method Source Code


//package com.java2s;
/*/*from ww w .j  a  v a2s . 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
 *   ================
 *
 */

import java.util.Vector;

public class Main {
    /**
     * Check if the JTextField input is larger or equal than x
     * 
     * @param input the JTextField object
     * @param x  parameter x
     * @return true or false
     */
    public static boolean largeEqualThan(javax.swing.JTextField input, double x, Vector<String> errMsgList,
            String errMsg) throws Exception {
        boolean ok = largeEqualThan(input, x);
        if (!ok)
            errMsgList.add(errMsg);
        return ok;
    }

    /**
     * Check if the JTextField input is larger or equal than x
     * 
     * @param input  the JTextField object
     * @param x  parameter x
     * @return true or false
     */
    public static boolean largeEqualThan(javax.swing.JTextField input, double x) throws Exception {
        double d = new Double(input.getText()).doubleValue();
        if (d >= x)
            return true;
        return false;
    }
}

Related

  1. format(JTextField txt, double num, String fmt)
  2. getNum(JTextField txt, double defaultNum)
  3. getNumber(JTextField field, Integer defaultInt)
  4. parseIntFromField(JTextField jField, int pDefault)
  5. placeDoubleTextInField(JTextField inField, int length, double toPlace)
  6. readDoubleFromField(JTextField inField, double defaultValue)
  7. setNumericAndCharOnly(final javax.swing.JTextField textField)