Hi,
I am able to run:FXMLJavaFXMaven Archetype and SimpleJavaFXMavenArchetype
provided byNatebeans 12.4. Now I created the application using following steps:
File-→NewProject-→Java with Maven and Java Application-→ProjectName(JavaFx2)
and thenI right clicked on javafx2 from the project
list-→New-→other-→JavaFX2(Frome categories) and File
Types(JavaFxMainClass)-→Next-→ClassName(Fx2FXMain)
andPackage(com.mycompany.javafx2)-→finish, I got following code withfull of red
balls (i.e. errors):
importjavafx.application.Application;//err package not exist
importjavafx.event.ActionEvent;//err package not exits and so in all
importdeclaration
importjavafx.event.EventHandler;
importjavafx.scene.Scene;
importjavafx.scene.control.Button;
importjavafx.scene.layout.StackPane;
importjavafx.stage.Stage;
/**
*
* @author zulfi
*/
public classFx2FXMain extends Application {
@Override
public voidstart(Stage primaryStage) {
Button btn =new Button();
btn.setText("Say 'Hello World'");
btn.setOnAction(new EventHandler<ActionEvent>() {
@Override
publicvoid handle(ActionEvent event) {
System.out.println("Hello World!");
}
});
StackPaneroot = new StackPane();
root.getChildren().add(btn);
Scene scene= new Scene(root, 300, 250);
primaryStage.setTitle("Hello World!");
primaryStage.setScene(scene);
primaryStage.show();
}
/**
* @param argsthe command line arguments
*/
public staticvoid main(String[] args) {
launch(args);
}
}
All importinstructions are giving the error, package does not exits.
Somebodyplease guide me.
Zulfi.