⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 jmlistmodel.java

📁 梦界家园程序开发基底框架
💻 JAVA
字号:
package jm.framework.gui.module;

import javax.swing.DefaultListModel;

import jm.util.JM2DArray;

/**
 * <p>Title: JM 整合Swing控件,使用配置信息</p>
 *
 * <p>Copyright: Copyright (c) 2004-2006</p>
 *
 * <p>Company: 1SHome</p>
 *
 * <p>@author Spook</p>
 *
 * @since 1.3
 * @see JDK 1.5.0.6
 */
public class JMListModel extends DefaultListModel {
    JM2DArray DataSource = null;
    public JMListModel () {
        super();
    }

    public JMListModel (JM2DArray data) {
        super();
        DataSource = data;
    }

    /**
     * Returns the value at the specified index.
     *
     * @param index the requested index
     * @return the value at <code>index</code>
     * @todo Implement this javax.swing.ListModel method
     */
    public Object getElementAt (int index) {
        if (DataSource == null) {
            return super.getElementAt(index);
        }
        try {
            return DataSource.getStringValue(index, 1);
        } catch (Exception e) {
            return null;
        }
    }
    /**
     * Returns the code at the specified index.
     *
     * @param index the requested index
     * @return the value at <code>index</code>
     * @todo Implement this javax.swing.ListModel method
     */
    public String getElementCodeAt (int index) {
        if (DataSource == null) {
            return ""+index;
        }
        try {
            return DataSource.getStringValue(index, 0);
        } catch (Exception e) {
            return null;
        }
    }
    /**
     * Returns the length of the list.
     *
     * @return the length of the list
     * @todo Implement this javax.swing.ListModel method
     */
    public int getSize () {
        if (DataSource == null) {
            return super.getSize();
        }
        return DataSource.rowCount();
    }

}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -