/** Lissajous Figure Track Recorder Test by Robert John Morton * Originated as an applet * Completed Fri 10 Oct 1997 * Converted to a JFramed application Wed 15 Feb 2017 */ /* Open a terminal and change directory to where this file is loacated. To compile this program, enter the terminal command: javac trtest.java To run this program, enter the terminal command: java trtest */ import javax.swing.*; import java.awt.Dimension; // to be able to set the preferred JFrame size import java.awt.Color; // to be able to set the JFrame background colour public class trtest extends JFrame { private int XE = 240, // Horizontal extent of window and JFrame. YE = 240, // Vertical extent of window and JFrame. TH = 8; // Title bar height private trackrec TR; // instance reference to tracrec class public trtest() { // construct an instance of this extended JFrame super("Track Recorder Test"); // set the window frame title on title bar /* Set up the window listener to listen for the window close command which occurs when the user clicks on the X control in the window's title bar.*/ setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); /* Set the initial size of the extended JFrame. This is the area INSIDE the frame. It does not include the border or the title bar areas. */ setPreferredSize(new Dimension(XE, YE)); setBounds(0,0,XE,YE); // of area inside window frame setBackground(Color.lightGray); // default background colour of JFrame TR = new trackrec(XE,YE,TH); // Create new instance of trackrec class getContentPane().add(TR); // and add it to extended JFrame's pane. pack(); // should pack to fill JFrame setVisible(true); // make this extended JFrame visible } public static void main(final String[] args) { // Initiate the creation of a new instance of this extended JFrame try { javax.swing.SwingUtilities.invokeAndWait( new Runnable() { public void run() { new trtest(); } } ); } catch(Exception e) { System.out.println("Couldn't create Swing GUI. You have probably"); System.out.println("made a mistake in the constructor code of one"); System.out.println("of this class's child classes."); } } }