Advertisement
Guest User

Untitled

a guest
Jul 30th, 2017
171
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.91 KB | None | 0 0
  1. <?import com.jfoenix.controls.JFXButton?>
  2. <?import com.jfoenix.controls.JFXComboBox?>
  3. <?import com.jfoenix.controls.JFXDatePicker?>
  4. <?import com.jfoenix.controls.JFXTextField?>
  5. <?import javafx.scene.control.Label?>
  6. <?import javafx.scene.control.Separator?>
  7. <?import javafx.scene.image.Image?>
  8. <?import javafx.scene.image.ImageView?>
  9. <?import javafx.scene.layout.AnchorPane?>
  10. <?import javafx.scene.layout.Pane?>
  11. <?import javafx.scene.text.Font?>
  12.  
  13. <AnchorPane id="AnchorPane" prefHeight="400.0" prefWidth="600.0" xmlns="http://javafx.com/javafx/8.0.111" xmlns:fx="http://javafx.com/fxml/1" fx:controller="entrevinos_login.FormUserSignUpController">
  14. <children>
  15. <AnchorPane id="AnchorPane" fx:id="btnregistrar" layoutX="10.0" layoutY="9.0" prefHeight="523.0" prefWidth="910.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
  16. <children>
  17. <Pane layoutX="-12.0" layoutY="-10.0" prefHeight="524.0" prefWidth="132.0" style="-fx-background-color: #311019;" AnchorPane.leftAnchor="-12.0" />
  18. <Label layoutX="195.0" layoutY="35.0" text="Registro de Usuarios" textFill="#ab1c44">
  19. <font>
  20. <Font name="System Bold" size="25.0" />
  21. </font>
  22. </Label>
  23. <JFXTextField fx:id="CédulaInput" focusColor="#ab1c44" labelFloat="true" layoutX="195.0" layoutY="110.0" prefHeight="29.0" prefWidth="247.0" promptText="Cédula de Identidad" />
  24. <JFXTextField fx:id="EmailInput" focusColor="#ab1c44" labelFloat="true" layoutX="533.0" layoutY="110.0" prefHeight="29.0" prefWidth="270.0" promptText="Email" />
  25. <JFXTextField fx:id="NombreInput" focusColor="#ab1c44" labelFloat="true" layoutX="195.0" layoutY="173.0" prefHeight="29.0" prefWidth="247.0" promptText="Nombre" />
  26. <JFXTextField fx:id="Apellido" focusColor="#ab1c44" labelFloat="true" layoutX="533.0" layoutY="173.0" prefHeight="29.0" prefWidth="270.0" promptText="Primer Apellido" />
  27. <JFXDatePicker fx:id="FechaInput" defaultColor="#ab1c44" layoutX="195.0" layoutY="243.0" overLay="true" prefHeight="29.0" prefWidth="247.0" promptText="Fecha de Nacimiento" />
  28. <JFXTextField fx:id="TeléfonoInput" focusColor="#ab1c44" labelFloat="true" layoutX="533.0" layoutY="243.0" prefHeight="29.0" prefWidth="270.0" promptText="Teléfono" />
  29. <JFXComboBox fx:id="PaisInput" focusColor="#ab1c44" labelFloat="true" layoutX="195.0" layoutY="316.0" prefHeight="31.0" prefWidth="247.0" promptText="País" />
  30. <JFXComboBox fx:id="ProvinciaInput" focusColor="#ab1c44" labelFloat="true" layoutX="533.0" layoutY="316.0" prefHeight="31.0" prefWidth="132.0" promptText="Provincia" />
  31. <JFXComboBox fx:id="CantónInput" focusColor="#ab1c44" labelFloat="true" layoutX="672.0" layoutY="316.0" prefHeight="31.0" prefWidth="132.0" promptText="Cantón" />
  32. <JFXButton layoutX="208.0" layoutY="413.0" text="Borrar todo" />
  33. <JFXButton layoutX="640.0" layoutY="413.0" prefHeight="31.0" prefWidth="164.0" style="-fx-background-color: #ab1c44;" text="Continuar" textFill="WHITE" />
  34. <Separator layoutX="187.0" layoutY="78.0" prefHeight="12.0" prefWidth="625.0" />
  35. <Label layoutX="868.0" layoutY="-4.0" text="X" textFill="#ab1c44">
  36. <font>
  37. <Font name="System Bold" size="25.0" />
  38. </font>
  39. </Label>
  40. <ImageView fitHeight="36.0" fitWidth="43.0" layoutX="136.0" layoutY="35.0" onMouseClicked="#GoBackToLogin" pickOnBounds="true" preserveRatio="true">
  41. <image>
  42. <Image url="@images/icons8_Back_To_100px.png" />
  43. </image>
  44. </ImageView>
  45. </children>
  46. </AnchorPane>
  47. </children>
  48. </AnchorPane>
  49.  
  50. package entrevinos_login;
  51.  
  52. import database.Database;
  53. import java.io.IOException;
  54. import java.net.URL;
  55. import java.sql.Connection;
  56. import java.sql.DriverManager;
  57. import java.sql.SQLException;
  58. import java.sql.Statement;
  59. import java.util.ResourceBundle;
  60. import java.util.logging.Level;
  61. import java.util.logging.Logger;
  62. import javafx.event.ActionEvent;
  63. import javafx.fxml.FXML;
  64. import javafx.fxml.FXMLLoader;
  65. import javafx.fxml.Initializable;
  66. import javafx.scene.Node;
  67. import javafx.scene.Parent;
  68. import javafx.scene.Scene;
  69. import javafx.scene.input.MouseEvent;
  70. import javafx.stage.Stage;
  71.  
  72.  
  73. public class FormUserSignUpController implements Initializable {
  74. Connection con;
  75. @Override
  76. public void initialize(URL url, ResourceBundle rb) {
  77. try {
  78. createConnection();
  79. } catch (SQLException ex) {
  80. Logger.getLogger(FormUserSignUpController.class.getName()).log(Level.SEVERE, null, ex);
  81. }
  82. }
  83.  
  84. void createConnection() throws SQLException {
  85. try{
  86. Class.forName("com.mysql.jdbc.Driver");
  87. con = DriverManager.getConnection("jdbc:mysql://localhost:3306/entrevinos","root","mysql");
  88. }catch (ClassNotFoundException | SQLException ex){
  89. Logger.getLogger(Database.class.getName()).log(Level.SEVERE, null, ex);
  90. }
  91. }
  92.  
  93. @FXML
  94. private void btnContinuar(ActionEvent event) throws IOException {
  95. try{
  96. String name = .getText();
  97. Statement stmt = con.createStatement();
  98. String dbop = "INSERT INTO CLIENTES VALUES('"+ nombre +"')";
  99. stmt.execute(dbop);
  100. }catch(SQLException ex){
  101. Logger.getLogger(Database.class.getName()).log(Level.SEVERE, null, ex);
  102. }
  103.  
  104. }
  105.  
  106.  
  107. @FXML
  108. private void GoBackToLogin(MouseEvent event) throws IOException {
  109. System.out.println("x");
  110. Parent home_page_parent = FXMLLoader.load(getClass().getResource("FXMLDocument.fxml"));
  111. Scene home_page_scene = new Scene (home_page_parent);
  112. Stage app_stage = (Stage) ((Node) event.getSource()).getScene().getWindow();
  113. app_stage.hide();
  114. app_stage.setScene(home_page_scene);
  115. app_stage.show();
  116. }
  117. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement