Logo 
Search:

Java Forum

Ask Question   UnAnswered
Home » Forum » Java       RSS Feeds

Start:Applet not initailized

  Asked By: Pooja    Date: Apr 08    Category: Java    Views: 499
  

I have written a code in java.There are no syntax error.At run time applet window displays error as"Start:Applet not initialized".What to do?Please suggest a solution.Here's my applet code:
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class capital extends JApplet implements ItemListener
{
JList jl;
JComboBox jc;
JLabel l;
ImageIcon ii;
public void init()
{
String country[]={"India","Australia","Shri Lanka","China","Pakistan"};
String capital[]={"Delhi","Canberra","Colombo","Bijing","Islamabad"};
jc=new JComboBox(country);
jl=new JList(capital);
ii=new ImageIcon("icon.bmp");
add(jc);add(jl);add(l);
jc.addItemListener(this);
}
public void itemStateChanged(ItemEvent e)
{
if(jc.getSelectedItem().equals("India"))
{
jl.setSelectedIndex(0);
String msg=jl.getSelectedValue().toString();
l=new JLabel("Capital of India is="+msg+ii,JLabel.CENTER);
}
else if(jc.getSelectedItem().equals("Australia"))
{
jl.setSelectedIndex(1);
String msg=jl.getSelectedValue().toString();
l=new JLabel("Capital of Australia is="+msg+ii,JLabel.CENTER);
}
else if(jc.getSelectedItem().equals("Shri Lanka"))
{
jl.setSelectedIndex(2);
String msg=jl.getSelectedValue().toString();
l=new JLabel("Capital of Shri Lanka is="+msg+ii,JLabel.CENTER);
}
else if(jc.getSelectedItem().equals("China"))
{
jl.setSelectedIndex(3);
String msg=jl.getSelectedValue().toString();
l=new JLabel("Capital of China is="+msg+ii,JLabel.CENTER);
}
else if(jc.getSelectedItem().equals("Pakistan"))
{
jl.setSelectedIndex(4);
String msg=jl.getSelectedValue().toString();
l=new JLabel("Capital of Pakistan is="+msg+ii,JLabel.CENTER);
}
}
}
/*<applet code=capital width=300 height=200>
</applet>*/

Share: 

 

No Answers Found. Be the First, To Post Answer.

 
Didn't find what you were looking for? Find more on Start:Applet not initailized Or get search suggestion and latest updates.




Tagged: