ClassSelectionPanel.java 文件源码

java
阅读 17 收藏 0 点赞 0 评论 0

项目:AgentWorkbench 作者:
/**
 * This method checks if a given class reference is valid.
 *
 * @param jTextField the j text field
 * @param jButton the j button
 * @return true, if is valid class
 */
private boolean isValidClass(JTextField jTextField) {

    String className = jTextField.getText().trim();
    if (this.class2Search4DefaultValue==null && className.equals("")) {
        // --- If no default value is configured, an empty text field is allowed -----
        this.getJButtonCheckClass().setIcon(this.imageGreen);
        this.setValidClass(true);
        return true;
    } else if (isAllowNull()==true && className.equals("")) {
        this.getJButtonCheckClass().setIcon(this.imageGreen);
        this.setValidClass(true);
        return true;

    } else {
        // --- If a default value is configured, there should be a valid class ------ 
        try {
            @SuppressWarnings("unused")
            Class<?> clazz = BaseClassLoadServiceUtility.forName(className);
            this.getJButtonCheckClass().setIcon(this.imageGreen);
            this.setValidClass(true);
            return true;

        } catch (ClassNotFoundException e) {
            //e.printStackTrace();
            this.getJButtonCheckClass().setIcon(this.imageRed);
        }
    }
    this.setValidClass(false);
    return false;
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号