Yurttas/PL/DBL/mssql/F/04/02/00/JDBCScriptRunnerFileWriteActionHandler.java

 1/**
 2 *  Copyright(C) 2003
 3 *  All Rights Reserved. Salih Yurttas, ZCubes, BitsOfCode Software Systems, Inc..
 4 *
 5 *  Permission to use, copy, modify, and distribute this
 6 *  software and its documentation for EDUCATIONAL purposes
 7 *  and without fee is hereby granted provided that this
 8 *  copyright notice appears in all copies.
 9 *
10 *  @date   : June 1, 2003.
11 *  @authorĀ : Salih Yurttas, Brian Autry.
12 */
13
14
15import javax.swing.*;
16import java.awt.*;
17import java.awt.event.*;
18
19import java.sql.*;
20
21public class JDBCScriptRunnerFileWriteActionHandler implements ActionListener {
22
23  private JTextArea txtOut;
24  private JTextField txtIn;
25
26  public JDBCScriptRunnerFileWriteActionHandler(JTextArea out,
27                                                JTextField in) {
28    txtOut = out;
29    txtIn = in;
30  }
31
32  public void actionPerformed(ActionEvent e) {
33    JDBCScriptRunnerFileIO jFIO = new JDBCScriptRunnerFileIO();
34    if(jFIO.writeFile( txtIn.getText(),txtOut.getText() ))
35      txtOut.setText(txtOut.getText() + "\nFile saved succesfully!");
36    else
37      txtOut.setText(txtOut.getText() + "\nFile saved failed!");
38  }
39
40}