Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Main file
- package javafxdemo;
- import javafx.application.Application;
- import javafx.fxml.FXMLLoader;
- import javafx.scene.Parent;
- import javafx.scene.Scene;
- import javafx.stage.Stage;
- public class Main2 extends Application{
- int abc = 0;
- @Override
- public void start(Stage stage) throws Exception {
- Parent root = FXMLLoader.load(getClass().getResource("FXML.fxml"));
- Scene scene = new Scene(root);
- stage.setScene(scene);
- stage.setTitle("Signup Page");
- stage.show();
- }
- public static void main(String[] args) {
- launch(args);
- }
- }
- //conltroller
- package javafxdemo;
- import java.net.URL;
- import java.util.ResourceBundle;
- import javafx.event.ActionEvent;
- import javafx.fxml.FXML;
- import javafx.fxml.Initializable;
- import javafx.scene.Parent;
- import javafx.scene.control.Button;
- import javafx.scene.control.Label;
- import javafx.scene.control.PasswordField;
- import javafx.scene.control.TextArea;
- public class FXMLController implements Initializable {
- static Parent load() {
- throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
- }
- @FXML
- private Label lbl;
- @FXML
- private Button submit;
- @FXML
- private TextArea email;
- @FXML
- private TextArea username;
- @FXML
- private PasswordField password;
- @FXML
- private PasswordField password2;
- /**
- * Initializes the controller class.
- */
- @Override
- public void initialize(URL url, ResourceBundle rb) {
- // TODO
- }
- @FXML
- private void clickSubmit(ActionEvent event) {
- if (event.getSource()==submit) {
- if (password.equals(password2)) {
- lbl.setText("Done....Thank You!");
- }
- else
- {
- lbl.setText("Two password aren't same");
- }
- }
- }
- }
- //java Fx..............................................................................
- <?xml version="1.0" encoding="UTF-8"?>
- <?import javafx.geometry.Insets?>
- <?import javafx.scene.control.Button?>
- <?import javafx.scene.control.Label?>
- <?import javafx.scene.control.PasswordField?>
- <?import javafx.scene.control.TextArea?>
- <?import javafx.scene.layout.HBox?>
- <?import javafx.scene.layout.VBox?>
- <?import javafx.scene.text.Font?>
- <VBox maxHeight="-Infinity" maxWidth="-Infinity" minHeight="-Infinity" minWidth="-Infinity" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/17" xmlns:fx="http://javafx.com/fxml/1" fx:controller="javafxdemo.FXMLController">
- <children>
- <Label prefHeight="58.0" prefWidth="90.0" text="Sign Up">
- <font>
- <Font name="System Bold" size="12.0" />
- </font></Label>
- <HBox prefHeight="43.0" prefWidth="600.0">
- <children>
- <Label prefHeight="43.0" prefWidth="101.0" text="Email:" />
- <TextArea fx:id="email" prefHeight="43.0" prefWidth="188.0" />
- </children>
- </HBox>
- <HBox prefHeight="43.0" prefWidth="600.0">
- <children>
- <Label prefHeight="43.0" prefWidth="102.0" text="User Name :" />
- <TextArea fx:id="username" prefHeight="43.0" prefWidth="188.0" />
- </children>
- </HBox>
- <HBox prefHeight="43.0" prefWidth="600.0">
- <children>
- <Label prefHeight="43.0" prefWidth="100.0" text="Password:" />
- <PasswordField fx:id="password" prefHeight="43.0" prefWidth="190.0" />
- </children>
- </HBox>
- <HBox prefHeight="43.0" prefWidth="600.0">
- <children>
- <Label prefHeight="43.0" prefWidth="99.0" text="Confirm Password" />
- <PasswordField fx:id="password2" prefHeight="43.0" prefWidth="190.0" />
- </children>
- </HBox>
- <Label fx:id="lbl" prefHeight="17.0" prefWidth="314.0" />
- <Button fx:id="submit" mnemonicParsing="false" onAction="#clickSubmit" prefHeight="25.0" prefWidth="61.0" text="Submit">
- <VBox.margin>
- <Insets />
- </VBox.margin>
- </Button>
- </children>
- </VBox>
Add Comment
Please, Sign In to add comment