# NEed Help, Aqi calculator change javascript to JAva Gui.?

• February 13th, 2013, 10:25 AM
Bli
NEed Help, Aqi calculator change javascript to JAva Gui.?
i need help for interpreting this javascript to javacode. this script is about AQI calculator.<br> the code in java srcript, does someone can help me immediately. here is the link and so the code too :,br>
AQI Calculator: Concentration to AQI
Code :

```<script type="text/javascript"> function Linear(AQIhigh, AQIlow, Conchigh, Conclow, Concentration) { var linear; var Conc=parseFloat(Concentration); var a; a=((Conc-Conclow)/(Conchigh-Conclow))*(AQIhigh-AQIlow)+AQIlow; linear=Math.round(a); return linear; }   function AQIPM25(Concentration) { var Conc=parseFloat(Concentration); var c; var AQI; c=(Math.floor(10*Conc))/10; if (c>=0 && c<15.5) { AQI=Linear(50,0,15.4,0,c); } else if (c>=15.5 && c<35.5) { AQI=Linear(100,51,35.4,15.5,c); } else if (c>=35.5 && c<65.5) { AQI=Linear(150,101,65.4,35.5,c); } else if (c>=65.5 && c<150.5) { AQI=Linear(200,151,150.4,65.5,c); } else if (c>=150.5 && c<250.5) { AQI=Linear(300,201,250.4,150.5,c); } else if (c>=250.5 && c<350.5) { AQI=Linear(400,301,350.4,250.5,c); } else if (c>=350.5 && c<500.5) { AQI=Linear(500,401,500.4,350.5,c); } else { AQI="Out of Range"; } return AQI; } //line63 function AQIPM10(Concentration) { var Conc=parseFloat(Concentration); var c; var AQI; c=Math.floor(Conc); if (c>=0 && c<55) { AQI=Linear(50,0,54,0,c); } else if (c>=55 && c<155) { AQI=Linear(100,51,154,55,c); } else if (c>=155 && c<255) { AQI=Linear(150,101,254,155,c); } else if (c>=255 && c<355) { AQI=Linear(200,151,354,255,c); } else if (c>=355 && c<425) { AQI=Linear(300,201,424,355,c); } else if (c>=425 && c<505) { AQI=Linear(400,301,504,425,c); } else if (c>=505 && c<605) { AQI=Linear(500,401,604,505,c); } else { AQI="Out of Range"; } return AQI; } //line104 function AQICO(Concentration) { var Conc=parseFloat(Concentration); var c; var AQI; c=(Math.floor(10*Conc))/10; if (c>=0 && c<4.5) { AQI=Linear(50,0,4.4,0,c); } else if (c>=4.5 && c<9.5) { AQI=Linear(100,51,9.4,4.5,c); } else if (c>=9.5 && c<12.5) { AQI=Linear(150,101,12.4,9.5,c); } else if (c>=12.5 && c<15.5) { AQI=Linear(200,151,15.4,12.5,c); } else if (c>=15.5 && c<30.5) { AQI=Linear(300,201,30.4,15.5,c); } else if (c>=30.5 && c<40.5) { AQI=Linear(400,301,40.4,30.5,c); } else if (c>=40.5 && c<50.5) { AQI=Linear(500,401,50.4,40.5,c); } else { AQI="Out of Range"; } return AQI; } //line145 function AQISO21hr(Concentration) { var Conc=parseFloat(Concentration); var c; var AQI; c=Math.floor(Conc); if (c>=0 && c<36) { AQI=Linear(50,0,35,0,c); } else if (c>=36 && c<76) { AQI=Linear(100,51,75,36,c); } else if (c>=76 && c<186) { AQI=Linear(150,101,185,76,c); } else if (c>=186 && c<=304) { AQI=Linear(200,151,304,186,c); } else if (c>=304 && c<=604) { AQI="SO2message"; } else { AQI="Out of Range"; } return AQI; } function AQISO224hr(Concentration) { var Conc=parseFloat(Concentration); var c; var AQI; c=Math.floor(Conc); if (c>=0 && c<=304) { AQI="SO2message"; }   else if (c>=304 && c<605) { AQI=Linear(300,201,604,305,c); } else if (c>=605 && c<805) { AQI=Linear(400,301,804,605,c); } else if (c>=805 && c<=1004) { AQI=Linear(500,401,1004,805,c); } else { AQI="Out of Range"; } return AQI; } //line186 function AQIOzone8hr(Concentration) { var Conc=parseFloat(Concentration); var c; var AQI; c=(Math.floor(Conc))/1000;   if (c>=0 && c<.060) { AQI=Linear(50,0,0.059,0,c); } else if (c>=.060 && c<.076) { AQI=Linear(100,51,.075,.060,c); } else if (c>=.076 && c<.096) { AQI=Linear(150,101,.095,.076,c); } else if (c>=.096 && c<.116) { AQI=Linear(200,151,.115,.096,c); } else if (c>=.116 && c<.375) { AQI=Linear(300,201,.374,.116,c); } else if (c>=.375 && c<.605) { AQI="O3message"; } else { AQI="Out of Range"; } return AQI; } //line219   function AQIOzone1hr(Concentration) { var Conc=parseFloat(Concentration); var c; var AQI; c=(Math.floor(Conc))/1000; if (c>=.125 && c<.165) { AQI=Linear(150,101,.164,.125,c); } else if (c>=.165 && c<.205) { AQI=Linear(200,151,.204,.165,c); } else if (c>=.205 && c<.405) { AQI=Linear(300,201,.404,.205,c); } else if (c>=.405 && c<.505) { AQI=Linear(400,301,.504,.405,c); } else if (c>=.505 && c<.605) { AQI=Linear(500,401,.604,.505,c); } else { AQI="Out of Range"; } return AQI; }   function AQINO2(Concentration) { var Conc=parseFloat(Concentration); var c; var AQI; c=(Math.floor(Conc))/1000; if (c>=0 && c<.054) { AQI=Linear(50,0,.053,0,c); } else if (c>=.054 && c<.101) { AQI=Linear(100,51,.100,.054,c); } else if (c>=.101 && c<.361) { AQI=Linear(150,101,.360,.101,c); } else if (c>=.361 && c<.650) { AQI=Linear(200,151,.649,.361,c); } else if (c>=.650 && c<1.250) { AQI=Linear(300,201,1.249,.650,c); } else if (c>=1.250 && c<1.650) { AQI=Linear(400,301,1.649,1.250,c); } else if (c>=1.650 && c<=2.049) { AQI=Linear(500,401,2.049,1.650,c); } else { AQI="Out of Range"; } return AQI; }   function AQICategory(AQIndex) { var AQI=parseFloat(AQIndex) var AQICategory; if (AQI<=50) { AQICategory="Good"; } else if (AQI>50 && AQI<=100) { AQICategory="Moderate"; } else if (AQI>100 && AQI<=150) { AQICategory="Unhealthy for Sensitive Groups"; } else if (AQI>150 && AQI<=200) { AQICategory="Unhealthy"; } else if (AQI>200 && AQI<=300) { AQICategory="Very Unhealthy"; } else if (AQI>300 && AQI<=400) { AQICategory="Hazardous"; } else if (AQI>400 && AQI<=500) { AQICategory="Hazardous"; } else { AQICategory="Out of Range"; } return AQICategory; } //316   function ClearColor() {   document.form.outputbox2.style.backgroundColor="white";   }   function UnitDetermin(form) { //var form   document.form.txtunit.style.textAlign="center"; document.form.outputbox2.style.backgroundColor="white";   document.form.inputbox.value=""; document.form.outputbox1.value=""; document.form.outputbox2.value=""; document.form.TextSensitive.value=""; document.form.HealthEffects.value=""; document.form.Cautionary.value="";   if (document.form.pollutant.selectedIndex == '1' || document.form.pollutant.selectedIndex == '2') { document.form.txtunit.value="ug/m3"; } else if (document.form.pollutant.selectedIndex == '3') { document.form.txtunit.value="ppm"; } else if (document.form.pollutant.selectedIndex == '4' || document.form.pollutant.selectedIndex == '5' || document.form.pollutant.selectedIndex == '6' || form.pollutant.selectedIndex == '7' || form.pollutant.selectedIndex == '8') { document.form.txtunit.value="ppb"; } return true; }   function AQICalc(form) { var b;   document.form.inputbox.style.textAlign="center"; document.form.inputbox.style.backgroundColor="white";   var f; f=document.form.inputbox.value f=f.replace(/\,/,'');   if (document.form.pollutant.selectedIndex == '0') { alert("You have not selected a pollutant."); } if (document.form.pollutant.selectedIndex == '1') { b=AQIPM25(f); } else if (document.form.pollutant.selectedIndex == '2') { b=AQIPM10(f); } else if (document.form.pollutant.selectedIndex == '3') { b=AQICO(f); } else if (document.form.pollutant.selectedIndex == '4') { b=AQISO21hr(f); } else if (document.form.pollutant.selectedIndex == '5') { b=AQISO224hr(f); } else if (document.form.pollutant.selectedIndex == '6') { b=AQIOzone8hr(f); } else if (document.form.pollutant.selectedIndex == '7') { b=AQIOzone1hr(f); } else if (document.form.pollutant.selectedIndex == '8') { b=AQINO2(f); } if (b == "Out of Range") { alert("The concentration number you've entered is out of range for this pollutant."); document.form.inputbox.value=" "; document.form.outputbox1.value=" "; document.form.outputbox2.value=" "; document.form.TextSensitive.value=""; document.form.HealthEffects.value=""; document.form.Cautionary.value=""; }   else if (b == "SO2message") { alert("1-hr SO2 values do not define higher AQI values ( >= 201 ). AQI values of 201 or greater are calculated with 24-hour SO2 concentrations."); document.form.inputbox.value=" "; document.form.outputbox1.value=" "; document.form.outputbox2.value=" "; document.form.TextSensitive.value=""; document.form.HealthEffects.value=""; document.form.Cautionary.value=""; }     else if (b == "O3message") { alert("8-hour ozone values do not define higher AQI values (>=301). AQI values of 301 or greater are calculated with 1-hour ozone concentrations."); document.form.inputbox.value==""; document.form.outputbox1.value==""; document.form.outputbox2.value==""; document.form.TextSensitive.value==""; document.form.HealthEffects.value==""; document.form.Cautionary.value==""; }   else { document.form.outputbox1.value=b; document.form.outputbox2.value=AQICategory(b); } document.form.outputbox1.style.textAlign="center"; document.form.outputbox2.style.textAlign="center"; document.form.TextSensitive.style.textAlign="center"; document.form.HealthEffects.style.textAlign="center"; document.form.Cautionary.style.textAlign="center";   if (document.form.outputbox2.value == 'Good') { document.form.outputbox2.style.backgroundColor="#00e000"; document.form.outputbox2.style.color="black"; document.form.HealthEffects.value="None"; document.form.Cautionary.value="None"; if (document.form.pollutant.selectedIndex == '1') { document.form.TextSensitive.value="People with respiratory or heart disease, the elderly and children are the groups most at risk."; } else if (document.form.pollutant.selectedIndex == '2') { document.form.TextSensitive.value="People with respiratory disease are the group most at risk."; } else if (document.form.pollutant.selectedIndex == '3') { document.form.TextSensitive.value="People with heart disease are the group most at risk."; } else if (document.form.pollutant.selectedIndex == '4' || form.pollutant.selectedIndex == '5') { document.form.TextSensitive.value="People with asthma are the group most at risk."; } else if (document.form.pollutant.selectedIndex == '6' || form.pollutant.selectedIndex == '7') { document.form.TextSensitive.value="Children and people with asthma are the groups most at risk."; } else if (document.form.pollutant.selectedIndex == '8') { document.form.TextSensitive.value="People with asthma or other respiratory diseases, the elderly, and children are the groups most at risk."; } } else if (document.form.outputbox2.value == 'Moderate') { document.form.outputbox2.style.backgroundColor="#ffff00"; document.form.outputbox2.style.color="black"; if (document.form.pollutant.selectedIndex == '1') { document.form.TextSensitive.value="People with respiratory or heart disease, the elderly and children are the groups most at risk."; document.form.HealthEffects.value="None"; document.form.Cautionary.value="None"; } else if (document.form.pollutant.selectedIndex == '2') { document.form.TextSensitive.value="People with respiratory disease are the group most at risk."; document.form.HealthEffects.value="None"; document.form.Cautionary.value="None"; } else if (document.form.pollutant.selectedIndex == '3') { document.form.TextSensitive.value="People with heart disease are the group most at risk."; document.form.HealthEffects.value="None"; document.form.Cautionary.value="None"; } else if (document.form.pollutant.selectedIndex == '4' || form.pollutant.selectedIndex == '5') { document.form.TextSensitive.value="People with asthma are the group most at risk."; document.form.HealthEffects.value="None"; document.form.Cautionary.value="None"; } else if (document.form.pollutant.selectedIndex == '6' || form.pollutant.selectedIndex == '7') { document.form.TextSensitive.value="Children and people with asthma are the groups most at risk."; if (document.form.pollutant.selectedIndex == '6') { document.form.HealthEffects.value="Unusually sensitive individuals may experience respiratory symptoms."; document.form.Cautionary.value="Unusually sensitive people should consider limiting prolonged outdoor exertion."; } } else if (document.form.pollutant.selectedIndex == '8') { document.form.TextSensitive.value="People with asthma or other respiratory diseases, the elderly, and children are the groups most at risk."; document.form.HealthEffects.value="Unusually sensitive individuals may experience respiratory symptoms."; document.form.Cautionary.value="Unusually sensitive people should consider reducing prolonged or heavy outdoor exertion."; } } else if (document.form.outputbox2.value == 'Unhealthy for Sensitive Groups') { document.form.outputbox2.style.backgroundColor="#ff7600"; document.form.outputbox2.style.color="black"; if (document.form.pollutant.selectedIndex == '1') { document.form.TextSensitive.value="People with respiratory or heart disease, the elderly and children are the groups most at risk."; document.form.HealthEffects.value="Increasing likelihood of respiratory symptoms in sensitive individuals, aggravation of heart or lung disease and premature mortality in persons with cardiopulmonary disease and the elderly."; document.form.Cautionary.value="People with respiratory or heart disease, the elderly and children should limit prolonged exertion."; } else if (document.form.pollutant.selectedIndex == '2') { document.form.TextSensitive.value="People with respiratory disease are the group most at risk."; document.form.HealthEffects.value="Increasing likelihood of respiratory symptoms and aggravation of lung disease, such as asthma."; document.form.Cautionary.value="People with respiratory disease, such as asthma, should limit outdoor exertion."; } else if (document.form.pollutant.selectedIndex == '3') { document.form.TextSensitive.value="People with heart disease are the group most at risk."; document.form.HealthEffects.value="Increasing likelihood of reduced exercise tolerance due to increased cardiovascular symptoms, such as chest pain, in people with cardiovascular disease."; document.form.Cautionary.value="People with cardiovascular disease, such as angina, should limit heavy exertion and avoid sources of CO, such as heavy traffic."; } else if (document.form.pollutant.selectedIndex == '4' || form.pollutant.selectedIndex == '5') { document.form.TextSensitive.value="People with asthma are the group most at risk."; document.form.HealthEffects.value="Increasing likelihood of respiratory symptoms, such as chest tightness and breathing discomfort, in people with asthma."; document.form.Cautionary.value="People with asthma should consider limiting outdoor exertion."; } else if (document.form.pollutant.selectedIndex == '6' || form.pollutant.selectedIndex == '7') { document.form.HealthEffects.value="Increasing likelihood of respiratory symptoms and breathing discomfort in active children and adults and people with respiratory disease, such as asthma."; document.form.TextSensitive.value="Children and people with asthma are the groups most at risk."; if (document.form.pollutant.selectedIndex == '6') { document.form.Cautionary.value="Active children and adults, and people with respiratory disease, such as asthma, should limit prolonged outdoor exertion."; } else if (document.form.pollutant.selectedIndex == '7') { document.form.Cautionary.value="Active children and adults, and people with respiratory disease, such as asthma, should limit heavy outdoor exertion."; } } else if (document.form.pollutant.selectedIndex == '8') { document.form.TextSensitive.value="People with asthma or other respiratory diseases, the elderly, and children are the groups most at risk."; document.form.HealthEffects.value="Increasing likelihood of respiratory symptoms and breathing discomfort in active children, the elderly, and people with lung disease, such as asthma."; document.form.Cautionary.value="Active children, the elderly, and people with lung disease, such as asthma, should reduce prolonged or heavy outdoor exertion."; } } else if (document.form.outputbox2.value == 'Unhealthy') { document.form.outputbox2.style.backgroundColor="#ff0000"; document.form.outputbox2.style.color="black"; if (document.form.pollutant.selectedIndex == '1') { document.form.TextSensitive.value="People with respiratory or heart disease, the elderly and children are the groups most at risk."; document.form.HealthEffects.value="Increased aggravation of heart or lung disease and premature mortality in persons with cardiopulmonary disease and the elderly; increased respiratory effects in general population."; document.form.Cautionary.value="People with respiratory or heart disease, the elderly and children should avoid prolonged exertion; everyone else should limit prolonged exertion."; } else if (document.form.pollutant.selectedIndex == '2') { document.form.TextSensitive.value="People with respiratory disease are the group most at risk."; document.form.HealthEffects.value="Increased respiratory symptoms and aggravation of lung disease, such as asthma; possible respiratory effects in general population."; document.form.Cautionary.value=" "; } else if (document.form.pollutant.selectedIndex == '3') { document.form.TextSensitive.value="People with heart disease are the group most at risk."; document.form.HealthEffects.value="Reduced exercise tolerance due to increased cardiovascular symptoms, such as chest pain, in people with cardiovascular disease."; document.form.Cautionary.value="People with cardiovascular disease, such as angina, should limit moderate exertion and avoid sources of CO, such as heavy traffic."; } else if (document.form.pollutant.selectedIndex == '4' || form.pollutant.selectedIndex == '5') { document.form.TextSensitive.value="People with asthma are the group most at risk."; document.form.HealthEffects.value="Increased respiratory symptoms, such as chest tightness and wheezing in people with asthma; possible aggravation of heart or lung disease."; document.form.Cautionary.value="Children, asthmatics, and people with heart or lung disease should limit outdoor exertion."; } else if (document.form.pollutant.selectedIndex == '6' || form.pollutant.selectedIndex == '7') { document.form.TextSensitive.value="Children and people with asthma are the groups most at risk."; document.form.HealthEffects.value="Greater likelihood of respiratory symptoms and breathing difficulty in active children and adults and people with respiratory disease, such as asthma; possible respiratory effects in general population."; if (document.form.pollutant.selectedIndex == '6') { document.form.Cautionary.value="Active children and adults, and people with respiratory disease, such as asthma, should avoid prolonged outdoor exertion; everyone else, especially children, should limit prolonged outdoor exertion."; } else if (document.form.pollutant.selectedIndex == '7') { document.form.Cautionary.value="Active children and adults, and people with respiratory disease, such as asthma, should avoid heavy outdoor exertion; everyone else, especially children, should limit heavy outdoor exertion."; } } else if (document.form.pollutant.selectedIndex == '8') { document.form.TextSensitive.value="People with asthma or other respiratory diseases, the elderly, and children are the groups most at risk."; document.form.HealthEffects.value="Greater likelihood of respiratory symptoms in active children, the elderly, and people with lung disease, such as asthma; possible respiratory effects in general population."; document.form.Cautionary.value="Active children, the elderly, and people with lung disease, such as asthma, should avoid prolonged or heavy outdoor exertion; everyone else, expecially children, should reduce prolonged or heavy outdoor exertion."; } } else if (document.form.outputbox2.value == 'Very Unhealthy') { document.form.outputbox2.style.backgroundColor="#990049"; document.form.outputbox2.style.color="#ffffff"; if (document.form.pollutant.selectedIndex == '1') { document.form.TextSensitive.value="People with respiratory or heart disease, the elderly and children are the groups most at risk."; document.form.HealthEffects.value="Significant aggravation of heart or lung disease and premature mortality in persons with cardiopulmonary disease and the elderly; significant increase in respiratory effects in general population."; document.form.Cautionary.value="People with respiratory or heart disease, the elderly and children should avoid any outdoor activity; everyone else should avoid prolonged exertion."; } else if (document.form.pollutant.selectedIndex == '2') { document.form.TextSensitive.value="People with respiratory disease are the group most at risk."; document.form.HealthEffects.value="Significant increase in respiratory symptoms and aggravation of lung disease, such as asthma; increasing likelihood of respiratory effects in general population."; document.form.Cautionary.value="People with respiratory disease, such as asthma, should avoid any outdoor activity; everyone else, especially the elderly and children, should limit outdoor exertion."; } else if (document.form.pollutant.selectedIndex == '3') { document.form.TextSensitive.value="People with heart disease are the group most at risk."; document.form.HealthEffects.value="Significant aggravation of cardiovascular symptoms, such as chest pain, in people with cardiovascular disease."; document.form.Cautionary.value="People with cardiovascular disease, such as angina, should avoid exertion and sources of CO, such as heavy traffic."; } else if (document.form.pollutant.selectedIndex == '4' || form.pollutant.selectedIndex == '5') { document.form.TextSensitive.value="People with asthma are the group most at risk."; document.form.HealthEffects.value="Significant increase in respiratory symptoms, such as wheezing and shortness of breath, in people with asthma; aggravation of heart or lung disease."; document.form.Cautionary.value="Children, asthmatics, and people with heart or lung disease should avoid outdoor exertion; everyone else should limit outdoor exertion."; } else if (document.form.pollutant.selectedIndex == '6' || document.form.pollutant.selectedIndex == '7') { document.form.TextSensitive.value="Children and people with asthma are the groups most at risk."; document.form.HealthEffects.value="Increasingly severe symptoms and impaired breathing likely in active children and adults and people with respiratory disease, such as asthma; increasing likelihood of respiratory effects in general population."; document.form.Cautionary.value="Active children and adults, and people with respiratory disease, such as asthma, should avoid all outdoor exertion; everyone else, especially children, should limit outdoor exertion."; } else if (document.form.pollutant.selectedIndex == '8') { document.form.TextSensitive.value="People with asthma or other respiratory diseases, the elderly, and children are the groups most at risk."; document.form.HealthEffects.value="Increasingly severe symptoms and impaired breathing likely in active children, the elderly, and people with lung disease, such as asthma; increasing likelihood of respiratory effects in general population."; document.form.Cautionary.value="Active children, the elderly, and people with lung disease, such as asthma, should avoid all outdoor exertion; everyone else, especially children, should avoid prolonged or heavy outdoor exertion."; } } else if (document.form.outputbox2.value == 'Hazardous') { document.form.outputbox2.style.backgroundColor="#7E0023"; document.form.outputbox2.style.color="#ffffff"; if (document.form.pollutant.selectedIndex == '1') { document.form.TextSensitive.value="People with respiratory or heart disease, the elderly and children are the groups most at risk."; document.form.HealthEffects.value="Serious aggravation of heart or lung disease and premature mortality in persons with cardiopulmonary disease and the elderly; serious risk of respiratory effects in general population."; document.form.Cautionary.value="Everyone should avoid any outdoor exertion; people with respiratory or heart disease, the elderly and children should remain indoors."; } else if (document.form.pollutant.selectedIndex == '2') { document.form.TextSensitive.value="People with respiratory disease are the group most at risk."; document.form.HealthEffects.value="Serious risk of respiratory symptoms and aggravation of lung disease, such as asthma; respiratory effects likely in general population."; document.form.Cautionary.value="Everyone should avoid any outdoor exertion; people with respiratory disease, such as asthma, should remain indoors."; } else if (document.form.pollutant.selectedIndex == '3') { document.form.TextSensitive.value="People with heart disease are the group most at risk."; document.form.HealthEffects.value="Serious aggravation of cardiovascular symptoms, such as chest pain, in people with cardiovascular disease; impairment of strenuous activities in general population."; document.form.Cautionary.value="People with cardiovascular disease, such as angina, should avoid exertion and sources of CO, such as heavy traffic; everyone else should limit heavy exertion."; } else if (document.form.pollutant.selectedIndex == '4' || form.pollutant.selectedIndex == '5') { document.form.TextSensitive.value="People with asthma are the group most at risk."; document.form.HealthEffects.value="Severe respiratory symptoms, such as wheezing and shortness of breath, in people with asthma; increased aggravation of heart or lung disease; possible respiratory effects in general population."; document.form.Cautionary.value="Children, asthmatics, and people with heart or lung disease should remain indoors; everyone else should avoid outdoor exertion."; } else if (document.form.pollutant.selectedIndex == '6' || document.form.pollutant.selectedIndex == '7') { document.form.TextSensitive.value="Children and people with asthma are the groups most at risk."; document.form.HealthEffects.value="Severe respiratory effects and impaired breathing likely in active children and adults and people with respiratory disease, such as asthma; increasingly severe respiratory effects likely in general population."; document.form.Cautionary.value="Everyone should avoid all outdoor exertion."; } else if (document.form.pollutant.selectedIndex == '8') { document.form.TextSensitive.value="People with asthma or other respiratory diseases, the elderly, and children are the groups most at risk."; document.form.HealthEffects.value="Severe respiratory effects and impaired breathing likely in active children, the elderly, and people with lung disease, such as asthma; increasingly severe respiratory effects likely in general population."; document.form.Cautionary.value="Children, the elderly, and people with lung disease, such as asthma, should remain indoors; everyone else, especially children, should avoid outdoor exertion."; } } else { document.form.outputbox2.style.backgroundColor="#ffffff"; document.form.outputbox2.style.color="black"; document.form.TextSensitive.value=""; document.form.HealthEffects.value=""; document.form.Cautionary.value=""; }   return true; }     </script>```
• February 13th, 2013, 11:00 AM
Norm
Re: NEed Help, Aqi calculator change javascript to JAva Gui.?
What have you tried? Please post your current code with questions about where you are having problems.
• February 13th, 2013, 11:27 AM
Bli
Re: NEed Help, Aqi calculator change javascript to JAva Gui.?
I am actually working on right now, preparing components and try to understand.
• February 14th, 2013, 12:10 PM
Bli
Re: NEed Help, Aqi calculator change javascript to JAva Gui.?
hello there, i can only make this. would you show me.how to display the item by choosing the index in if else. the displayed text field will appear units each pollutant, like the Aqi Calc in the link above.

Code :

```package explorer;   import java.awt.*; import java.awt.event.*; import javax.swing.*;   class Nilai implements ActionListener { public static void main (String[]args){ javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { Nilai nm = new Nilai(); nm.show(); } }); }   public JFrame frame; public JComboBox cmbPol; public JLabel labelPol,labelUnit,labelInput,labelAqi,labelKategori;   public JTextField textUnit,textInput,textAqi,TextKategori;   public JButton buttonCal,buttonOK,buttonCancel,buttonKeluar; String[] listpolutan ={"PM2.5 - Particulate &lt;2.5 microns (24hr avg)", "PM10 - Particulate &lt;10 microns (24hr avg)", "CO - Carbon Monoxide (8hr avg)","SO2 - Sulfur Dioxide (1hr avg)", "SO2 - Sulfur Dioxide (24hr avg)","O3 - Ozone (8hr avg)", "O3 - Ozone (1hr avg)","NO2 - Nitrogen Dioxide (1hr avg)"};   public Nilai(){   labelPol = new JLabel("Polutan"); labelPol.setLocation(0, 10); labelPol.setSize(labelPol.getPreferredSize());   labelUnit = new JLabel("Unit"); labelUnit.setLocation(0, 40); labelUnit.setSize(labelPol.getPreferredSize());   labelInput = new JLabel("Input"); labelInput.setLocation(0, 60); labelInput.setSize(labelInput.getPreferredSize());   labelAqi = new JLabel("AQI"); labelAqi.setLocation(0, 80); labelAqi.setSize(labelAqi.getPreferredSize());   labelKategori = new JLabel("Kategori"); labelKategori.setLocation(0, 100); labelKategori.setSize(labelKategori.getPreferredSize());       cmbPol = new JComboBox(listpolutan); cmbPol.setSelectedIndex(0); cmbPol.setLocation(80, 10); cmbPol.setSize(cmbPol.getPreferredSize()); cmbPol.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) {   textAqi.setText("You Selected : " + ((JComboBox)e.getSource()).getSelectedItem()); } });         textUnit = new JTextField(10); textUnit.setLocation(80, 40); textUnit.setSize(textUnit.getPreferredSize());   textInput = new JTextField(10); textInput.setLocation(80, 60); textInput.setSize(textInput.getPreferredSize());   textAqi = new JTextField(10); textAqi.setLocation(80, 80); textAqi.setSize(textAqi.getPreferredSize());   TextKategori = new JTextField(10); TextKategori.setLocation(80, 100); TextKategori.setSize(TextKategori.getPreferredSize());     buttonOK = new JButton("OK"); buttonOK.setLocation(200, 40); buttonOK.setSize(80,20); buttonOK.addActionListener(this);     buttonCancel = new JButton("Reset"); buttonCancel.setLocation(200, 70); buttonCancel.setSize(80,20); buttonCancel.addActionListener(this);   buttonCal = new JButton("Calc"); buttonCal.setLocation(200, 100); buttonCal.setSize(80,20); buttonCal.addActionListener(this);   buttonKeluar = new JButton("Out"); buttonKeluar.setLocation(285, 40); buttonKeluar.setSize(80,40); buttonKeluar.addActionListener(this);   }       public void show(){ frame = new JFrame ("AQI Calc"); frame.setLayout(null); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);   frame.getContentPane().add(labelPol); frame.getContentPane().add(labelUnit); frame.getContentPane().add(labelInput); frame.getContentPane().add(labelAqi); frame.getContentPane().add(labelKategori); frame.getContentPane().add(buttonOK);   frame.getContentPane().add(buttonCancel); frame.getContentPane().add(buttonCal); frame.getContentPane().add(buttonKeluar);   frame.getContentPane().add(cmbPol); frame.getContentPane().add(textUnit); frame.getContentPane().add(textInput); frame.getContentPane().add(textAqi); frame.getContentPane().add(TextKategori);   frame.setBounds(0, 0, 400, 300); frame.setLocationRelativeTo(null); frame.setVisible(true); }       @Override public void actionPerformed(ActionEvent e) { throw new UnsupportedOperationException("Not supported yet."); } }```

Attachment 1780
• February 14th, 2013, 03:18 PM
Bli
Re: NEed Help, Aqi calculator change javascript to JAva Gui.?
hello there,mr Norm. i can only do this. would you showme how to implements getSelectedindex in ifelse condition in order appear in the textfield(textUnit).
here is my code:
Code :

```package explorer;   import java.awt.*; import java.awt.event.*; import javax.swing.*;   class Nilai implements ActionListener { public static void main (String[]args){ javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { Nilai nm = new Nilai(); nm.show(); } }); }   public JFrame frame; public JComboBox cmbPol; public JLabel labelPol,labelUnit,labelInput,labelAqi,labelKategori,textKet; public JTextField textUnit,textInput,textAqi,TextKategori; public JButton buttonCal,buttonOK,buttonCancel,buttonOut; String[] listpolutan ={"PM2.5 - Particulate &lt;2.5 microns (24hr avg)", "PM10 - Particulate &lt;10 microns (24hr avg)", "CO - Carbon Monoxide (8hr avg)","SO2 - Sulfur Dioxide (1hr avg)", "SO2 - Sulfur Dioxide (24hr avg)","O3 - Ozone (8hr avg)", "O3 - Ozone (1hr avg)","NO2 - Nitrogen Dioxide (1hr avg)"};   public Nilai(){   labelPol = new JLabel("Polutan"); labelPol.setLocation(0, 10); labelPol.setSize(labelPol.getPreferredSize());   labelUnit = new JLabel("Unit"); labelUnit.setLocation(0, 40); labelUnit.setSize(labelPol.getPreferredSize());   labelInput = new JLabel("Input"); labelInput.setLocation(0, 60); labelInput.setSize(labelInput.getPreferredSize());   labelAqi = new JLabel("AQI"); labelAqi.setLocation(0, 80); labelAqi.setSize(labelAqi.getPreferredSize());   labelKategori = new JLabel("Kategori"); labelKategori.setLocation(0, 100); labelKategori.setSize(labelKategori.getPreferredSize());     labelKet = new JLabel("Desc"); labelKet.setLocation(200, 140); labelKet.setSize(labelKet.getPreferredSize());     cmbPol = new JComboBox(listpolutan); cmbPol.setSelectedIndex(0);   cmbPol.setLocation(80, 10); cmbPol.setSize(cmbPol.getPreferredSize());   cmbPol.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int index = cmbPol.getSelectedIndex(); if (cmbPol.getItemAt(index) == "3"); textAqi.setText("You Selected : ");   } });   textUnit = new JTextField(10); textUnit.setLocation(80, 40); textUnit.setSize(textUnit.getPreferredSize());   textInput = new JTextField(10); textInput.setLocation(80, 60); textInput.setSize(textInput.getPreferredSize());   textAqi = new JTextField(10); textAqi.setLocation(80, 80); textAqi.setSize(textAqi.getPreferredSize());   TextKategori = new JTextField(10); TextKategori.setLocation(80, 100); TextKategori.setSize(TextKategori.getPreferredSize());     buttonOK = new JButton("OK"); buttonOK.setLocation(200, 40); buttonOK.setSize(80,20); buttonOK.addActionListener(this);     buttonCancel = new JButton("reset"); buttonCancel.setLocation(200, 70); buttonCancel.setSize(80,20); buttonCancel.addActionListener(this);   buttonCal = new JButton("Calc"); buttonCal.setLocation(200, 100); buttonCal.setSize(80,20); buttonCal.addActionListener(this);   buttonKeluar = new JButton("Out"); buttonKeluar.setLocation(285, 40); buttonKeluar.setSize(80,40); buttonKeluar.addActionListener(this);   }       public void show(){ frame = new JFrame ("AQI Calc"); frame.setLayout(null); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);   frame.getContentPane().add(labelPol); frame.getContentPane().add(labelUnit); frame.getContentPane().add(labelInput); frame.getContentPane().add(labelAqi); frame.getContentPane().add(labelKategori); frame.getContentPane().add(labelKet); frame.getContentPane().add(buttonOK);   frame.getContentPane().add(buttonCancel); frame.getContentPane().add(buttonCal); frame.getContentPane().add(buttonKeluar);   frame.getContentPane().add(cmbPol); frame.getContentPane().add(textUnit); frame.getContentPane().add(textInput); frame.getContentPane().add(textAqi); frame.getContentPane().add(TextKategori);     frame.setBounds(0, 0, 400, 300); frame.setLocationRelativeTo(null); frame.setVisible(true); }       }```
• February 14th, 2013, 03:25 PM
Norm
Re: NEed Help, Aqi calculator change javascript to JAva Gui.?
Code :

` if (cmbPol.getItemAt(index) == "3");`
You should use the equals() method for comparing Strings, not the == operator

Can you explain your problem with the getSelectedIndex() method?

The posted code has many compiler errors. You should fix those before writing any more new code.
• February 14th, 2013, 03:50 PM
Bli
Re: NEed Help, Aqi calculator change javascript to JAva Gui.?
firstly i try to interpreting this javascript step by step.from this scriptbelow, when i click the item list of JComboBox in TextUnit will appear the Units.
Code :

```if (document.form.pollutant.selectedIndex == '1' || document.form.pollutant.selectedIndex == '2') { document.form.txtunit.value="ug/m3"; } else if (document.form.pollutant.selectedIndex == '3') { document.form.txtunit.value="ppm"; } else if (document.form.pollutant.selectedIndex == '4' || document.form.pollutant.selectedIndex == '5' || document.form.pollutant.selectedIndex == '6' || form.pollutant.selectedIndex == '7' || form.pollutant.selectedIndex == '8') { document.form.txtunit.value="ppb"; } return true; }```

im using netbeans, i apologize for the bugs.i try to use getSelectedIndex then the unit will change and not appear the item. and this my code, but it dosnt work...
Code :

```int index = cmbPol.getSelectedIndex(); String str; if (cmbPol.getItemAt(index).equals(3)){ textAqi.setText("You Selected : ");}// +   if(cmbPol.getItemAt(index).equals(2)){ textAqi.setText("sagertrh "); } else{textAqi.setText("sgg ");}```

• February 14th, 2013, 03:54 PM
Norm
Re: NEed Help, Aqi calculator change javascript to JAva Gui.?
First get the code you posted to compile without errors and execute and show a GUI window.
When that is done, THEN worry about adding more code. Don't add any more code until the current code compiles and executes without errors.
• February 14th, 2013, 04:24 PM
Bli
Re: NEed Help, Aqi calculator change javascript to JAva Gui.?
here is my code :

Code :

```import java.awt.*; import java.awt.event.*; import javax.swing.*;   class Nilai implements ActionListener { public static void main (String[]args){ javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { Nilai nm = new Nilai(); nm.show(); } }); }   public JFrame frame; public JComboBox cmbPol; public JLabel labelPol,labelUnit,labelInput,labelAqi,labelKategori,labelJudul, labelKet; public JTextField textUnit,textInput,textAqi,TextKategori; public JButton buttonCal,buttonOK,buttonCancel,buttonOut; String[] listpolutan ={"PM2.5 - Particulate &lt;2.5 microns (24hr avg)", "PM10 - Particulate &lt;10 microns (24hr avg)", "CO - Carbon Monoxide (8hr avg)","SO2 - Sulfur Dioxide (1hr avg)", "SO2 - Sulfur Dioxide (24hr avg)","O3 - Ozone (8hr avg)", "O3 - Ozone (1hr avg)","NO2 - Nitrogen Dioxide (1hr avg)"};   public Nilai(){   labelPol = new JLabel("Polutan"); labelPol.setLocation(0, 10); labelPol.setSize(labelPol.getPreferredSize());   labelUnit = new JLabel("Unit"); labelUnit.setLocation(0, 40); labelUnit.setSize(labelPol.getPreferredSize());   labelInput = new JLabel("Input"); labelInput.setLocation(0, 60); labelInput.setSize(labelInput.getPreferredSize());   labelAqi = new JLabel("AQI"); labelAqi.setLocation(0, 80); labelAqi.setSize(labelAqi.getPreferredSize());   labelKategori = new JLabel("Kategori"); labelKategori.setLocation(0, 100); labelKategori.setSize(labelKategori.getPreferredSize());       labelKet = new JLabel("Description"); labelKet.setLocation(200, 140); labelKet.setSize(labelKet.getPreferredSize());     cmbPol = new JComboBox(listpolutan); cmbPol.setSelectedIndex(0);   cmbPol.setLocation(80, 10); cmbPol.setSize(cmbPol.getPreferredSize());   cmbPol.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int index = cmbPol.getSelectedIndex(); String str; if (cmbPol.getItemAt(index).equals(3)){ textUnit.setText("mg/m3");}   if(cmbPol.getItemAt(index).equals(2)){ textUnit.setText("kg"); } else{textUnit.setText("ppb");} } });   textUnit = new JTextField(10); textUnit.setLocation(80, 40); textUnit.setSize(textUnit.getPreferredSize());   textInput = new JTextField(10); textInput.setLocation(80, 60); textInput.setSize(textInput.getPreferredSize());   textAqi = new JTextField(10); textAqi.setLocation(80, 80); textAqi.setSize(textAqi.getPreferredSize());   TextKategori = new JTextField(10); TextKategori.setLocation(80, 100); TextKategori.setSize(TextKategori.getPreferredSize());       labelKet = new JLabel(""); labelKet.setLocation(200, 160); labelKet.setSize(100,20);   buttonOK = new JButton("OK"); buttonOK.setLocation(200, 40); buttonOK.setSize(80,20); buttonOK.addActionListener(this);     buttonCancel = new JButton("reset"); buttonCancel.setLocation(200, 70); buttonCancel.setSize(80,20); buttonCancel.addActionListener(this);   buttonCal = new JButton("count"); buttonCal.setLocation(200, 100); buttonCal.setSize(80,20); buttonCal.addActionListener(this);   buttonOut = new JButton("out"); buttonOut.setLocation(285, 40); buttonOut.setSize(80,40); buttonOut.addActionListener(this);   }       public void show(){ frame = new JFrame ("AQI Calc"); frame.setLayout(null); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);   frame.getContentPane().add(labelPol); frame.getContentPane().add(labelUnit); frame.getContentPane().add(labelInput); frame.getContentPane().add(labelAqi); frame.getContentPane().add(labelKategori); frame.getContentPane().add(labelKet); frame.getContentPane().add(buttonOK);   frame.getContentPane().add(buttonCancel); frame.getContentPane().add(buttonCal); frame.getContentPane().add(buttonOut);   frame.getContentPane().add(cmbPol); frame.getContentPane().add(textUnit); frame.getContentPane().add(textInput); frame.getContentPane().add(textAqi); frame.getContentPane().add(TextKategori); frame.getContentPane().add(labelKet);   frame.setBounds(0, 0, 400, 300); frame.setLocationRelativeTo(null); frame.setVisible(true); }           }```

that was my code, and this is the results. and the units dosnt change.
Attachment 1781
• February 14th, 2013, 04:39 PM
Norm
Re: NEed Help, Aqi calculator change javascript to JAva Gui.?
The posted code still has compiler errors that need to be fixed.
• February 14th, 2013, 04:48 PM
Bli
Re: NEed Help, Aqi calculator change javascript to JAva Gui.?
its oke when i run on mylaptop. i've copied the code and check again, the problem come from the package.is my code above cannot be copiled mr.Norm? here the code again.
Code :

```package explorer;   import java.awt.*; import java.awt.event.*; import javax.swing.*;   class Nilai implements ActionListener { public static void main (String[]args){ javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { Nilai nm = new Nilai(); nm.show(); } }); }   public JFrame frame; public JComboBox cmbPol; public JLabel labelPol,labelUnit,labelInput,labelAqi,labelKategori,labelJudul, labelKet; public JTextField textUnit,textInput,textAqi,TextKategori; public JButton buttonCal,buttonOK,buttonCancel,buttonOut; String[] listpolutan ={"PM2.5 - Particulate &lt;2.5 microns (24hr avg)", "PM10 - Particulate &lt;10 microns (24hr avg)", "CO - Carbon Monoxide (8hr avg)","SO2 - Sulfur Dioxide (1hr avg)", "SO2 - Sulfur Dioxide (24hr avg)","O3 - Ozone (8hr avg)", "O3 - Ozone (1hr avg)","NO2 - Nitrogen Dioxide (1hr avg)"};   public Nilai(){   labelPol = new JLabel("Polutan"); labelPol.setLocation(0, 10); labelPol.setSize(labelPol.getPreferredSize());   labelUnit = new JLabel("Unit"); labelUnit.setLocation(0, 40); labelUnit.setSize(labelPol.getPreferredSize());   labelInput = new JLabel("Input"); labelInput.setLocation(0, 60); labelInput.setSize(labelInput.getPreferredSize());   labelAqi = new JLabel("AQI"); labelAqi.setLocation(0, 80); labelAqi.setSize(labelAqi.getPreferredSize());   labelKategori = new JLabel("Kategori"); labelKategori.setLocation(0, 100); labelKategori.setSize(labelKategori.getPreferredSize());       labelKet = new JLabel("Description"); labelKet.setLocation(200, 140); labelKet.setSize(labelKet.getPreferredSize());     cmbPol = new JComboBox(listpolutan); cmbPol.setSelectedIndex(0);   cmbPol.setLocation(80, 10); cmbPol.setSize(cmbPol.getPreferredSize());   cmbPol.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { int index = cmbPol.getSelectedIndex(); String str; if (cmbPol.getItemAt(index).equals(3)){ textUnit.setText("mg/m3");}   if(cmbPol.getItemAt(index).equals(2)){ textUnit.setText("kg"); } else{textUnit.setText("ppb");} } });   textUnit = new JTextField(10); textUnit.setLocation(80, 40); textUnit.setSize(textUnit.getPreferredSize());   textInput = new JTextField(10); textInput.setLocation(80, 60); textInput.setSize(textInput.getPreferredSize());   textAqi = new JTextField(10); textAqi.setLocation(80, 80); textAqi.setSize(textAqi.getPreferredSize());   TextKategori = new JTextField(10); TextKategori.setLocation(80, 100); TextKategori.setSize(TextKategori.getPreferredSize());       labelKet = new JLabel(""); labelKet.setLocation(200, 160); labelKet.setSize(100,20);   buttonOK = new JButton("OK"); buttonOK.setLocation(200, 40); buttonOK.setSize(80,20); buttonOK.addActionListener(this);     buttonCancel = new JButton("reset"); buttonCancel.setLocation(200, 70); buttonCancel.setSize(80,20); buttonCancel.addActionListener(this);   buttonCal = new JButton("count"); buttonCal.setLocation(200, 100); buttonCal.setSize(80,20); buttonCal.addActionListener(this);   buttonOut = new JButton("out"); buttonOut.setLocation(285, 40); buttonOut.setSize(80,40); buttonOut.addActionListener(this);   }       public void show(){ frame = new JFrame ("AQI Calc"); frame.setLayout(null); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);   frame.getContentPane().add(labelPol); frame.getContentPane().add(labelUnit); frame.getContentPane().add(labelInput); frame.getContentPane().add(labelAqi); frame.getContentPane().add(labelKategori); frame.getContentPane().add(labelKet); frame.getContentPane().add(buttonOK);   frame.getContentPane().add(buttonCancel); frame.getContentPane().add(buttonCal); frame.getContentPane().add(buttonOut);   frame.getContentPane().add(cmbPol); frame.getContentPane().add(textUnit); frame.getContentPane().add(textInput); frame.getContentPane().add(textAqi); frame.getContentPane().add(TextKategori); frame.getContentPane().add(labelKet);   frame.setBounds(0, 0, 400, 300); frame.setLocationRelativeTo(null); frame.setVisible(true); }   @Override public void actionPerformed(ActionEvent e) { throw new UnsupportedOperationException("Not supported yet."); }           }```
• February 14th, 2013, 05:00 PM
Norm
Re: NEed Help, Aqi calculator change javascript to JAva Gui.?
I see you have add the listener method now. It was not in post#9

• February 14th, 2013, 05:24 PM
Bli
Re: NEed Help, Aqi calculator change javascript to JAva Gui.?
oke. you mean about my code problem? in that code, getselectedindex doesnt work. do you have any explanation why or some example? what is the right statements for my code?
• February 14th, 2013, 05:37 PM
Norm
Re: NEed Help, Aqi calculator change javascript to JAva Gui.?
Add some println statements that print out the values that are returned by the methods so you can see what the computer sees when it executes the if statement.
• February 14th, 2013, 05:55 PM
Bli
Re: NEed Help, Aqi calculator change javascript to JAva Gui.?
would you explain more specifically sir?
• February 14th, 2013, 06:25 PM
Norm
Re: NEed Help, Aqi calculator change javascript to JAva Gui.?
Print out what is returned by these methods:
cmbPol.getSelectedIndex()
cmbPol.getItemAt(index)
• February 14th, 2013, 09:31 PM
Bli
Re: NEed Help, Aqi calculator change javascript to JAva Gui.?
if i print out the returned from its method then the number of index will displayed. i mean, how to replace selected index that i choose with other statements? in this case i give each index of item with unit item, e.g. when i click the firs polutan then unit become mg,second pollutant unit become kg, etc.
• February 15th, 2013, 12:43 AM
Bli
Re: NEed Help, Aqi calculator change javascript to JAva Gui.?
i've already add this code, and itswork, but i supposed to get more simple codes using selectedindex. for a while this is work. now im going continue to other function method.i hope you can help me. thank you mr.Norm.
Code :

```cmbPol = new JComboBox(listpolutan); cmbPol.setLocation(80, 10); cmbPol.setSize(cmbPol.getPreferredSize()); cmbPol.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) {   if(cmbPol.getSelectedItem().equals("PM2.5 - Particulate &lt;2.5 microns (24hr avg)")){ textUnit.setText("ug/m3");} if(cmbPol.getSelectedItem().equals("PM10 - Particulate &lt;10 microns (24hr avg)")){ textUnit.setText("ug/m3");} if(cmbPol.getSelectedItem().equals("CO - Carbon Monoxide (8hr avg)")){ textUnit.setText("ppm");} if(cmbPol.getSelectedItem().equals("SO2 - Sulfur Dioxide (1hr avg)")){ textUnit.setText("ppb");} if(cmbPol.getSelectedItem().equals("SO2 - Sulfur Dioxide (24hr avg)")){ textUnit.setText("ppb");} if(cmbPol.getSelectedItem().equals("O3 - Ozone (8hr avg)")){ textUnit.setText("ppb");} if(cmbPol.getSelectedItem().equals("O3 - Ozone (1hr avg)")){ textUnit.setText("ppb");} if(cmbPol.getSelectedItem().equals("NO2 - Nitrogen Dioxide (1hr avg)")){ textUnit.setText("ppb");}   } });```
• February 15th, 2013, 05:30 AM
Norm
Re: NEed Help, Aqi calculator change javascript to JAva Gui.?
Instead of matching against the full String from the combobox, could you just just the index value?
A problem when matching full Strings is they can be mistyped and not be the same String.