Java JComboBox largeThan(javax.swing.JComboBox input, double x)

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

Description

Check if the JComboBox input is larger than x

License

Open Source License

Parameter

Parameter Description
input the JComboBox object
x parameter x

Return

true or false

Declaration

public static boolean largeThan(javax.swing.JComboBox input, double x) throws Exception 

Method Source Code


//package com.java2s;
/*/*from w  ww.  j  ava  2s  .c  om*/
 * @(#)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 than x
     * 
     * @param input the JTextField object
     * @param x parameter x
     * @return true or false
     */
    public static boolean largeThan(javax.swing.JTextField input, double x) throws Exception {
        double d = new Double(input.getText()).doubleValue();
        if (d > x)
            return true;
        return false;
    }

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

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

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

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

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

Related

  1. inputComboBox(JComboBox cbx, String[] str)
  2. isCbEquals(JComboBox cb, String str)
  3. isComboBoxButton(AbstractButton button)
  4. isEmptyStr(javax.swing.JComboBox input)
  5. isJComboBoxNotEmpty(javax.swing.JComboBox combo)
  6. loadComboBox(JComboBox combo, List list)
  7. loadEnum(JComboBox combo, Class c, boolean removeAll)
  8. loadPrefs(Preferences prefs, String prefKey, JComboBox combo)
  9. makeJComboBox(ResourceBundle resource, String panelName, String keyword)