/** * 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 Selected Station Name panel */ import javax.swing.*; // the Swing GUI system import java.awt.*; // abstract windiwing toolkit public class frequencypanel extends JPanel { private static final long serialVersionUID = 121L; // what the hell this is for, I don't know! private Color bg; // background colour transparent white hfbrx hf; boolean FrequenciesLoaded = false; int w, h, y; // panel's width and height font vertical baseline offset int FreqNum; // selected frequency Font font; // font for panel lettering frequencypanel(int w, int h, int y, Font font, hfbrx hf, Color bg) { this.w = w; this.h = h; this.font = font; this.y = y; this.hf = hf; this.bg = bg; } void setFreq(int f) { FreqNum = f; repaint(); } // (RE)DISPLAY THE FREQUENCY CONFIRMATION FIELD public void paint(Graphics g) { if(FrequenciesLoaded) { // if frequencies download is complete // select the new listening frequency hf.frequencies.setSelectedIndex(FreqNum); String s = hf.frequencies.getItemAt(FreqNum); g.setColor(bg); // clear the field by g.fillRect(0,0,w,h); // filling it with background colour g.setFont(font); // use the big bold font g.setColor(Color.black); // colour for display confirmation field g.drawString(s,4,y); // display the lettering } } public void update(Graphics g) {paint(g);} void setState(boolean b) {FrequenciesLoaded = b;} }