/** * 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 import java.awt.image.BufferedImage; public class worldmap extends JPanel { private static final long serialVersionUID = 212L; // what the hell this is for, I don't know! private static final String // S-meter scale S[] = {" 0",""," 2",""," 4",""," 6",""," 8","","10","","12"}; private static final Font font1 = new Font("Serif",Font.BOLD, 14), // for Choice menus and buttons font2 = new Font("Serif",Font.PLAIN,12); // for Choice menus and buttons private BufferedImage img; // reference to the app's background image private Color bg4 = new Color(180,180,180); // graticule colour private int GC, // graph centre GR, // graph right GB, // graph base GL, // graph left GT, // graph top SL = S.length, // length of the S[] String array X1, // x-coordinate of left side of S-Meter scale graduation mark X2, // x-coordinate of right side of S-Meter scale graduation mark X3, // x-coordinate of the figures of the S-Meter scale X4, /* x-coordinate of right side of extended bottom line of S-Meter graduations */ X6, // x-coordinate of S-METER title X7, // x-coordinate of span-selector end of left half of arrow X8, // x-coordinate of span-selector end of right half of arrow X9, // x-coordinate of left arrow head X0, // x-coordinate of the right arrow head Y1, /* upper extremity of frequency graduation marks just below bottom of scope screen */ Y2, /* lower extremity of frequency graduation marks just below bottom of scope screen */ Y3, // y-coordinate of frequency span arrows Y4, // arrow head indication frequency span Y5, // arrow head indication frequency span Y6, // y-coordinate of S-METER title Y7, /* y-coordinate of top of centre-line just above the centre frequency field */ Y8, /* y-coordinate of bottom of centre-line just above the centre frequency field */ I, // frequency scale graduation loop limit dy; // y-offset of baseline of S-Meter figures from graduation marks worldmap(BufferedImage i, int GL, int GB, int GT, int GW, int SX) { img = i; this.GL = GL; this.GB = GB; this.GT = GT; GR = GL + GW; /* Graph Right (x-coordinate of the right side of the graph area) */ GC = GL + GW / 2; /* Graph Centre (x-coordinate of the centre of the graph area) */ Y1 = GB + 5; /* upper extremity of frequency graduation marks just below bottom of scope screen */ Y2 = GB + 10; /* lower extremity of frequency graduation marks just below bottom of scope screen */ Y3 = GT - 20; // y-coordinate of frequency span arrows Y4 = Y3 + 3; // arrow head indicatin frequency span Y5 = Y3 - 3; // arrow head indicatin frequency span Y6 = GT - 15; // y-coordinate of S-METER title Y7 = GB + 25; /* y-coordinate of top of centre-line just above the centre frequency field */ Y8 = GB + 40; /* y-coordinate of bottom of centre-line just above the centre frequency field */ X1 = SX - 6; /* x-coordinate of left side of S-Meter scale graduation mark */ X2 = SX - 12; /* x-coordinate of right side of S-Meter scale graduation mark */ X3 = SX - 22; // x-coordinate of the figures of the S-Meter scale X4 = SX + 19; /* x-coordinate of right side of extended bottom line of S-Meter graduations */ X6 = SX - 4; // x-coordinate of S-METER title X7 = GC - 52; // x-coordinate of span-selector end of left half of arrow X8 = GC + 51; // x-coordinate of span-selector end of right half of arrow X9 = GL + 5; // x-coordinate of left arrow head X0 = GR - 5; // x-coordinate of the right arrow head I = GL + 210; // frequency scale graduation loop limit dy = (getFontMetrics(font2).getAscent() >> 1) - 2; } public void paint(Graphics g) { // draw the background image onto the applet canvas g.drawImage(img,0,0,this); // FREQUENCY SCALE MARKS JUST BELOW BOTTOM OF SCOPE SCREEN g.setColor(Color.black); for(int i = GL; i < I; i += 20) // for each frequency graduation g.drawLine(i,Y1,i,Y2); // draw frequency graduation marks g.drawLine(GL,Y1,GR,Y1); // horizontal axis (frequency) g.drawLine(GC,Y7,GC,Y8); // centre-line just above centre frequency field g.drawLine(GL,Y3,X7,Y3); // horizontal left-hand span arrow g.drawLine(GL,Y3,X9,Y5); g.drawLine(GL,Y3,X9,Y4); g.drawLine(X8,Y3,GR,Y3); // horizontal right-hand span arrow g.drawLine(X0,Y5,GR,Y3); g.drawLine(X0,Y4,GR,Y3); g.setFont(font1); convert.centreString(g,"S-Meter",X6,Y6); // print S-METER title int y = GB; g.setFont(font2); for(int i = 0; i < SL; i++){ // for each S-unit graduation convert.centreString(g,S[i],X3,y+dy); // draw S-meter figure g.drawLine(X1,y,X2,y); // draw graduation mark y -= 8; // accumulated number of S-meter scale pixels } g.drawLine(X1,GB,X4,GB); // draw extended bottom graduation mark g.setColor(bg4); g.drawLine(GR,GT,GR,GB); // border line at the right of the graph g.drawLine(GL,GB,GR,GB); // border line at the right of the graph } }