Advertisement
Emon766

CT1 sign up page

Nov 26th, 2021
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.48 KB | None | 0 0
  1. //Main function
  2.  
  3. package ct1;
  4.  
  5. import javafx.application.Application;
  6. import javafx.fxml.FXMLLoader;
  7. import javafx.scene.Parent;
  8. import javafx.scene.Scene;
  9. import javafx.stage.Stage;
  10.  
  11.  
  12. public class CT1 extends Application{
  13.  
  14.  
  15. @Override
  16. public void start(Stage stage) throws Exception {
  17. Parent root = FXMLLoader.load(getClass().getResource("Ct1.fxml"));
  18. Scene scene = new Scene(root);
  19. stage.setScene(scene);
  20. stage.setTitle("SignUp Page");
  21. stage.show();
  22.  
  23. }
  24.  
  25. public static void main(String[] args) {
  26. launch(args);
  27. }
  28. }
  29.  
  30.  
  31.  
  32.  
  33.  
  34.  
  35. //fxml controller
  36. /*
  37. * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
  38. * Click nbfs://nbhost/SystemFileSystem/Templates/javafx/FXMLController.java to edit this template
  39. */
  40. package ct1;
  41.  
  42. import java.net.URL;
  43. import java.util.ResourceBundle;
  44. import javafx.event.ActionEvent;
  45. import javafx.fxml.FXML;
  46. import javafx.fxml.Initializable;
  47. import javafx.scene.control.Button;
  48. import javafx.scene.control.Label;
  49. import javafx.scene.control.PasswordField;
  50. import javafx.scene.control.TextField;
  51.  
  52. /**
  53. * FXML Controller class
  54. *
  55. * @author Emon
  56. */
  57. public class Ct1Controller implements Initializable {
  58.  
  59. @FXML
  60. private TextField email;
  61. @FXML
  62. private TextField username;
  63. @FXML
  64. private PasswordField pass;
  65. @FXML
  66. private PasswordField pass1;
  67. @FXML
  68. private Label label;
  69. @FXML
  70. private Button btn;
  71.  
  72.  
  73. String str1 = email.getText();
  74. String str2 = username.getText();
  75. String str3 = pass.getText();
  76. String str4 = pass1.getText();
  77.  
  78.  
  79.  
  80. @Override
  81. public void initialize(URL url, ResourceBundle rb) {
  82. // TODO
  83. }
  84.  
  85. @FXML
  86. private void btnPress(ActionEvent event) {
  87. if (event.getSource()==btn) {
  88.  
  89. if ("".equals(str1)||"".equals(str2)||"".equals(str3)||"".equals(str4)) {
  90.  
  91. label.setText("Plz Fill All Iteam");
  92. }
  93.  
  94. else {
  95. if (str3==str4) {
  96. label.setText("Submit Successfully");
  97. } else {
  98.  
  99. label.setText("Passwords do not Match");
  100. }
  101.  
  102. }
  103.  
  104. }
  105. }
  106.  
  107. }
  108.  
  109.  
  110.  
  111.  
  112.  
  113. //fxml
  114.  
  115. <?xml version="1.0" encoding="UTF-8"?>
  116.  
  117. <?import javafx.scene.control.Button?>
  118. <?import javafx.scene.control.Label?>
  119. <?import javafx.scene.control.PasswordField?>
  120. <?import javafx.scene.control.TextField?>
  121. <?import javafx.scene.layout.Pane?>
  122. <?import javafx.scene.text.Font?>
  123.  
  124. <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">
  125. <children>
  126. <Label layoutX="44.0" layoutY="40.0" text="SingUp">
  127. <font>
  128. <Font name="System Bold Italic" size="30.0" />
  129. </font>
  130. </Label>
  131. <Label layoutX="45.0" layoutY="98.0" text="Email">
  132. <font>
  133. <Font name="System Bold" size="21.0" />
  134. </font>
  135. </Label>
  136. <Label layoutX="44.0" layoutY="138.0" text="UserName">
  137. <font>
  138. <Font name="System Bold" size="21.0" />
  139. </font>
  140. </Label>
  141. <Label layoutX="43.0" layoutY="177.0" text="Password">
  142. <font>
  143. <Font name="System Bold" size="21.0" />
  144. </font>
  145. </Label>
  146. <Label layoutX="43.0" layoutY="216.0" text="Confim Password">
  147. <font>
  148. <Font name="System Bold" size="21.0" />
  149. </font>
  150. </Label>
  151. <TextField fx:id="email" layoutX="226.0" layoutY="101.0" promptText="email" />
  152. <TextField fx:id="username" layoutX="226.0" layoutY="141.0" promptText="UserName" />
  153. <PasswordField fx:id="pass" layoutX="226.0" layoutY="180.0" promptText="***********" />
  154. <PasswordField fx:id="pass1" layoutX="226.0" layoutY="219.0" promptText="**********" />
  155. <Label fx:id="label" alignment="CENTER" layoutX="169.0" layoutY="264.0" prefHeight="27.0" prefWidth="248.0">
  156. <font>
  157. <Font size="18.0" />
  158. </font>
  159. </Label>
  160. <Button fx:id="btn" layoutX="254.0" layoutY="301.0" mnemonicParsing="false" onAction="#btnPress" prefHeight="31.0" prefWidth="94.0" text="Submit" />
  161. </children>
  162. </Pane>
  163.  
  164.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement