Cameron Payton
Cameron Payton

Reputation: 432

Having trouble instantiating toolkit?

I'm trying to create a JFrame with the dimensions of my screen, so I tried to use the statement Toolkit kit = new Toolkit(); but it turns red and eclipse tells me "cannot instantiate the type Toolkit". So then I tried Toolkit kit = new Toolkit.getDefaultToolkit(); and that didn't work either. Help!!!

Upvotes: 0

Views: 207

Answers (1)

Jens
Jens

Reputation: 69470

Remove the newkeyword:

Toolkit kit = Toolkit.getDefaultToolkit(); 

The method getDefaultToolkit is a static method. See the documentation for more details.

Upvotes: 1

Related Questions