/** * 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 ABC = new java.awt.Color(48,64,128), // applet background colour 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", " Altitude (m)"," Distance (km)"," Bearing"," Radial", "AIRCRAFT"," Latitude"," Longitude"," Altitude (m)", " Speed (km/h)"," Heading"," Req'd Hdg"," Turn Rate"}, {"VIAPONTO"," Nome"," Latitude"," Longitude", " Altitude (m)"," Distância (km)"," Rolamento", " Radial","AERONAVE"," Latitude"," Longitude", " Altitude (m)"," 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) { // draw background image onto panel // g.drawImage(movmap.IMG1,0,0,this); g.setColor(ABC); g.fillRect(0,0,620,530); g.setColor(mm.getPanelColour()); g.fillRect(15,65,138,300); // Nav annotations panel g.fillRect(15,377,130,89); // refresh rate panel g.fillRect(160,377,130,89); // map scale select 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 = 17; g.setFont(font); g.setColor(fg); /* Print the flight data field names on to the main background image then advance down to the next text-line. */ int y = Ny + fh + 5; // starting height for the first field name for(int k = 0; k < 16; k++) { g.drawString(ANN[L][k],Am + 10,y); y += fh; if(k == 7) y += 13; } // print over main background image g.drawString(SNN[L][0],Sx + 5,Sy + fh); /* Print the scale selection options on to the main back- ground image then advance down to the next text-line. */ fh = 18; y = Sy + fh + fh + 4; // starting height for the scale selector title 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; } } }