📄 jmlistmodel.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 + -