/** * 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 Messages panel */ import javax.swing.*; // the Swing GUI system import java.awt.*; // abstract windiwing toolkit public class stationnamepanel extends JPanel { private static final long serialVersionUID = 120L; // what the hell this is for, I don't know! private Color bg; // background colour transparent white hfbrx hf; boolean StationNamesLoaded = false; int w, h, y; // panel's width and height font vertical baseline offset int stn; // station name Font font; // font for panel lettering stationnamepanel(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 setStn(int x) { stn = x; repaint(); } // (RE)DISPLAY THE STATION NAME CONFIRMATION FIELD public void paint(Graphics g) { if(StationNamesLoaded) { //provided staion names download is complete hf.stations.setSelectedIndex(stn); //select the new station String s = hf.stations.getItemAt(stn); 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 lettering g.drawString(s, 4, y); //display the lettering } } public void update(Graphics g) { paint(g); } void setStationNamesLoaded() {StationNamesLoaded = true;} }