一 增强程序的健壮性
在测试的时候发现了之前没有注意到的问题,就是删除bug ,因为在T-sql中delete 一个不存在的元组是可以的。 因此做了以下的修改
public int delete_SC ( String a,String b) throws SQLException {
//这个是按照主码删除元组
this.get_sql_connection();
String sql ="delete from SC where Sno=? and Cno=?";
this.ps=this.ct.prepareStatement(sql);
this.ps.setString(1,a); this.ps.setString(2,b);
int i= ps.executeUpdate();
System.out.println(i+"行 修改");
this.close();
return i;
}
通过返回值判断表中有没有原来的元组
二、 看了同学们的,做的都十分美观于是我又改了改
效果大致这样
代码如下:
public class Touming extends JFrame {
private JTable jTable;
private JScrollPane jScrollPane;
private MyDefaultTable table ;
private ImageIcon img;
private JLabel jl1;
private DefaultTableCellRenderer renderer;
public Touming(){
super("TEST");
this.renderer= new DefaultTableCellRenderer();
this.renderer.setOpaque(false);
this.img= new ImageIcon(getClass().getResource("/photo/6.png"));//导入图片
this.jl1= new JLabel(this.img);
this.jl1.setBounds(0,0,this.img.getIconWidth(),this.img.getIconHeight());
String []str={"a","b","c"};
this.table= new MyDefaultTable(str,22);
this.jTable= new JTable(this.table);
this.jScrollPane= new JScrollPane(this.jTable);
//添加组件
this.getLayeredPane().add(this.jl1, new Integer(Integer.MIN_VALUE));
((JPanel)this.getContentPane()).setOpaque(false);
for(int i=0;i<=2;i++){
this.jTable.getColumn(str[i]).setCellRenderer(this.renderer);
}
this.jScrollPane.setOpaque(false);
this.jTable.setOpaque(false);
this.jScrollPane.getViewport().setOpaque(false);
this.getContentPane().add(this.jScrollPane);
this.setSize(800,600);
this.setDefaultCloseOperation(Windows.EXIT_ON_CLOSE);
this.setResizable(false);
this.setLocationRelativeTo(null);
this.setVisible(true);
}
public static void main(String[] args) {
new Touming();
}
}
其中对Jtable 透明是较为麻烦的,需要对每一列渲染。
优化所有的界面,这里只是展示一个例子
(反正我我自己看着还可以)
三.再次修改程序的bug
新添加的注册功能中只要是对上传图片的输入框编辑就会报出一个ClassNotFind这样类似的错误。 最后发现,还是转义字符的问题。
四、 配置obs studio
最后花了较长的时间配置成功,如图所示: