/*
* @(#)PPP.java 1.0 01/10/02
*
* You can modify the template of this file in the
* directory ..\JCreator\Templates\Template_1\Project_Name.java
*
* You can also create your own project template by making a new
* folder in the directory ..\JCreator\Template\. Use the other
* templates as examples.
*
*/
package myprojects.ppp;
import java.awt.*;
import java.awt.event.*;
class PPP extends Frame {
// Declare a reference to PSubClass and call it p
private PSubClass p;
public PPP() {
addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
dispose();
System.exit(0);
}
});
}
public void paint(Graphics g) {
// Instantiate the object p
p = new PSubClass();
// Call its only method
g.drawString("Calling p.getString() " + p.getString(),20,100);
//
g.drawString("Accessing the protected String directly " + p.s,20,200);
}
public static void main(String args[]) {
System.out.println("Starting PPP...");
PPP mainFrame = new PPP();
mainFrame.setSize(500, 300);
mainFrame.setTitle("PPP");
mainFrame.setVisible(true);
}
}
|