import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.table.*;

public class access_Table extends JFrame
{
  JTextField hostField;
  JTextField tableField;
  JTextArea queryField;
  QueryTableModel qtm;
  static final long serialVersionUID = 8597941330711875390L;
  public access_Table()
  { 
	super("access Database SQL querry running Table");
    //addWindowListener(new BasicWindowMonitor());
    setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
    setSize(500,300);
    qtm=new QueryTableModel();
    JTable table=new JTable(qtm);
    JScrollPane scrollpane=new JScrollPane(table);
    JPanel p1=new JPanel();
    p1.setLayout(new GridLayout(3,2));
    p1.add(new JLabel(" enter name of your url :"));
    p1.add(hostField=new JTextField("jdbc:odbc:YTO"));
    p1.add(new JLabel("enter SQL(Sequential Query Language) statement :"));
    p1.add(queryField=new JTextArea("select *\n from REHBER"));
    p1.add(new JLabel("push button to send querry:"));
    JButton jb=new JButton("execute SQL querry");
    jb.addActionListener(new ActionListener()
      {
      public void actionPerformed(ActionEvent e)
        {
        qtm.setHostURL(hostField.getText().trim());
        qtm.setQuery(queryField.getText().trim());
        }
      }); // jb.addActionlistener
  p1.add(jb);
  getContentPane().add(p1,BorderLayout.NORTH);
  getContentPane().add(scrollpane,BorderLayout.CENTER);
  } //DatabaseTest()

  public static void main(String args[])
  {
     access_Table tt=new access_Table();
     tt.setVisible(true);
  }
}
