微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

更新数据库时更新我的​​ JFrame

如何解决更新数据库时更新我的​​ JFrame

我正在开发 2 个依赖于同一个数据库的应用程序。 我使用 java swing 并且我想在从其他应用程序更新数据库时更新我的​​框架。 我尝试使用

在循环中编写代码
while (this.isVisible())

但它不起作用。 我的代码

try
 { 
 Class.forName("com.MysqL.jdbc.Driver");
 Connection con= DriverManager.getConnection("jdbc:MysqL://localhost/Base","root","");
 PreparedStatement pstmt = con.prepareStatement("SELECT enter from table where person =? ");
 pstmt.setString(1,"responsable");
 ResultSet rs= pstmt.executeQuery();
 while (this.isVisible()){
 while(rs.next()){
 
 if (rs.getInt("enter")==0)
   {
     jLabel13.hide();
     jLabel10.setVisible(true);
   }
else
   {
     jLabel10.hide();
     jLabel13.setVisible(true);
    }}}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。