I'm Writing a game where there are a set of islands and there are 5 workers on each island when i left click on a worker a cursor appears on it and when i right click on somewhere in the island the selected worker moves there..i want a JPanel to show on the right side of the screen every time i left click on a worker.the panel will show the workers stats such as Health and carrying weight but the problem is i can't make the panel appear.this is the code where i left click on a worker:
if(SwingUtilities.isLeftMouseButton(e)){
if(canSelect){
for (int j = 0; j < countries.size(); j++) {
for (int i = 0; i < countries.elementAt(j).getMen().size(); i++) {
if(m==countries.elementAt(j).getMen().elementAt(i).getX() && n==countries.elementAt(j).getMen().elementAt(i).getY()) {
countries.elementAt(j).getMen().elementAt(i).setY(countries.elementAt(j).getMen().elementAt(i).getY()+1);
countries.elementAt(j).getMen().elementAt(i).setSelected(true);
getGraphics().drawImage(arrow.getImage(), (countries.elementAt(j).getMen().elementAt(i).getX()+mapX)*20+5,(countries.elementAt(j).getMen().elementAt(i).getY()+mapY)*20-12,null);
canSelect = false;
}
}
}
}
}