1/**
2 * Copyright(C) 1998
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 : January 1, 1998.
11 * @author : Salih Yurttas.
12 */
13
14
15import java.awt.*;
16import java.awt.event.*;
17
18import java.io.*;
19
20public class NameFile00 extends Frame
21 implements ActionListener {
22
23 public static void main(String[] args) {
24 Frame f = new NameFile00();
25
26 f.setSize(400, 400);
27 f.show();
28 }
29
30 private StringList sl;
31 private TextField iFNTF;
32 private boolean fIO = true;
33
34 class IWA extends WindowAdapter {
35 public void windowClosing(WindowEvent e) {
36 System.exit(0);
37 }
38 }
39
40 public NameFile00() {
41 setTitle("NameFile00");
42 setLayout(new FlowLayout());
43
44 IWA wa = new IWA();
45
46 addWindowListener(wa);
47
48 iFNTF = new TextField(32);
49 add(iFNTF);
50 iFNTF.addActionListener(this);
51
52 iFNTF.setText("inFileName: ");
53 }
54
55 public void actionPerformed(ActionEvent e) {
56
57 if(fIO) {
58 try {
59 sl = new StringList();
60 String fileN = new String(iFNTF.getText());
61 sl.getStringList(fileN);
62 fIO = false;
63 iFNTF.setText("outFileName: ");
64 }
65 catch(IOException ioe) {
66 System.out.println("IOException...");
67 }
68 }
69 else {
70 try {
71 String fileN = new String(iFNTF.getText());
72 sl.putStringList(fileN);
73 fIO = true;
74 iFNTF.setText("inFileName: ");
75 }
76 catch(IOException ioe) {
77 System.out.println("IOException...");
78 }
79 }
80 }
81
82}