所以我似乎无法找到关于为什么 eclipse 无法识别“setPromptText”函数的任何信息。它问我是否要创建方法 setPromptText:
import javafx.application.*;
import javafx.scene.*;
import javafx.stage.*;
import javafx.scene.layout.*;
import javafx.scene.control.*;
import javafx.event.*;
import javafx.geometry.*;
public class TextField extends Application {
TextField tf;
Label response;
public static void main(String [] args) {
launch(args);
}
public void start(Stage myStage) {
myStage.setTitle("Demonstrate a textfield");
FlowPane rootNode = new FlowPane(10,10);
rootNode.setAlignment(Pos.CENTER);
Scene myScene = new Scene(rootNode, 230, 140);
myStage.setScene(myScene);
response = new Label("Enter Name: ");
Button btnGetText = new Button("Get Name");
tf = new TextField();
tf.setPromptText("Enter a name.");
}
}
暮色呼如
相关分类