/** * 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 { private static final long serialVersionUID = 9L; // what the hell this is for, I don't know! private static bgimg bgi; private Color fg; // foreground colour for printing private movmap mm; private int Ny, Am, Sx, Sy, Px, Py, L; private String ANN[][] = { // Navigation Data Field Names { "WAYPOINT", " Name", " Latitude", " Longitude", " Distance (km)", " Bearing", " Radial", "", "AIRCRAFT", " Latitude", " Longitude", " Speed (km/h)", " Heading", " Req'd Hdg", " Turn Rate" }, { "VIAPONTO", " Nome", " Latitude", " Longitude", " Distância (km)", " Rolamento", " Radial", "", "AERONAVE", " Latitude", " Longitude", " Velocidade km/h", " Direção", " Dir. Requerida", " Taxa de Turno" } }, PNN[][] = { { " Refresh Rate:", " 1000 ms"," 200 ms"," 40 ms" }, { " Tax/Atualização:", " 1000 ms"," 200 ms"," 40 ms" } }, SNN[][] = { { " Map Size (km)"," 300 x 300"," 200 x 200"," 100 x 100" }, { " Tam/Mapa (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, int L) { 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; this.L = L; } public void paint(Graphics g) { g.drawImage(movmap.IMG1,0,0,this); // draw background image onto panel /* Set general font for screen lettering, get the font's letter dimensions, set height of font, set the font for writing on the applet's off-screen canvas and set the font colour. */ Font font = new Font("Serif",Font.BOLD,12); FontMetrics fm = getFontMetrics(font); int fh = 18; g.setFont(font); g.setColor(fg); int y = Ny + fh + 3; // starting height for the first field name /* Print the flight data field names on to the main back- ground image then advance down to the next text-line. */ for(int k = 0; k < 15; k++) { g.drawString(ANN[L][k],Am + 10,y); y += fh; } // print over main background image g.drawString(SNN[L][0],Sx + 5,Sy + fh); y = Sy + fh + fh + 4; // starting height for the scale selector title /* Print the scale selection options on to the main back- ground image then advance down to the next text-line. */ for(int k=1; k<4; k++) { g.drawString(SNN[L][k],Sx + 25,y); y += fh; } // print over main background image g.drawString(PNN[L][0],Px + 5,Py + fh); y = Py + fh + fh + 4; // starting height for the refresh rate title /* Print the refresh rate options on to the main back- ground image then advance down to the next text-line. */ for(int k=1; k<4; k++) { g.drawString(PNN[L][k],Px + 25,y); y += fh; } } }