Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Main function
- package ct1;
- import javafx.application.Application;
- import javafx.fxml.FXMLLoader;
- import javafx.scene.Parent;
- import javafx.scene.Scene;
- import javafx.stage.Stage;
- public class CT1 extends Application{
- @Override
- public void start(Stage stage) throws Exception {
- Parent root = FXMLLoader.load(getClass().getResource("Ct1.fxml"));
- Scene scene = new Scene(root);
- stage.setScene(scene);
- stage.setTitle("SignUp Page");
- stage.show();
- }
- public static void main(String[] args) {
- launch(args);
- }
- }
- //fxml controller
- /*
- * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
- * Click nbfs://nbhost/SystemFileSystem/Templates/javafx/FXMLController.java to edit this template
- */
- package ct1;
- import java.net.URL;
- import java.util.ResourceBundle;
- import javafx.event.ActionEvent;
- import javafx.fxml.FXML;
- import javafx.fxml.Initializable;
- import javafx.scene.control.Button;
- import javafx.scene.control.Label;
- import javafx.scene.control.PasswordField;
- import javafx.scene.control.TextField;
- /**
- * FXML Controller class
- *
- * @author Emon
- */
- public class Ct1Controller implements Initializable {
- @FXML
- private TextField email;
- @FXML
- private TextField username;
- @FXML
- private PasswordField pass;
- @FXML
- private PasswordField pass1;
- @FXML
- private Label label;
- @FXML
- private Button btn;
- String str1 = email.getText();
- String str2 = username.getText();
- String str3 = pass.getText();
- String str4 = pass1.getText();
- @Override
- public void initialize(URL url, ResourceBundle rb) {
- // TODO
- }
- @FXML
- private void btnPress(ActionEvent event) {
- if (event.getSource()==btn) {
- if ("".equals(str1)||"".equals(str2)||"".equals(str3)||"".equals(str4)) {
- label.setText("Plz Fill All Iteam");
- }
- else {
- if (str3==str4) {
- label.setText("Submit Successfully");
- } else {
- label.setText("Passwords do not Match");
- }
- }
- }
- }
- }
- //fxml
- <?xml version="1.0" encoding="UTF-8"?>
- <?import javafx.scene.control.Button?>
- <?import javafx.scene.control.Label?>
- <?import javafx.scene.control.PasswordField?>
- <?import javafx.scene.control.TextField?>
- <?import javafx.scene.layout.Pane?>
- <?import javafx.scene.text.Font?>
- <Pane 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="ct1.Ct1Controller">
- <children>
- <Label layoutX="44.0" layoutY="40.0" text="SingUp">
- <font>
- <Font name="System Bold Italic" size="30.0" />
- </font>
- </Label>
- <Label layoutX="45.0" layoutY="98.0" text="Email">
- <font>
- <Font name="System Bold" size="21.0" />
- </font>
- </Label>
- <Label layoutX="44.0" layoutY="138.0" text="UserName">
- <font>
- <Font name="System Bold" size="21.0" />
- </font>
- </Label>
- <Label layoutX="43.0" layoutY="177.0" text="Password">
- <font>
- <Font name="System Bold" size="21.0" />
- </font>
- </Label>
- <Label layoutX="43.0" layoutY="216.0" text="Confim Password">
- <font>
- <Font name="System Bold" size="21.0" />
- </font>
- </Label>
- <TextField fx:id="email" layoutX="226.0" layoutY="101.0" promptText="email" />
- <TextField fx:id="username" layoutX="226.0" layoutY="141.0" promptText="UserName" />
- <PasswordField fx:id="pass" layoutX="226.0" layoutY="180.0" promptText="***********" />
- <PasswordField fx:id="pass1" layoutX="226.0" layoutY="219.0" promptText="**********" />
- <Label fx:id="label" alignment="CENTER" layoutX="169.0" layoutY="264.0" prefHeight="27.0" prefWidth="248.0">
- <font>
- <Font size="18.0" />
- </font>
- </Label>
- <Button fx:id="btn" layoutX="254.0" layoutY="301.0" mnemonicParsing="false" onAction="#btnPress" prefHeight="31.0" prefWidth="94.0" text="Submit" />
- </children>
- </Pane>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement