1

All other classes from JavaFX work fine but Spinner gives me "Spinner cannot be resolved to a type".

I also tried to import import javafx.scene.control.Spinner; but this gaves me The import javafx.scene.control.Spinner cannot be resolvedback.

My current import list which WORKS fine :

import javafx.scene.canvas.GraphicsContext;
import javafx.scene.control.*;
import javafx.scene.image.ImageView;
import javafx.scene.image.PixelWriter;
import javafx.scene.paint.Color;
import javafx.beans.property.ObjectProperty;
import javafx.beans.property.SimpleObjectProperty;
import javafx.beans.value.ObservableValue;
import javafx.fxml.FXML;
import javafx.fxml.Initializable;
import javafx.scene.canvas.Canvas;

Someone can help ? I also downloaded e(fx)lipse to solve it but didnt helped

Ahmet K
  • 713
  • 18
  • 42
  • What JDK are you using? javafx.scene.control.Spinner is the correct class name. Try cleaning and building again, with that import in place. Change * to Spinner and see what else it throws up. It must be a different control that's causing the issue. – ManoDestra May 19 '16 at 19:10
  • I tried to clean it but didnt helped. 'import javafx.scene.control.*;' throws me nothing back but says that im never using the import. And Spinner is still redlined with '"Spinner cannot be resolved to a type"' – Ahmet K May 19 '16 at 19:15
  • 5
    Note that Spinner was added in 8u40. – Arjan May 19 '16 at 19:16
  • Oh I got JDK 8u30 ... Thats it I guess. Can I use Spinner without install a new SDK ? – Ahmet K May 19 '16 at 19:18
  • 1
    No, you cannot Ahmet, you need to use the 8u40 runtime as a minimum. – jewelsea May 19 '16 at 19:22
  • Okay then. Thanks for your help guys ! Somebody who wants to write an answer so I can accept it ? – Ahmet K May 19 '16 at 19:24
  • 1
    I had the same thing happen to me first time I tried using `Alert`. As pointed out, if you upgrade to the latest JDK it should be fine. (also make sure your project is set to use said version) – Monkeygrinder May 19 '16 at 19:41

1 Answers1

1

As Arjan noted in the comments, check the precise Java version you are using - it is probably lower than 8u40 in which the Spinner was added - and update your JDK.

As a side note: I ran into this when using Travis CI, from their issue tracker we know that at the moment the fix is to add dist: trusty to the .travis.yml file, but hopefully they update eventually.

PHPirate
  • 7,023
  • 7
  • 48
  • 84