1 /*
2 * BeanPeelerDemo.java
3 *
4 * Created on 21 February 2001, 21:25
5 */
6
7 package org.johndavidtaylor.beans.beanpeeler;
8 import java.awt.BorderLayout;
9 import java.awt.Point;
10 import java.util.Enumeration;
11 import java.util.Vector;
12 /***
13 *
14 * @author Default
15 * @version
16 */
17 public class BeanPeelerDemo extends java.applet.Applet {
18
19 /*** Initializes the applet BeanPeelerDemo */
20 public void init () {
21 initComponents ();
22 bean = new TestBean("Change me by hitting edit");
23 add(bean, BorderLayout.CENTER);
24 }
25
26 /*** This method is called from within the init() method to
27 * initialize the form.
28 * WARNING: Do NOT modify this code. The content of this method is
29 * always regenerated by the FormEditor.
30 */
31 private void initComponents() {//GEN-BEGIN:initComponents
32 panel1 = new java.awt.Panel();
33 button1 = new java.awt.Button();
34 label1 = new java.awt.Label();
35
36 setLayout(new java.awt.BorderLayout());
37
38 panel1.setFont(new java.awt.Font("Dialog", 0, 11));
39 panel1.setName("panel4");
40 panel1.setBackground(new java.awt.Color(204, 204, 204));
41 panel1.setForeground(java.awt.Color.black);
42 button1.setFont(new java.awt.Font("Dialog", 0, 11));
43 button1.setLabel("Edit the Bean");
44 button1.setName("button4");
45 button1.setBackground(java.awt.Color.lightGray);
46 button1.setForeground(java.awt.Color.black);
47 button1.addActionListener(new java.awt.event.ActionListener() {
48 public void actionPerformed(java.awt.event.ActionEvent evt) {
49 button1ActionPerformed(evt);
50 }
51 });
52
53 panel1.add(button1);
54
55 add(panel1, java.awt.BorderLayout.SOUTH);
56
57 add(label1, java.awt.BorderLayout.NORTH);
58
59 }//GEN-END:initComponents
60
61 private void button1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_button1ActionPerformed
62
63 BeanPeeler bp = new BeanPeeler(bean);
64
65 bean.addPropertyChangeListener(bp); //if the bean implements property change stuff then beanpeeler can listen for it
66 bp.setLocation(new Point(0,300));
67 bp.show();
68 BeanPeeler bpbp = new BeanPeeler(bp);
69 bpbp.setLocation(new Point(300,0));
70 bpbp.setTitle("You can even edit a BeanPeeler with a BeanPeeler");
71 bpbp.show();
72 System.out.println("Errors and warnings:");
73 Vector errs = bp.getErrors();
74 Enumeration it = errs.elements();
75 while (it.hasMoreElements()) {System.out.println(it.nextElement());}
76
77 }//GEN-LAST:event_button1ActionPerformed
78
79 private TestBean bean;
80 // Variables declaration - do not modify//GEN-BEGIN:variables
81 private java.awt.Panel panel1;
82 private java.awt.Button button1;
83 private java.awt.Label label1;
84 // End of variables declaration//GEN-END:variables
85 }
This page was automatically generated by Maven