学生信息管理系统

2019-07-16  本文已影响0人  dyh123

用户交互

用户可以进行的操作

1. 添加,删除,修改,defaultTableModel

2. 查找(筛选),排序,TableSorter

布局

Jtable

1. 由于要对表格中的数据改动,所以自己写一个tableModel类,教程链接:

https://www.cnblogs.com/the-wang/p/7256935.html?utm_source=itdadao&utm_medium=referral

2. 表格的增删改

http://yuncode.net/code/c_58ff4c58e9c2299

3. 表格元素的查找和过滤

https://www.cnblogs.com/tianyaxue/p/3494291.html

https://blog.csdn.net/b_h_l/article/details/7771944

4. 根据文本框筛选

https://blog.csdn.net/hiyohu/article/details/13802913

5.文件的导入导出

导出:https://blog.csdn.net/jueblog/article/details/10019635?utm_source=blogxgwz2

导入:https://www.jb51.net/article/128079.htm

jfileDialog: https://blog.csdn.net/Grace_1203/article/details/80137671

jfilechooser: https://docs.oracle.com/javase/7/docs/api/javax/swing/JFileChooser.html

遇到的小bug

1.this.setVisibel(true)应该放在最后,否则弹出窗体后半天都看不到效果

2.如何清空model中所有数据?

不能remove,不能new一个model,因为这会报错:array index out of range,原因是模型更新很快,可是table来不及

正确做法是model.setRowCount(0);

3.设置表格的对齐方式

DefaultTableCellRenderer renderer = new DefaultTableCellRenderer();

renderer.setHorizontalAlignment(JLabel.CENTER);

table.setDefaultRenderer(Object.class, renderer);

4.居中

Jpanel只要往里面扔东西,就可以居中排列,不需要设置JPanel的layout

但是往getContentPanel()里面扔东西就不行了

上一篇 下一篇

猜你喜欢

热点阅读