/* File: HelpFrame.java Author: Stefan Robila Description: this is just an example of a PopUp frame that does not do anything fancy. It just prints a message in it and has also a close button. The structure of HelpFrame class is: public class HelpFrame extends Frame implements ActionListener { The Data: -------- private TextArea t; - the text area where the text will be printed private Button close; - the close button private String text; - a text The Methods: ----------- public HelpFrame(String s); - the constructor of my frame public void actionPerformed(ActionEvent e); - catches the pressing of the close button } */ // The Code: // -------- import java.awt.event.*; import java.awt.*; public class HelpFrame extends Frame implements ActionListener { private TextArea t; private Button close; private String text; // constructor public HelpFrame(String s) { // call the constructor of the parent super(s); setTitle("Fractal Design v1.1: Help"); setSize(400,400); // create the text to be displayed text="Welcome to Fractal Design v1.0!\n\n"+ "- For changing the fractal choose another one from the list"+ "\n\n- For changing the depth check another checkbox"; // create the text area and add it to the frame t = new TextArea(text, 5,60,TextArea.SCROLLBARS_VERTICAL_ONLY); t.setEditable(false); add(t,BorderLayout.CENTER); // create the close button and add it to the frame close = new Button("Close"); add(close,BorderLayout.SOUTH); close.addActionListener(this); } public void actionPerformed(ActionEvent e) { // close the frame setVisible(false); } }