首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 开发语言 > 编程 >

容易学生管理系统中用到的一些知识点

2012-12-28 
简单学生管理系统中用到的一些知识点?一、表格的创建/** * 表格中的数据 */ private VectorObject data

简单学生管理系统中用到的一些知识点

?

一、表格的创建

/**

* 表格中的数据

*/

private Vector<Object> data;

/**

* 列名

*/

private Vector<String> columnNames;

?

tableModel=new DefaultTableModel(data,columnNames);

table=new JTable(tableModel);

//设置初始表格视口的大小

table.setPreferredScrollableViewportSize(newDimension(450,250));

二、清空表格中的数据

//清空数据

tableModel.getDataVector().clear();

tableModel.fireTableDataChanged();

三、图片缩放大小

ImageIcon icon=new ImageIcon(imagePath);

icon.setImage(icon.getImage().getScaledInstance(50,50,Image.SCALE_DEFAULT));

imageLabel.setIcon(icon);

?

四、数据库中存图片

?

InputStream in;

if (null != in)

pstm.setBinaryStream(5, in, in.available());

else{

pstm.setBinaryStream(5, in,0);

}

五、数据库中取图片显示

if (null != in)

pstm.setBinaryStream(5, in, in.available());

else{

pstm.setBinaryStream(5, in,0);

}

if(in!=null){

byte [] buf=new byte[in.available()];

in.read(buf);

ImageIcon icon=new ImageIcon(buf);

icon.setImage(icon.getImage().getScaledInstance(50,50,Image.SCALE_DEFAULT));

imageLabel.setIcon(icon);

imageLabel.setText("照片 : ");

}else{

imageLabel.setText("照片: 没上传照片 ");

}

热点排行