Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

[Compile Error] Cannot find symbol with setDefaultCloseOperation  RSS feed

 
Jm Freeman
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is likely a simple matter, but my error is confusing given the line it flags matches a working project I have. I get the following error on line 6 in the Controller:
cannot find symbol
v.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
...........................................^
(carrot at the J)
my view file:


and my controller:
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Jm Freeman wrote:

Do you have any import statements in this file ?
 
Jm Freeman
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Joanne Neal wrote:
Do you have any import statements in this file ?


Nope, but that fixes it. Thanks JoAnne!
 
Campbell Ritchie
Marshal
Posts: 55674
161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And welcome to the Ranch

Controversial point. You could write
...
import static javax.swing.JFrame.EXIT_ON_CLOSE;
...
...setDefaultCloseOperation(EXIT_ON_CLOSE);
...

Some people like static import and some don't. Read more about it here, a webpage dating back to 2004 when static import was introduced.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!