Professional Documents
Culture Documents
38 Hardik Parmar Exp 14
38 Hardik Parmar Exp 14
SE 5
Roll No : 38
Experiment No.14
Date of Performance: 5/12/21
Date of Submission: 12/12/21
THEORY:
JavaFX tutorial provides basic and advanced concepts of JavaFX. Our JavaFX
tutorial is designed for beginners and professionals.
JavaFX has works with four main components from which others derive, these
are: Stage, Scene, Node and Layout.
Stage
Is the central element, acting as a container for all the scenes. Following the
analogy with a Theater, is the space where everything happens inside.
Scene
Is a smaller element that that contains a group of nodes (GUI elements) and
contains them.
Node
Are the elements that compose a scene (buttons, text-boxes, labels, etc…). It is
possible and usually the case, nodes have children nodes under their hierarchy,
having the ability to nest/be nested.
Layout
As the name says, it is responsible for defining how the nodes and elements are
shown on the screen.ultiple platforms including Web, Mobile and Desktops.
PROBLEM STATEMENT:
Write a Java program to design a Login Form using JavaFX Controls.
PROGRAM:
import javafx.application.Application;
javafx.scene.Scene; import
javafx.scene.control.Button; import
javafx.scene.control.Label; import
javafx.scene.control.PasswordField; import
javafx.scene.control.TextField; import
javafx.scene.layout.StackPane; import
javafx.scene.layout.VBox; import
javafx.stage.Stage;
@Override
vBox.setSpacing(8);
vBox.setPadding(new Insets(10,10,10,10));
vBox.getChildren().addAll( new
Label("Your Username"),
new TextField(),
Button("LOGIN"));
root.getChildren().addAll(vBox);
button.setOnAction(actionEvent-> {
if(stage!=null)
{ stage.requestFocus();
return;
stage.show();
});
@Override
primaryStage.setScene(scene);
primaryStage.show();
primaryStage.setAlwaysOnTop(true);
}
{ launch(args);
OUTPUT:
CONCLUSION: