更新数据库时更新我的​​ 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 (将#修改为@)