JavaFX - 无法在 ChoiceBox 上调用 setOnAction()?
JavaFX - Cannot call setOnAction() on ChoiceBox?
简单问题:
我之前肯定对 ChoiceBox<T>
使用了 setOnAction
,但它声称 ChoiceBox
class 没有这样的方法。我正在使用另一台计算机并安装了 Ex(fx)clipse
插件。这条线的底部是我的进口商品。我也有证据表明I have used this method of ChoiceBox before. What is wrong? It must be something outrageously simple. I don't understand how I was able to write it before and yet I don't see it in the JavaFX API page。
编辑:
Runnable version of my class here.
实例变量
private VBox root;
private Scene scene;
private static Stage stage;
private Label consoleTitle;
private static TextArea console;
private Button startBtn, endBtn, calibrateBtn, calibrateAreaBtn;
private ChoiceBox<String> lureCB;
private CheckBox lureCKB;
private HBox buttonHB, lureHB;
我的方法体中的代码块:
// ChoiceBox for the type of lures.
lureCB = new ChoiceBox<>();
lureCB.getItems().addAll("Test",
"Test",
"Test",
"Test",
"Test",
"Test");
lureCB.setVisible(false);
lureCB.setOnAction(e ->
{
});
我的导入
package gui;
import java.awt.AWTException;
import java.awt.Robot;
import java.time.LocalTime;
import program.*;
import javafx.application.Application;
import javafx.scene.control.Button;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.stage.Stage;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Region;
import javafx.scene.layout.VBox;
import javafx.geometry.Insets;
import javafx.scene.control.CheckBox;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.Label;
import javafx.scene.control.TextArea;
import javafx.scene.control.Tooltip;
import javafx.scene.text.Font;
import javafx.geometry.Pos;
import javafx.scene.paint.Color;
编辑:
原来setOnAction
方法只是从8u60版本的ChoiceBox
API开始添加的JDK.
简单问题:
我之前肯定对 ChoiceBox<T>
使用了 setOnAction
,但它声称 ChoiceBox
class 没有这样的方法。我正在使用另一台计算机并安装了 Ex(fx)clipse
插件。这条线的底部是我的进口商品。我也有证据表明I have used this method of ChoiceBox before. What is wrong? It must be something outrageously simple. I don't understand how I was able to write it before and yet I don't see it in the JavaFX API page。
编辑:
Runnable version of my class here.
实例变量
private VBox root;
private Scene scene;
private static Stage stage;
private Label consoleTitle;
private static TextArea console;
private Button startBtn, endBtn, calibrateBtn, calibrateAreaBtn;
private ChoiceBox<String> lureCB;
private CheckBox lureCKB;
private HBox buttonHB, lureHB;
我的方法体中的代码块:
// ChoiceBox for the type of lures.
lureCB = new ChoiceBox<>();
lureCB.getItems().addAll("Test",
"Test",
"Test",
"Test",
"Test",
"Test");
lureCB.setVisible(false);
lureCB.setOnAction(e ->
{
});
我的导入
package gui;
import java.awt.AWTException;
import java.awt.Robot;
import java.time.LocalTime;
import program.*;
import javafx.application.Application;
import javafx.scene.control.Button;
import javafx.scene.Node;
import javafx.scene.Scene;
import javafx.stage.Stage;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Region;
import javafx.scene.layout.VBox;
import javafx.geometry.Insets;
import javafx.scene.control.CheckBox;
import javafx.scene.control.ChoiceBox;
import javafx.scene.control.Label;
import javafx.scene.control.TextArea;
import javafx.scene.control.Tooltip;
import javafx.scene.text.Font;
import javafx.geometry.Pos;
import javafx.scene.paint.Color;
编辑:
原来setOnAction
方法只是从8u60版本的ChoiceBox
API开始添加的JDK.