import java.awt.*; import java.applet.*; import java.lang.*; import java.net.*; import java.io.*; import java.util.*; import java.sql.*; //import XeoMenu; public class focas extends Applet { Color bgcolor = new Color(0,0,200); //XeoMenu go_to_table; Button laser,relay_optics_t,telescope_t,location_t,data_format,link_range, noise_sources,atmosphere,amplifier,detector,relay_optics_r,telescope_r, load_link,save_link,location_r,pointing; Choice links; Label t_laser,t_telescope_t,t_location_t,t_amplifier,t_detector,t_telescope_r,t_title,t_location_r,heading,t_link,t_transmitter,t_reciever; // Link Parameters String LinkName = new String("SP-TMF"); // LASER PARAMETERS String LaserName = new String("Q-switched ND:YAG"); boolean LaserType = true; //if true laser type is CW if false laser type is Pulsed boolean Wavelength_units = true; //if true unit is nm if false unit is um boolean Power_units = false; //if true unit is mW if false unit is W boolean Spectral_units = false; //if true unit is = if false unit is nm double LaserWavelength=1.064E-6; double LaserAvgPower=10; double LaserSpectralWidth = 10 ; double LaserPulseWidth = 20; //Relay optics Transmitter Parameteres double RelayOpticsTrans = 0; boolean Relay_units = true; //if true units is % else dB //Transmitter Telescope Properties String T_TelescopeName = new String("X2000"); double ApertureDiameter = .3; double SecondaryObsuration =.03 ; double TelescopeLosses =20 ; double Surface_Quality =16 ; double BeamWidth =0 ; boolean Aperture_units = true; // same convention...the button to the left is true if on boolean Secondary_units = false; boolean TelescopeLosses_units = false; boolean Surface_units = false; boolean BeamProfile = true; boolean inSpace = true; //Receiver Telescope Props String R_TelescopeName = new String("X2000"); double R_ApertureDiameter = .3; double R_SecondaryObsuration =.03; double R_TelescopeLosses =20 ; boolean R_Aperture_units = true; // same convention...the button to the left is true if on boolean R_Secondary_units = true; boolean R_TelescopeLosses_units = false; boolean R_inSpace = true; double RxSurfErr=0; //Pointing (Transmitter) double PointingBeamwidth = 0; double PointingOffset = 0; double PointingJitter = 0; boolean PointingOffset_units = true; boolean PointingJitter_units = true; // Reciever Location double Altitude= 0.0; double Latitude = 0.0; String Location = "TMF"; String alt_units = "m"; int r_index =15; // Data Format double LaserMod=0,PulseSlot=0,K=0,DataRate=0,BER=0; double P=0,N=0; int Pindex=0,Nindex=0; boolean Modtype=true; String Coding_type="None"; String DataRate_units = "Kbps"; // Noise Sources String Stars = "None"; String Planets = "None"; String Conditions = "Dark"; double Distance = 0; // Atmosphere double Seeing= 9.69628,Trans=.85,Angle=70; boolean usedefault = false,Seeing_units= true; // Link Range; double Range = 0; //Amplifier String AmpModel = "Transimpedance model"; boolean Hz_units = true; double AmpNEI=0,ampBANDWIDTH=0,ampRANGE=0,ampGAIN=0; //Detector double Quantum=0,BulkDark=0,SurfaceDark=0,RiseFall=0,DetectorDiameter=0,Capacitance=0,Gain=0,Ionization=0; String Detector="Si APD IR Enhanced (EG&G C30954E)"; //Reciever Relay Optics double Field=0,Truncation=0,Split=0,Redundancy=0,Pointing=0,Optical=0,Spectral=0,Peak=0; boolean truncation_units=true,split_units=true,redundancy_units=true,pointing_units=true,optical_units=true; //Location transmitter String Location_t = "GEO"; double Altitude_t= 0.0; double Latitude_t = 0.0; String alt_units_t = "m"; int t_index = 5; // Parameters not in pop-up windows String newTRANSLoc, newRECloc,atmosMODEL,detectorTYPE; boolean LaserInSpace; double laser_variation,LS_TxLossMO,TxLossTO,TxLossSS; double pt_allowance,atm_adj,RxSrcDist,RxLossTO,RxLossSS; double coding_adj; //array of wavelengths needed to calculate Quantum efficiency int QE_wavelengths[] = new int[76]; // DATABASE STUFF Connection C; String url = "jdbc:mysql://localhost:3306/focas"; public void init() { setBackground(bgcolor); make_begin(); int step=0; for(int i =0;i<76;i++,step+=20) { QE_wavelengths[i] = 500+step; } try { Class.forName("org.gjt.mm.mysql.Driver").newInstance(); System.out.println("Done"); } catch(Exception E){System.err.println("Unable to load driver");} try { C = DriverManager.getConnection(url,"birju","patel"); String ex = "SELECT * " + "FROM laser " + "WHERE name = '" + LaserName + "' "; Statement stmt = C.createStatement(); System.out.println(ex); ResultSet results = stmt.executeQuery(ex); System.out.println( results.getString(1)); System.out.println( results.getString(2)); } catch (SQLException d) { System.out.println("SQLException: " + d.getMessage()); System.out.println("SQLState: " + d.getSQLState()); System.out.println("VendorError: " + d.getErrorCode()); } /* try { getinfo(); } catch(IOException esa){}*/ } public void paint(Graphics g) { paintComponents(g); } public void make_begin() { Label version = new Label("Java v1.0"); GridBagLayout gridbag = new GridBagLayout(); Panel panel1,panel2,panel3,panel4,panel5; // Create all buttons laser = new Button("Laser"); relay_optics_t = new Button("Relay Optics"); relay_optics_r = new Button("Relay Optics"); telescope_t = new Button("Telescope"); telescope_r = new Button("Telescope"); location_t = new Button("Location"); location_r = new Button("Location"); data_format = new Button("Data Format"); link_range = new Button("Link Range"); noise_sources = new Button("Noise Sources"); atmosphere = new Button("Atmosphere"); amplifier = new Button("Amplifier"); detector = new Button("Detector"); pointing = new Button("Pointing"); save_link = new Button("Save Link"); laser.setBackground(Color.lightGray); relay_optics_t.setBackground(Color.lightGray); relay_optics_r.setBackground(Color.lightGray); telescope_t.setBackground(Color.lightGray); telescope_r.setBackground(Color.lightGray);; location_t.setBackground(Color.lightGray); location_r.setBackground(Color.lightGray); data_format.setBackground(Color.lightGray); link_range.setBackground(Color.lightGray); noise_sources.setBackground(Color.lightGray); atmosphere.setBackground(Color.lightGray); amplifier.setBackground(Color.lightGray); detector.setBackground(Color.lightGray); save_link.setBackground(Color.lightGray); //go_to_table.setBackground(Color.white); pointing.setBackground(Color.lightGray); links = new Choice(); links.addItem("Gold Downlink"); links.addItem("Mars Downlink (Night, APD)"); links.addItem("Mars Downlink (Night, PMT)"); links.addItem("SP-TMF"); links.addItem("Europa Downlink (Day, APD)"); links.addItem("Europa Downlink (Night, PMT)"); links.setBackground(Color.lightGray); links.select(LinkName); t_title = new Label("Gold Downlink"); t_title.setFont(new Font("Helvetica",Font.BOLD,20)); t_laser = new Label(LaserName); t_telescope_t = new Label(T_TelescopeName); t_telescope_r = new Label(R_TelescopeName); t_location_r = new Label(Location); t_location_t = new Label(Location_t); t_amplifier = new Label(AmpModel); t_detector = new Label(Detector); t_link = new Label("Link: "); t_transmitter = new Label("Transmitter"); t_reciever = new Label("Receiver"); t_title.setForeground(Color.white); t_laser.setForeground(Color.white); t_telescope_t.setForeground(Color.white); t_telescope_r.setForeground(Color.white); t_location_t.setForeground(Color.white); t_location_r.setForeground(Color.white); t_amplifier.setForeground(Color.white); t_detector.setForeground(Color.white); t_link.setForeground(Color.white); t_transmitter.setForeground(Color.yellow); t_reciever.setForeground(Color.yellow); version.setForeground(Color.yellow); version.setFont(new Font("Helvetica",Font.BOLD,12)); //go_to_table = new XeoMenu(this); t_link.setFont(new Font("Helvetica",Font.BOLD,16)); t_transmitter.setFont(new Font("Helvetica",Font.BOLD,16)); t_reciever.setFont(new Font("Helvetica",Font.BOLD,16)); t_title.setAlignment(t_title.CENTER); t_telescope_t.setAlignment(t_telescope_t.CENTER); t_telescope_r.setAlignment(t_telescope_r.CENTER); t_location_t.setAlignment(t_location_t.CENTER); t_amplifier.setAlignment(t_amplifier.CENTER); t_detector.setAlignment(t_detector.CENTER); t_location_r.setAlignment(t_location_r.CENTER); this.setLayout(gridbag); heading = new Label("Free-space Optical Communications Analysis Software"); heading.setFont(new Font("Helvetica",Font.BOLD,22)); heading.setForeground(Color.yellow); panel1 = new Panel(); //Center title panel panel1.setLayout(gridbag); panel1.setBackground(Color.black); constrain(panel1,t_title,0,0,3,1,GridBagConstraints.NONE,GridBagConstraints.CENTER,0.0,0.0,0,0,0,0); panel2 = new Panel(); panel2.setBackground(new Color(91,91,255)); panel2.setLayout(gridbag); constrain(panel2,laser,0,0,1,1,GridBagConstraints.HORIZONTAL,GridBagConstraints.CENTER,0.0,0.0,0,0,0,0); constrain(panel2,t_laser,0,1,1,1,GridBagConstraints.NONE,GridBagConstraints.CENTER,0.0,0.0,0,0,0,0); constrain(panel2,relay_optics_t,0,2,1,1,GridBagConstraints.HORIZONTAL,GridBagConstraints.CENTER,0.0,0.0,20,0,0,0); constrain(panel2,telescope_t,0,3,1,1,GridBagConstraints.HORIZONTAL,GridBagConstraints.CENTER,0.0,0.0,30,0,0,0); constrain(panel2,t_telescope_t,0,4,1,1,GridBagConstraints.HORIZONTAL,GridBagConstraints.CENTER,0.0,0.0,0,0,0,0); constrain(panel2,pointing,0,5,1,1,GridBagConstraints.HORIZONTAL,GridBagConstraints.CENTER,0.0,0.0,30,0,0,0); constrain(panel2,location_t,0,7,1,1,GridBagConstraints.HORIZONTAL,GridBagConstraints.CENTER,0.0,0.0,30,0,0,0); constrain(panel2,t_location_t,0,8,1,1,GridBagConstraints.HORIZONTAL,GridBagConstraints.CENTER,0.0,0.0,0,0,0,0); panel3 = new Panel(); panel3.setBackground(new Color(0,0,200)); panel3.setLayout(gridbag); constrain(panel3,data_format,0,0,1,1,GridBagConstraints.HORIZONTAL,GridBagConstraints.CENTER,0.0,0.0,0,0,0,0); constrain(panel3,link_range,0,1,1,1,GridBagConstraints.HORIZONTAL,GridBagConstraints.CENTER,0.0,0.0,0,0,20,0); constrain(panel3,noise_sources,0,6,1,1,GridBagConstraints.HORIZONTAL,GridBagConstraints.CENTER,0.0,0.0,20,0,0,0); constrain(panel3,atmosphere,0,7,1,1,GridBagConstraints.HORIZONTAL,GridBagConstraints.CENTER,0.0,0.0,0,0,0,0); panel4 = new Panel(); panel4.setBackground(new Color(91,91,255)); panel4.setLayout(gridbag); constrain(panel4,amplifier,0,0,1,1,GridBagConstraints.HORIZONTAL,GridBagConstraints.CENTER,0.0,0.0,0,0,0,0); constrain(panel4,t_amplifier,0,1,1,1,GridBagConstraints.NONE,GridBagConstraints.CENTER,0.0,0.0,0,0,0,0); constrain(panel4,detector,0,2,1,1,GridBagConstraints.HORIZONTAL,GridBagConstraints.CENTER,0.0,0.0,0,0,0,0); constrain(panel4,t_detector,0,3,1,1,GridBagConstraints.HORIZONTAL,GridBagConstraints.CENTER,0.0,0.0,0,0,10,0); constrain(panel4,relay_optics_r,0,4,1,1,GridBagConstraints.HORIZONTAL,GridBagConstraints.CENTER,0.0,0.0,10,0,0,0); constrain(panel4,telescope_r,0,5,1,1,GridBagConstraints.HORIZONTAL,GridBagConstraints.CENTER,0.0,0.0,35,0,0,0); constrain(panel4,t_telescope_r,0,6,1,1,GridBagConstraints.HORIZONTAL,GridBagConstraints.CENTER,0.0,0.0,0,0,0,0); constrain(panel4,location_r,0,7,1,1,GridBagConstraints.HORIZONTAL,GridBagConstraints.CENTER,0.0,0.0,30,0,0,0); constrain(panel4,t_location_r,0,8,1,1,GridBagConstraints.HORIZONTAL,GridBagConstraints.CENTER,0.0,0.0,0,0,0,0); panel5 = new Panel(); panel5.setLayout(gridbag); constrain(panel5,t_link,0,0,1,1,GridBagConstraints.NONE,GridBagConstraints.WEST,0.0,0.0,0,0,0,0); constrain(panel5,links,1,0,1,1,GridBagConstraints.NONE,GridBagConstraints.CENTER,0.0,0.0,7,0,0,10); constrain(panel5,save_link,2,0,1,1,GridBagConstraints.NONE,GridBagConstraints.CENTER,0.0,0.0,0,0,0,0); //constrain(panel5,go_to_table,3,0,1,1,GridBagConstraints.NONE,GridBagConstraints.CENTER,0.0,0.0,0,0,0,0); Panel spa = new Panel(); spa.setLayout(gridbag); Panel spa1 = new Panel(); spa1.setLayout(gridbag); constrain(spa,heading,0,0,1,1,GridBagConstraints.NONE,GridBagConstraints.CENTER,0.0,0.0,0,0,0,0); constrain(this,spa,0,0,1,1,GridBagConstraints.NONE,GridBagConstraints.CENTER,0.0,0.0,0,0,0,0); constrain(spa1,version,1,1,1,1,GridBagConstraints.NONE,GridBagConstraints.CENTER,0.0,0.0,0,0,50,0); constrain(spa1,t_transmitter,0,2,1,1,GridBagConstraints.NONE,GridBagConstraints.CENTER,0.0,0.0,0,0,0,0); constrain(spa1,t_reciever,2,2,1,1,GridBagConstraints.NONE,GridBagConstraints.CENTER,0.0,0.0,0,0,0,0); constrain(spa1,t_title,1,2,1,1,GridBagConstraints.HORIZONTAL,GridBagConstraints.CENTER,0.0,0.0,0,0,0,0); constrain(spa1,panel2,0,3,1,1,GridBagConstraints.NONE,GridBagConstraints.NORTHWEST,0.0,0.0,0,0,0,0); constrain(spa1,panel3,1,3,1,1,GridBagConstraints.NONE,GridBagConstraints.CENTER,0.0,0.0,0,0,0,0); constrain(spa1,panel4,2,3,1,1,GridBagConstraints.NONE,GridBagConstraints.NORTHWEST,0.0,0.0,0,0,0,0); constrain(spa1,panel5,1,5,1,1,GridBagConstraints.NONE,GridBagConstraints.SOUTH,0.0,0.0,75,0,0,0); constrain(this,spa1,0,1,1,1,GridBagConstraints.NONE,GridBagConstraints.CENTER,0.0,0.0,0,0,0,0); //go_to_table.initialize(); //go_to_table.repaint(); //constrain(this, go_to_table, 0, 2, 0, 0,GridBagConstraints.NONE,GridBagConstraints.CENTER,0.0,0.0,0,0,0,0); } public boolean action(Event event,Object arg) { if (event.target == links) { LinkName = links.getSelectedItem(); t_title.setText(LinkName); t_title.setAlignment(t_title.CENTER); try{getinfo();} catch(IOException ew){} t_location_r.setText(Location); t_location_r.setAlignment(t_location_r.CENTER); t_location_t.setText(Location_t); t_location_t.setAlignment(t_location_t.CENTER); t_laser.setText(LaserName); t_laser.setAlignment(t_laser.CENTER); t_telescope_t.setText(T_TelescopeName); t_telescope_t.setAlignment(t_telescope_t.CENTER); t_telescope_r.setText(R_TelescopeName); t_telescope_r.setAlignment(t_telescope_r.CENTER); t_detector.setText(Detector); t_detector.setAlignment(t_detector.CENTER); t_amplifier.setText(AmpModel); t_amplifier.setAlignment(t_amplifier.CENTER); return true; } else if(event.target == location_r) { location_r_frame p = new location_r_frame("Reciever Location"); t_location_r.setText(Location); t_location_r.setAlignment(t_location_r.CENTER); return true; } else if(event.target == pointing) { pointing_frame w = new pointing_frame("Transmitter Pointing"); return true; } else if (event.target == relay_optics_t) { relay_frame x = new relay_frame("Relay Optics"); return true; } else if (event.target == laser) { laser_frame f = new laser_frame("Laser Parameters"); return true; } else if(event.target == telescope_t) { telescope_t_frame d = new telescope_t_frame("Transmitter Telescope"); return true; } else if(event.target == data_format) { data_format_frame t = new data_format_frame("Data Format"); return true; } else if(event.target == noise_sources) { noise_sources_frame y = new noise_sources_frame("Noise Sources"); return true; } else if(event.target == atmosphere) { atmosphere_frame o = new atmosphere_frame("Atmosphere Parameters"); return true; } else if(event.target == amplifier) { amplifier_frame p = new amplifier_frame("Pre-Amplifier"); return true; } else if(event.target == detector) { detector_frame zc = new detector_frame("Detector"); return true; } else if(event.target == relay_optics_r) { r_relay_optics_frame op = new r_relay_optics_frame("Reciever Relay Optics"); return true; } else if(event.target == location_t) { location_t_frame we = new location_t_frame("Transmitter Location"); return true; } else if(event.target == telescope_r) { telescope_r_frame kl = new telescope_r_frame("Reciever Telescope"); return true; } else if(event.target == link_range) { link_range_frame ad = new link_range_frame("Link Range"); return true; } else return false; } public class amplifier_frame extends Frame { private Button ok,cancel; private Label label1,label2; private Choice amplifier; private CheckboxGroup b_hz; private Checkbox[] cb_hz; private TextField nei,dynamic,bandwidth,ampgain; public amplifier_frame(String title) { super(title); ok = new Button("Ok"); cancel = new Button("Cancel"); amplifier = new Choice(); amplifier.addItem(""); amplifier.addItem("Transimpedance model"); amplifier.addItem("High-Impedance model"); amplifier.addItem("Fujitsu FMM321CP"); amplifier.addItem("Fujitsu FMM324CP"); amplifier.addItem("Fujitsu FMM322CP"); amplifier.addItem("Fujitsu FMM323CP"); amplifier.addItem("AMI 322"); amplifier.select(AmpModel); nei = new TextField(String.valueOf(AmpNEI),10); dynamic = new TextField(String.valueOf(ampRANGE),10); bandwidth = new TextField(String.valueOf(ampBANDWIDTH),10); ampgain = new TextField(String.valueOf(ampGAIN),10); b_hz = new CheckboxGroup(); cb_hz = new Checkbox[2]; cb_hz[0] = new Checkbox("MHz",b_hz,Hz_units); cb_hz[1] = new Checkbox("GHz",b_hz,!Hz_units); Panel panel1 = new Panel(); Panel panel2 = new Panel(); Panel panel3 = new Panel(); GridBagLayout gridbag = new GridBagLayout(); panel1.setLayout(gridbag); panel2.setLayout(gridbag); panel3.setLayout(gridbag); this.setLayout(gridbag); constrain(panel1,new Label("Name: "),0,0,1,1); constrain(panel1,amplifier,1,0,1,1); constrain(panel2,new Label("Amplifier Gain (V/A)"),0,0,1,1); constrain(panel2,ampgain,1,0,1,1); constrain(panel2,new Label("Bandwidth"),0,1,1,1); constrain(panel2,bandwidth,1,1,1,1); constrain(panel2,cb_hz[0],2,1,1,1); constrain(panel2,cb_hz[1],3,1,1,1); constrain(panel2,new Label("Dynamic Range (dB)"),0,2,1,1); constrain(panel2,dynamic,1,2,1,1); constrain(panel2,new Label("Noise Equivalent Current"),0,3,1,1); constrain(panel2,nei,1,3,1,1); constrain(panel2,new Label("A/sqrt(Hz)"),2,3,1,1); constrain(panel3,ok,0,0,1,1,0,0,0,10); constrain(panel3,cancel,1,0,1,1,0,10,0,0); constrain(this,panel1,0,0,1,1); constrain(this,panel2,0,1,1,1); constrain(this,panel3,0,2,1,1,20,0,0,0); this.pack(); this.show(); } public boolean action(Event e,Object arg) { if (e.target == ok) { update(); dispose(); return true; } else if(e.target == cancel) { dispose(); return true; } else return false; } public void update() { AmpModel = amplifier.getSelectedItem(); t_amplifier.setText(AmpModel); t_amplifier.setAlignment(t_amplifier.CENTER); } } public class location_t_frame extends Frame { private Button ok,cancel; private Label label1,label2,label3; private TextField t_altitude,t_latitude; private CheckboxGroup b_units; private Checkbox[] cb_units; private Choice c_locations; public location_t_frame(String Title) { super(Title); ok = new Button("Ok"); cancel = new Button("Cancel"); label1 = new Label("Altitude: "); label2 = new Label("Latitude: "); label3 = new Label("Location: "); t_altitude = new TextField(String.valueOf(Altitude_t),10); t_latitude = new TextField(String.valueOf(Latitude_t),10); b_units = new CheckboxGroup(); cb_units = new Checkbox[3]; cb_units[0] = new Checkbox("m",b_units,(alt_units_t == "m")); cb_units[1] = new Checkbox("ft",b_units,(alt_units_t == "ft")); cb_units[2] = new Checkbox("km",b_units,(alt_units_t == "km")); c_locations = new Choice(); c_locations.addItem("Moon"); c_locations.addItem("Shuttle"); c_locations.addItem("Space Station"); c_locations.addItem("LEO"); c_locations.addItem("GEO"); c_locations.addItem("Venus"); c_locations.addItem("Mars"); c_locations.addItem("Jupiter"); c_locations.addItem("Saturn"); c_locations.addItem("Uranus"); c_locations.addItem("Neptune"); c_locations.addItem("Pluto"); c_locations.addItem("Comet"); c_locations.addItem("Asteroid"); c_locations.addItem("Other"); c_locations.addItem("TMF"); c_locations.addItem("Starfire"); c_locations.addItem("Strawberry Peek"); c_locations.addItem("Mt. Lemmon"); c_locations.addItem("Goldstone"); c_locations.addItem("Mesa"); c_locations.addItem("JPL"); c_locations.select(Location_t); t_index=c_locations.getSelectedIndex(); System.out.println(Location_t); Panel panel1,panel2,panel3,panel4; panel1 = new Panel(); panel2 = new Panel(); panel3 = new Panel(); panel4 = new Panel(); GridBagLayout gridbag = new GridBagLayout(); this.setLayout(gridbag); panel1.setLayout(gridbag); panel2.setLayout(gridbag); panel3.setLayout(gridbag); panel4.setLayout(gridbag); constrain(panel1,label3,0,0,1,1,GridBagConstraints.NONE,GridBagConstraints.CENTER,0.0,0.0,0,0,0,0); constrain(panel1,c_locations,1,0,1,1,GridBagConstraints.NONE,GridBagConstraints.CENTER,0.0,0.0,0,0,0,0); constrain(panel2,label1,0,0,1,1,GridBagConstraints.NONE,GridBagConstraints.CENTER,0.0,0.0,0,0,0,0); constrain(panel2,t_altitude,1,0,1,1,GridBagConstraints.NONE,GridBagConstraints.CENTER,0.0,0.0,0,0,0,0); constrain(panel2,cb_units[0],2,0,1,1,GridBagConstraints.NONE,GridBagConstraints.CENTER,0.0,0.0,0,0,0,0); constrain(panel2,cb_units[1],3,0,1,1,GridBagConstraints.NONE,GridBagConstraints.CENTER,0.0,0.0,0,0,0,0); constrain(panel2,cb_units[2],4,0,1,1,GridBagConstraints.NONE,GridBagConstraints.CENTER,0.0,0.0,0,0,0,0); constrain(panel3,label2,0,0,1,1,GridBagConstraints.NONE,GridBagConstraints.WEST,0.0,0.0,0,0,0,0); constrain(panel3,t_latitude,1,0,1,1,GridBagConstraints.NONE,GridBagConstraints.WEST,0.0,0.0,0,0,0,0); constrain(panel4,ok,0,0,1,1,GridBagConstraints.NONE,GridBagConstraints.CENTER,0.0,0.0,0,0,0,10); constrain(panel4,cancel,1,0,1,1,GridBagConstraints.NONE,GridBagConstraints.CENTER,0.0,0.0,0,10,0,0); constrain(this,panel1,0,0,1,1,GridBagConstraints.NONE,GridBagConstraints.CENTER,0.0,0.0,0,0,0,0); constrain(this,panel2,0,1,1,1,GridBagConstraints.NONE,GridBagConstraints.CENTER,0.0,0.0,0,0,0,0); constrain(this,panel3,0,2,1,1,GridBagConstraints.NONE,GridBagConstraints.WEST,0.0,0.0,0,0,0,0); constrain(this,panel4,0,3,1,1,GridBagConstraints.NONE,GridBagConstraints.CENTER,0.0,0.0,0,0,0,0); this.pack(); this.show(); } public boolean action(Event e,Object arg) { if(e.target == ok) { update(); dispose(); return true; } else if(e.target == cancel) { dispose(); return true; } else return false; } public void update() { Altitude_t = (Double.valueOf(t_altitude.getText())).doubleValue(); Latitude_t = (Double.valueOf(t_latitude.getText())).doubleValue(); alt_units_t = (b_units.getCurrent()).getLabel(); Location_t = c_locations.getSelectedItem(); t_index = c_locations.getSelectedIndex(); t_location_t.setText(Location_t); t_location_t.setAlignment(t_location_t.CENTER); } } public class link_range_frame extends Frame { private Button ok,cancel; private TextField range; public link_range_frame(String title) { super(title); ok= new Button("Ok"); cancel = new Button("Cancel"); GridBagLayout gridbag = new GridBagLayout(); this.setLayout(gridbag); Panel panel1 = new Panel(); panel1.setLayout(gridbag); Panel panel2 = new Panel(); panel2.setLayout(gridbag); Choice c_locations = new Choice(); c_locations.addItem("Moon"); c_locations.addItem("Shuttle"); c_locations.addItem("Space Station"); c_locations.addItem("LEO"); c_locations.addItem("GEO"); c_locations.addItem("Venus"); c_locations.addItem("Mars"); c_locations.addItem("Jupiter"); c_locations.addItem("Saturn"); c_locations.addItem("Uranus"); c_locations.addItem("Neptune"); c_locations.addItem("Pluto"); c_locations.addItem("Comet"); c_locations.addItem("Asteroid"); c_locations.addItem("Other"); c_locations.addItem("TMF"); c_locations.addItem("Starfire"); c_locations.addItem("Strawberry Peek"); c_locations.addItem("Mt. Lemmon"); c_locations.addItem("Goldstone"); c_locations.addItem("Mesa"); c_locations.addItem("JPL"); c_locations.select(Location_t); t_index = c_locations.getSelectedIndex(); c_locations.select(Location); r_index = c_locations.getSelectedIndex(); try {getinfo();} catch(IOException x){} range = new TextField(String.valueOf(Range),10); constrain(panel1,new Label("Distance from "),0,0,1,1); constrain(panel1,new Label(Location_t),1,0,1,1); constrain(panel1,new Label("to " + Location +" is"),2,0,1,1); constrain(panel1,range,3,0,1,1); constrain(panel1,new Label("km"),4,0,1,1); constrain(this,panel1,0,0,1,1); constrain(panel2,ok,0,1,1,1,0,0,0,10); constrain(panel2,cancel,1,1,1,1,0,10,0,0); constrain(this,panel2,0,1,1,1,20,0,0,0); this.pack(); this.show(); } public boolean action(Event e, Object arg) { if(e.target == ok) { Range = (Double.valueOf(range.getText())).doubleValue(); dispose(); return true; } else if(e.target==cancel) { dispose(); return true; } else return false; } public void getinfo() throws IOException { URL url = new URL("http://www331.jpl.nasa.gov/group1/focas_birju/range.txt"); URLConnection connection = url.openConnection(); connection.connect(); DataInputStream in = new DataInputStream(connection.getInputStream()); int i; if(t_index>14) t_index = 15; if(r_index>14) r_index = 15; for(i = 0;i=0) && (temp <4)) { dtype = new Label("PMT"); } else if((temp >=4)&&(temp <12)) { dtype = new Label("APD"); } else dtype = new Label("PD"); Panel panel1 = new Panel(); Panel panel2 = new Panel(); Panel panel3 = new Panel(); Panel panel6 = new Panel(); panel1.setLayout(gridbag); panel2.setLayout(gridbag); panel3.setLayout(gridbag); panel4.setLayout(gridbag); panel5.setLayout(gridbag); panel6.setLayout(gridbag); this.setLayout(gridbag); constrain(panel1,new Label("Name: "),0,0,1,1); constrain(panel1,detector,1,0,1,1); label2 = new Label("Detector Type"); label2.setFont(new Font("Helvetica",Font.BOLD,14)); constrain(panel2,label2,0,0,1,1,GridBagConstraints.NONE,GridBagConstraints.CENTER,0.0,0.0,0,0,0,0); constrain(panel2,dtype,0,1,1,1,GridBagConstraints.NONE,GridBagConstraints.CENTER,0.0,0.0,0,0,0,0); constrain(panel3,new Label("Quantum Efficiency"),0,0,1,1); constrain(panel3,quantum,1,0,1,1); constrain(panel3,new Label("Bulk Dark Current (pA)"),0,1,1,1); constrain(panel3,bulkdark,1,1,1,1); constrain(panel3,new Label("Surface Dark Current (pA)"),0,2,1,1); constrain(panel3,surfacedark,1,2,1,1); constrain(panel3,new Label("10 - 90% Rise/Fall Time (ns)"),0,3,1,1); constrain(panel3,risefall,1,3,1,1); constrain(panel3,new Label("Detector Diameter (mm)"),0,4,1,1); constrain(panel3,diameter,1,4,1,1); constrain(panel3,new Label("Detector Capacitance (F)"),0,5,1,1); constrain(panel3,capacitance,1,5,1,1); constrain(panel4,new Label("Maximum Recommended Gain"),0,0,1,1); constrain(panel4,gain,1,0,1,1); constrain(panel5,new Label("Ionization Rate Ratio"),0,0,1,1); constrain(panel5,ionization,1,0,1,1); constrain(panel6,ok,0,0,1,1,0,10,0,0); constrain(panel6,cancel,1,0,1,1,0,0,0,10); constrain(this,panel1,0,0,1,1); constrain(this,panel2,0,1,1,1,0,0,20,0); constrain(this,panel3,0,2,1,1); if ((temp >=0) && (temp <4)) { constrain(this,panel4,0,3,1,1); } else if((temp >=4)&&(temp <12)) { constrain(this,panel4,0,3,1,1); constrain(this,panel5,0,4,1,1); } else dtype = new Label("PD"); constrain(this,panel6,0,5,1,1,15,0,0,0); this.pack(); this.show(); } public boolean action(Event e,Object arg) { if(e.target == detector) { try{getinfo();} catch(IOException eez){} int temp = detector.getSelectedIndex(); if ((temp >=0) && (temp <4)) { dtype.setText("PMT"); detectorTYPE = "PMT"; this.remove(panel4); this.remove(panel5); constrain(this,panel4,0,3,1,1); this.pack(); } else if((temp >=4)&&(temp <12)) { dtype.setText("APD"); detectorTYPE = "APD"; constrain(this,panel4,0,3,1,1); constrain(this,panel5,0,4,1,1); this.pack(); } else { dtype.setText("PD"); detectorTYPE = "PD"; this.remove(panel4); this.remove(panel5); this.pack(); } return true; } else if(e.target == ok) { update(); dispose(); return true; } else if (e.target==cancel) { dispose(); return true; } else return false; } public void update() { Detector = detector.getSelectedItem(); t_detector.setText(Detector); t_detector.setAlignment(t_detector.CENTER); Quantum = (Double.valueOf(quantum.getText())).doubleValue(); BulkDark = (Double.valueOf(bulkdark.getText())).doubleValue(); SurfaceDark = (Double.valueOf(surfacedark.getText())).doubleValue(); RiseFall = (Double.valueOf(risefall.getText())).doubleValue(); DetectorDiameter=(Double.valueOf(diameter.getText())).doubleValue(); Capacitance=(Double.valueOf(capacitance.getText())).doubleValue(); Gain=(Double.valueOf(gain.getText())).doubleValue(); Ionization=(Double.valueOf(ionization.getText())).doubleValue(); detectorTYPE = dtype.getText(); } public void getinfo() throws IOException { String filename = new String(detector.getSelectedItem()); filename = filename.replace('(','_'); filename = filename.replace(' ','_'); filename = filename.replace(')','_'); filename = filename.replace('-','_'); URL url = new URL("http://www331.jpl.nasa.gov/group1/focas_birju/detectors/"+filename); URLConnection connection = url.openConnection(); connection.connect(); DataInputStream in = new DataInputStream(connection.getInputStream()); detectorTYPE = in.readLine(); ionization.setText(in.readLine()); gain.setText(in.readLine()); bulkdark.setText(in.readLine()); surfacedark.setText(in.readLine()); risefall.setText(in.readLine()); diameter.setText(in.readLine()); capacitance.setText(in.readLine()); filename = filename + "QE"; System.out.println(filename); URL url2 = new URL("http://www331.jpl.nasa.gov/group1/focas_birju/detectors/QE/"+filename); URLConnection connection2 = url2.openConnection(); connection2.connect(); DataInputStream in2 = new DataInputStream(connection2.getInputStream()); double QE,QE2,ans; int top=0,bot=75,i; if((LaserWavelength*1.0e9)>=2000) { top=bot; for(i=0;i0) { c.insets = new Insets(top,left,bottom,right); } ((GridBagLayout)container.getLayout()).setConstraints(component,c); container.add(component); } public void constrain(Container container, Component component,int grid_x,int grid_y,int grid_width, int grid_height) { constrain(container,component,grid_x,grid_y,grid_width,grid_height,GridBagConstraints.NONE,GridBagConstraints.NORTHWEST,0.0,0.0,0,0,0,0); } public void constrain(Container container, Component component,int grid_x,int grid_y,int grid_width, int grid_height,int top,int left,int bottom, int right) { constrain(container,component,grid_x,grid_y,grid_width,grid_height,GridBagConstraints.NONE, GridBagConstraints.CENTER,0.0,0.0,top,left,bottom,right); } }