Originally posted by Simon Evans:
Dear Campbell Ritchie, Joanne Neal & programmers
I have changed the relevant line in program 'Tarot' to:
for (int i = 0; i< images.length; i++)
{
images[i] = new ImageIcon( + i + ".gif");
};
******************You mean "" + i + ".gif", surely.
I have tried putting the text:- javac -version
to the console, but get:-
javac: invalid flag: -version
along with all the other associated gen that follows such returns.
***********************It always works for me, although I couldn't find "version" on the javac home page.
I tried this instead of those three columns of repeated code, ie:-
for (int i = 0; i< 41; i++)
{
JLabel[i] = new JLabel(images[0]);
p.add(JLabel[i]);
JLabel[i].addMouseListener(mousie);
}
but this got me :-
C:\Java\Java Six>javac FT.java
FT.java:21: cannot resolve symbol
symbol : variable JLabel
location: class FT
JLabel[i] = new JLabel(images[0]);
^
FT.java:22: cannot resolve symbol
symbol : variable JLabel
location: class FT
p.add(JLabel[i]);
^
FT.java:23: cannot resolve symbol
symbol : variable mousie
location: class FT
JLabel[i].addMouseListener(mousie);
^
FT.java:23: cannot resolve symbol
symbol : variable JLabel
location: class FT
JLabel[i].addMouseListener(mousie);
^
4 errors
C:\Java\Java Six>
****************You have got an array the same name as the class JLabel. Try changing that, maybe to labels[i]. Make sure the scope of that array and of "mousie" are correct.
I have recoded program NameInput in accordance with Joanne's diagnosis, thank you.
re:-
****************Which classes from java.util are you using? I think you might be able to lose that import.
Thank you for your help.
Hoping to hear.
Yours
Simon.
Simon
Simon
Simon
Simon
Simon
Simon
Don't get me started about those stupid light bulbs. |