I am trying to make a (very) simple applet using Java. I am new to programming and its concepts.
import java.awt.*;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import javax.swing.JApplet;
public class EuroCapitalsApplet extends JApplet{
private Image image = ("Mountain.jpg"));
String[] mountainArray = new String [14];
ArrayList<String> arrayList = new ArrayList<String>();
String mountain;
Map<String, Object> map = new HashMap<String, Object>();
public void init()
{
mountain=getParameter("citiesToMark");
mountainArray = cities.split("\\,");
for(int i = 0; i < mountainArray.length; i++)
{
arrayList.add(mountainArray[i]);
}
map.put("Tall", 140);
}
public void paint(Graphics g){
super.paint(g);
g.drawImage(image, 0, 0, this);
if(mountainList.get(0).equals("Tall")){
System.out.println("Hello");
}
}
}
I have put the "Hello" statement in there just to see how many times it prints out - its currently prints out 23 times where as I would like to print out once only I do not know what I am doing wrong, it took me a while to get this far.
I do not know much about loops only what I have read on here and through videos on Youtube. Could someone please push me in the right direction? I have little experience bar some HTML and CSS.