/** * HF Receiver Controller Applet 1.0.0 * @author Robert J Morton YE572246C * @version 25 November 2001, revanped 16 November 2007, Swing Version 31 January 2012 * @copyright Robert J Morton (all rights reserved) */ /* This is the Applet's background image panel */ import javax.swing.*; // the Swing GUI system import java.awt.*; // abstract windiwing toolkit public class bgimg extends JPanel { //what the hell this is for, I don't private static final long serialVersionUID = 27L; private static bgimg bgi; private Color fg; // foreground colour for printing private movmap mm; private int Ny, Am, Sx, Sy, Px, Py; private String // Navigation Data Field Names ANN[] = { "WAYPOINT", " Name", " Latitude", " Longitude", " Distance (km)", " Bearing", " Radial", "", "AIRCRAFT", " Latitude", " Longitude", " Speed (km/h)", " Heading", " Req'd Hdg", " Turn Rate" }, PNN[] = {" Refresh Rate:", " 1000 ms"," 200 ms"," 40 ms"}, SNN[] = {" Map Size (km)"," 300 x 300"," 200 x 200"," 100 x 100"}; bgimg(movmap mm, int Ny, int Am, int Sx, int Sy, int Px, int Py, Color fg) { this.mm = mm; this.Ny = Ny; this.Am = Am; this.Sx = Sx; this.Sy = Sy; this.Px = Px; this.Py = Py; this.fg = fg; bgi = this; } public void paint(Graphics g) { //draw the background image onto the panel g.drawImage(movmap.IMG1,0,0,this); // Create a font for screen lettering and get its letter dimensions. Font font = new Font("Serif",Font.BOLD,12); FontMetrics fm = getFontMetrics(font); int fh = 18; // set inter-line leading g.setFont(font); // set the font typeface and colour for g.setColor(fg); // writing on the applet's off-screen canvas /* Set the starting height for the first field name and then print the flight data field names on to the main background image. */ int y = Ny + fh + 3; for(int k = 0; k < 15; k++) { g.drawString(ANN[k],Am + 10,y); y += fh; } /* Print the title of the scale selector panel then set the starting height for the scale selector options and print the scale selector options on to main background image. */ g.drawString(SNN[0],Sx + 5,Sy + fh); y = Sy + fh + fh + 4; for(int k=1; k<4; k++) { g.drawString(SNN[k],Sx + 25,y); y += fh; } /* Print the title of the refresh rate selector panel then set the starting height for the refresh rate selector options and print the scale selector options on to main background image. */ g.drawString(PNN[0],Px + 5,Py + fh); y = Py + fh + fh + 4; for(int k=1; k<4; k++) { g.drawString(PNN[k], Px + 25, y); y += fh; } } }