This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Variable button

 
Kacper Szmigiel
Greenhorn
Posts: 24
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


I get "variable przycisk of type Object" in line 26, during compiling. Why?
 
Kacper Szmigiel
Greenhorn
Posts: 24
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, bad button
 
Jeff Verdegan
Bartender
Posts: 6109
6
Android IntelliJ IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Kacper Szmigiel
Greenhorn
Posts: 24
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh yeah, my fault. It's about line 24, and the full text of error is:

error: cannot find symbol
przycisk.setText("Zostałem kliknięty");
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?
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic