Kacper Szmigiel wrote:
I get "variable przycisk of type Object" in line 26, during compiling. Why?
You get more than that. I'm going to take a guess that it's "undefined symbol." If so, then the error message is telling you exactly what's wrong, namely that you are trying to use a variable named przycisk but there is no such variable defined in that scope.
If that's not the rest of the error message, then please copy/paste the exact, complete message.
Also, note that line 26 of the code you posted is
which is unlikely to be giving that error.
Joined: Sep 18, 2012
Oh yeah, my fault. It's about line 24, and the full text of error is:
error: cannot find symbol
symbol: variable przycisk
location: class ProstyGUI1
Also, I've compared example from Head First. Java. and my own code. And there's the diffrence:
In my code:
And in the example:
So does the way I will make JButton przycisk (as a component of class or as variable in method). It's all about the diffrence between local and global?