JavaFX 8 ColorPicker NullPointerException

时间:2014-04-08 01:51:31

标签: java input nullpointerexception javafx-8 color-picker

此代码:

package colorpickertest;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.ColorPicker;
import javafx.scene.layout.Pane;
import javafx.scene.paint.Color;
import javafx.stage.Stage;

public class ColorPickerTest extends Application {

    @Override
    public void start(Stage stage) throws Exception {
        Pane root = new Pane();
        Scene scene = new Scene(root, 640, 480, Color.BLACK);
        root.getChildren().add(new ColorPicker());

        stage.setTitle("ColorPickerTest");
        stage.setScene(scene);
        stage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }

}

有时会在选择某些较浅的颜色时反复出现此错误:

Exception in thread "JavaFX Application Thread" java.lang.NullPointerException
    at com.sun.glass.ui.TouchInputSupport.notifyBeginTouchEvent(TouchInputSupport.java:82)
    at com.sun.glass.ui.mac.MacTouchInputSupport.notifyNextTouchEvent(MacTouchInputSupport.java:128)
    at com.sun.glass.ui.mac.MacGestureSupport.notifyNextTouchEvent(MacGestureSupport.java:77)

我做错了什么?谢谢。 StackOverflow让我添加了更多细节,但这就是我所要提供的。

0 个答案:

没有答案