主窗体程序...package framedemo;import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.ScrollPane;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;public class MyExample extends JFrame implements ActionListener{
private static MyExample myExample ;
private static JPanel jPanel1 = new JPanel();
private static JPanel jPanel2 = new JPanel();
private JButton btn1;
private JButton btn2;
private JButton btn3;
private JButton btn4;
private JButton btn5;
private static JTable table;
private static JScrollPane jsp;  
private static Object columnNames[]={"编号","书名",};
private static Object rowData[][] = new Object[15][2];
private static Connection conn = null;
private static Statement sql = null;
private static ResultSet rs=null;  public MyExample(){
  super("图书管理系统");
  setBounds(100, 100, 500, 500); 
  btn1 = new JButton("查询");
  btn2 = new JButton("添加");
  btn3 = new JButton("修改");
  btn4 = new JButton("删除");
  btn5 = new JButton("退出");
  btn1.addActionListener(this);
  btn4.addActionListener(this);
  jPanel1.setLayout(new FlowLayout());
  jPanel1.add(btn1);
  jPanel1.add(btn2);
  jPanel1.add(btn3);
  jPanel1.add(btn4);
  jPanel1.add(btn5);
  this.add(jPanel1,BorderLayout.SOUTH);
  setVisible(true);
  this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  }
public static void main(String[] args) {
myExample = new MyExample();
sqlQuery();
}public static void sqlQuery(){try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}catch (ClassNotFoundException e) {
System.out.println("驱动加载错误...");
}
try{
conn = DriverManager.getConnection("jdbc:odbc:MyBook");
sql=conn.createStatement();
rs=sql.executeQuery("select * from book");
for(int i=0;i<15;i++){
if(rs.next()){
for(int j=0;j<2;j++){
rowData[i][j] = rs.getString(j+1);
}
}
}
rs.close();
sql.close();
conn.close();
}catch(SQLException e){
System.out.println("数据库连接错误...");
}
table = new JTable(rowData, columnNames);
jsp =new JScrollPane(table);
jsp.setViewportView(table);
jPanel2.add(jsp);
myExample.add(jPanel2,BorderLayout.CENTER);
myExample.setVisible(true);
}
public void actionPerformed(ActionEvent e) {
if(e.getSource()==btn4){
new Delete();
}else if(e.getSource()==btn1){
new Query();
}
}}删除数据窗体package framedemo;import java.awt.BorderLayout;
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JTextField;
import java.sql.*;
public class Delete extends JFrame implements ActionListener{
JOptionPane jOptionPane = new JOptionPane();
JPanel jPanel1 = new JPanel();
JPanel jPanel2 = new JPanel();
JLabel jl= new JLabel("删除的编号");
JTextField jtf = new JTextField();
JButton jButton1 = new JButton("确定");
JButton jButton2 = new JButton("退出");
  public Delete(){
  super("删除书籍");
  jPanel1.setLayout(new FlowLayout());
  jPanel1.add(jl);
  jPanel1.add(jtf);
  jtf.setColumns(10);
  this.add(jPanel1,BorderLayout.CENTER);
  jPanel2.setLayout(new FlowLayout());
  jPanel2.add(jButton1);
  jPanel2.add(jButton2);
  jButton1.addActionListener(this);
  jButton2.addActionListener(this);
  this.add(jPanel2,BorderLayout.CENTER);
  setBounds(150, 150, 200, 200); 
  setLayout(new FlowLayout());
  setVisible(true);
  this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
  }
public static void main(String[] args) {
new Delete();
}public void actionPerformed(ActionEvent e) {
if(e.getSource()==jButton1){
Connection conn = null;
Statement sql = null;
try{
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
}catch (ClassNotFoundException ee) {
System.out.println("驱动加载错误...");
}
try{
if(jOptionPane.showConfirmDialog(this,"您确定要删除吗?","提示",
JOptionPane.YES_NO_OPTION) == JOptionPane.YES_OPTION){
conn = DriverManager.getConnection("jdbc:odbc:MyBook");
sql=conn.createStatement();
String str = "delete from book where id = '"+jtf.getText()+"'";  
sql.executeUpdate(str); 
MyExample.sqlQuery();
sql.close();
conn.close();}
}catch(SQLException se){
System.out.println("数据库连接错误...");
}}else if(e.getSource()==jButton2){
System.exit(0);
//this.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);}
}}就是删除之后不能自动更新 主窗体要重新运行 才能显示出删除后的结果。我要点删除之后,主窗体自动更新 应该怎么做啊