i know the statement
grid[4][4].setIcon(exclamationIcon);
works because i tested it in another area of the code.
i tried putting println but no response - the methods just arent getting called
i removed the BooleanJLabels and then i got a response after clicking the applet, so i think the problem is focus.
heres some more things i tried:
1. putting keyListeners on the labels themselves - didnt work - no idea why
2. calling requestFocus() in the applet - didnt work
3. making the applet bigger - worked after i clicked in the area not occupied by the labels - proving the problem is focus.
so why can't my labels take a keylistener? because i know they will have focus.
and why doesnt requestFocus() work?
oh heres the code to the BooleanJLabel class:
public class BooleanJLabel extends JLabel {
private boolean activated;
public BooleanJLabel(){
}
public BooleanJLabel(String s){
super(s);
}
public BooleanJLabel(Icon i){
super(i);
}
public void activate(){
activated = true;
}
public void deactivate(){
activated = false;
}
public void switchActivated(){
activated = !activated;
}
public void setActivated(boolean b){
activated = b;
}
public boolean isActivated(){
return activated;
}
}