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

public class adressbook extends JFrame {
   private outputpanel controls;
   private adresspanel scrollArea;
   private JTextArea output;
   private String url;
   private Connection connect;
   private JScrollPane textpane;

   public adressbook()
   {
      super( "YTO REHBER " );
      Container c = getContentPane();
      scrollArea = new adresspanel();
      output = new JTextArea( 6, 30 );
      c.setLayout( new BorderLayout() );
      c.add( new JScrollPane( scrollArea ),
             BorderLayout.CENTER );
      textpane = new JScrollPane( output );
      c.add( textpane, BorderLayout.SOUTH );
      // mae database connection
      try {
         url = "jdbc:ODBC:YTO";
         connect = DriverManager.getConnection( url );
         output.append( "Connection is established\n" );
      }
      catch ( SQLException sqlex ) {
         sqlex.printStackTrace();
         output.append( "Connection is not established\n" +
                        sqlex.toString() );
      }
      catch ( Exception ex ) {
         ex.printStackTrace();
         output.append( ex.toString() );
      }
      controls =
         new outputpanel( connect, scrollArea, output);
      c.add( controls, BorderLayout.NORTH );
      setSize( 500, 500 );
      setVisible(true);
   }

   public static void main( String args[] )
   {
      adressbook app = new adressbook();
      app.setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE );
   }
}

