fork download
  1. import javafx.application.Application;
  2. import javafx.event.ActionEvent;
  3. import javafx.event.EventHandler;
  4. import javafx.geometry.Insets;
  5. import javafx.geometry.Pos;
  6. import javafx.stage.Stage;
  7. import javafx.scene.Scene;
  8. import javafx.scene.control.Button;
  9. import javafx.scene.control.Label;
  10. import javafx.scene.control.PasswordField;
  11. import javafx.scene.control.TextField;
  12. import javafx.scene.layout.GridPane;
  13. import javafx.scene.layout.HBox;
  14. import javafx.scene.paint.Color;
  15. import javafx.scene.text.Font;
  16. import javafx.scene.text.FontWeight;
  17. import javafx.scene.text.Text;
  18.  
  19.  
  20. public class Main extends Application {
  21. @Override
  22. public void start(Stage primaryStage) {
  23. primaryStage.setTitle("JavaFX Form");
  24. GridPane grid = new GridPane();
  25. grid.setAlignment(Pos.CENTER);
  26. grid.setHgap(10);
  27. grid.setVgap(10);
  28. grid.setPadding(new Insets(25,25,25,25));
  29.  
  30. Text sceneTitle = new Text("Welcome");
  31. sceneTitle.setFont(Font.font("Tahoma",FontWeight.BOLD,20));
  32. grid.add(sceneTitle, 0, 0,2,1);
  33.  
  34. Label userName = new Label("User Name : ");
  35. grid.add(userName, 0, 1);
  36.  
  37. TextField userTextField = new TextField();
  38. grid.add(userTextField, 1, 1);
  39.  
  40. Label pw = new Label("Password");
  41. grid.add(pw, 0, 2);
  42.  
  43. PasswordField pwBox = new PasswordField();
  44. grid.add(pwBox, 1, 2);
  45.  
  46. Button btn = new Button("Sign in");
  47. HBox hbBtn = new HBox(10);
  48. hbBtn.setAlignment(Pos.BOTTOM_RIGHT);
  49. hbBtn.getChildren().add(btn);
  50. grid.add(hbBtn, 1, 4);
  51.  
  52. final Text actionTarget = new Text();
  53. grid.add(actionTarget, 1, 6);
  54.  
  55. btn.setOnAction(new EventHandler<ActionEvent>() {
  56.  
  57. @Override
  58. public void handle(ActionEvent arg0) {
  59. actionTarget.setFill(Color.FIREBRICK);
  60. actionTarget.setText("Sign in button pressed");
  61.  
  62. }
  63. });
  64.  
  65. Scene scene = new Scene(grid, 500, 600);
  66. primaryStage.setScene(scene);
  67. primaryStage.show();
  68.  
  69. }
  70.  
  71. public static void main(String[] args) {
  72. launch(args);
  73. }
  74. }
  75.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Main.java:1: error: package javafx.application does not exist
import javafx.application.Application;
                         ^
Main.java:2: error: package javafx.event does not exist
import javafx.event.ActionEvent;
                   ^
Main.java:3: error: package javafx.event does not exist
import javafx.event.EventHandler;
                   ^
Main.java:4: error: package javafx.geometry does not exist
import javafx.geometry.Insets;
                      ^
Main.java:5: error: package javafx.geometry does not exist
import javafx.geometry.Pos;
                      ^
Main.java:6: error: package javafx.stage does not exist
import javafx.stage.Stage;
                   ^
Main.java:7: error: package javafx.scene does not exist
import javafx.scene.Scene;
                   ^
Main.java:8: error: package javafx.scene.control does not exist
import javafx.scene.control.Button;
                           ^
Main.java:9: error: package javafx.scene.control does not exist
import javafx.scene.control.Label;
                           ^
Main.java:10: error: package javafx.scene.control does not exist
import javafx.scene.control.PasswordField;
                           ^
Main.java:11: error: package javafx.scene.control does not exist
import javafx.scene.control.TextField;
                           ^
Main.java:12: error: package javafx.scene.layout does not exist
import javafx.scene.layout.GridPane;
                          ^
Main.java:13: error: package javafx.scene.layout does not exist
import javafx.scene.layout.HBox;
                          ^
Main.java:14: error: package javafx.scene.paint does not exist
import javafx.scene.paint.Color;
                         ^
Main.java:15: error: package javafx.scene.text does not exist
import javafx.scene.text.Font;
                        ^
Main.java:16: error: package javafx.scene.text does not exist
import javafx.scene.text.FontWeight;
                        ^
Main.java:17: error: package javafx.scene.text does not exist
import javafx.scene.text.Text;
                        ^
Main.java:20: error: cannot find symbol
public class Main extends Application {
                          ^
  symbol: class Application
Main.java:22: error: cannot find symbol
	public void start(Stage primaryStage) {
	                  ^
  symbol:   class Stage
  location: class Main
Main.java:21: error: method does not override or implement a method from a supertype
	@Override
	^
Main.java:24: error: cannot find symbol
		GridPane grid = new GridPane();
		^
  symbol:   class GridPane
  location: class Main
Main.java:24: error: cannot find symbol
		GridPane grid = new GridPane();
		                    ^
  symbol:   class GridPane
  location: class Main
Main.java:25: error: cannot find symbol
		grid.setAlignment(Pos.CENTER);
		                  ^
  symbol:   variable Pos
  location: class Main
Main.java:28: error: cannot find symbol
		grid.setPadding(new  Insets(25,25,25,25));
		                     ^
  symbol:   class Insets
  location: class Main
Main.java:30: error: cannot find symbol
		Text sceneTitle = new Text("Welcome");
		^
  symbol:   class Text
  location: class Main
Main.java:30: error: cannot find symbol
		Text sceneTitle = new Text("Welcome");
		                      ^
  symbol:   class Text
  location: class Main
Main.java:31: error: cannot find symbol
		sceneTitle.setFont(Font.font("Tahoma",FontWeight.BOLD,20));
		                                      ^
  symbol:   variable FontWeight
  location: class Main
Main.java:31: error: cannot find symbol
		sceneTitle.setFont(Font.font("Tahoma",FontWeight.BOLD,20));
		                   ^
  symbol:   variable Font
  location: class Main
Main.java:34: error: cannot find symbol
		Label userName = new Label("User Name : ");
		^
  symbol:   class Label
  location: class Main
Main.java:34: error: cannot find symbol
		Label userName = new Label("User Name : ");
		                     ^
  symbol:   class Label
  location: class Main
Main.java:37: error: cannot find symbol
		TextField userTextField = new TextField();
		^
  symbol:   class TextField
  location: class Main
Main.java:37: error: cannot find symbol
		TextField userTextField = new TextField();
		                              ^
  symbol:   class TextField
  location: class Main
Main.java:40: error: cannot find symbol
		Label pw = new Label("Password");
		^
  symbol:   class Label
  location: class Main
Main.java:40: error: cannot find symbol
		Label pw = new Label("Password");
		               ^
  symbol:   class Label
  location: class Main
Main.java:43: error: cannot find symbol
		PasswordField pwBox = new PasswordField();
		^
  symbol:   class PasswordField
  location: class Main
Main.java:43: error: cannot find symbol
		PasswordField pwBox = new PasswordField();
		                          ^
  symbol:   class PasswordField
  location: class Main
Main.java:46: error: cannot find symbol
		Button btn = new Button("Sign in");
		^
  symbol:   class Button
  location: class Main
Main.java:46: error: cannot find symbol
		Button btn = new Button("Sign in");
		                 ^
  symbol:   class Button
  location: class Main
Main.java:47: error: cannot find symbol
		HBox hbBtn = new HBox(10);
		^
  symbol:   class HBox
  location: class Main
Main.java:47: error: cannot find symbol
		HBox hbBtn = new HBox(10);
		                 ^
  symbol:   class HBox
  location: class Main
Main.java:48: error: cannot find symbol
		hbBtn.setAlignment(Pos.BOTTOM_RIGHT);
		                   ^
  symbol:   variable Pos
  location: class Main
Main.java:52: error: cannot find symbol
		final Text actionTarget = new Text();
		      ^
  symbol:   class Text
  location: class Main
Main.java:52: error: cannot find symbol
		final Text actionTarget = new Text();
		                              ^
  symbol:   class Text
  location: class Main
Main.java:55: error: cannot find symbol
		btn.setOnAction(new EventHandler<ActionEvent>() {
		                    ^
  symbol:   class EventHandler
  location: class Main
Main.java:55: error: cannot find symbol
		btn.setOnAction(new EventHandler<ActionEvent>() {
		                                 ^
  symbol:   class ActionEvent
  location: class Main
Main.java:65: error: cannot find symbol
		Scene scene = new Scene(grid, 500, 600);
		^
  symbol:   class Scene
  location: class Main
Main.java:65: error: cannot find symbol
		Scene scene = new Scene(grid, 500, 600);
		                  ^
  symbol:   class Scene
  location: class Main
Main.java:72: error: cannot find symbol
		launch(args);
		^
  symbol:   method launch(String[])
  location: class Main
48 errors
stdout
Standard output is empty