KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > DataLoaderTests > DataObjectTest > data > SecurityJApplet


1 package DataLoaderTests.DataObjectTest.data;
2
3 /*
4  * SecurityJApplet.java
5  *
6  * Created on December 16, 1999, 10:39 AM
7  */

8  
9 import java.io.*;
10
11 /**
12  *
13  * @author pknakal
14  * @version
15  */

16 public class SecurityJApplet extends javax.swing.JApplet JavaDoc {
17
18   /** Creates new form SecurityJApplet */
19     public SecurityJApplet() {
20     initComponents ();
21   }
22
23   /** This method is called from within the constructor to
24    * initialize the form.
25    * WARNING: Do NOT modify this code. The content of this method is
26    * always regenerated by the FormEditor.
27    */

28   private void initComponents () {//GEN-BEGIN:initComponents
29
jButton1 = new javax.swing.JButton JavaDoc ();
30     jLabel1 = new javax.swing.JLabel JavaDoc ();
31
32     jButton1.setText ("Push me :-)");
33     jButton1.addMouseListener (new java.awt.event.MouseAdapter JavaDoc () {
34       public void mouseClicked (java.awt.event.MouseEvent JavaDoc evt) {
35         createFile (evt);
36       }
37     }
38     );
39
40
41     getContentPane ().add (jButton1, java.awt.BorderLayout.SOUTH);
42
43     jLabel1.setText ("Buttun create file in actual directory = \".\"");
44
45
46     getContentPane ().add (jLabel1, java.awt.BorderLayout.CENTER);
47
48   }//GEN-END:initComponents
49

50 private void createFile (java.awt.event.MouseEvent JavaDoc evt) {//GEN-FIRST:event_createFile
51
try {
52       FileOutputStream fstream = new FileOutputStream("Pokus");
53       DataOutputStream dstream = new DataOutputStream(fstream);
54       dstream.writeBytes("*********************************************\n");
55       dstream.flush();
56       dstream.close();
57     }
58     catch (IOException e) {
59     }
60   }//GEN-LAST:event_createFile
61

62
63   // Variables declaration - do not modify//GEN-BEGIN:variables
64
private javax.swing.JButton JavaDoc jButton1;
65   private javax.swing.JLabel JavaDoc jLabel1;
66   // End of variables declaration//GEN-END:variables
67

68 }
Popular Tags