JavaFX Tutorial | Login Screen with database connection (2021)

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
<b>Hey Everyone! Today I am going to show you how to create </b> <b>a login screen. We are going to design it using Scene </b> <b>Builder</b> <b>then code and build in IntelliJ as JavaFX application</b> <b>we are going to connect and validate the user againts a </b> <b>database table in MySQL</b> <b>well</b> <b>In Summary it is a simple Login Screen with Database </b> <b>Connection</b> <b>Alright let's start with IntelliJ</b> <b>I am using Community Edition 2021.1</b> <b>New Project</b> <b>Here we pick Java FX > JavaFX Application then we check the </b> <b>Project SDK</b> <b>making sure we are using the correct version</b> <b>Next</b> <b>Name the project</b> <b>i'll name it PlutoPlanetNine</b> <b>Finish</b> <b>Let's check our project folder</b> <b>I got the two classes and a file</b> <b>we have Main.java, our Main program so to speak</b> <b>and we have a lot of reds, ignore them for now and we will </b> <b>address that in a short while.</b> <b>Here you see Sample.fxml</b> <b>Which refer to this FXML file</b> <b>It deals and handle our User Interface </b> <b>then our FX:Controller attribute assigned with the </b> <b>Controller class we choose.</b> <b>Controller class handle the User Interface initialization, </b> <b>events and more</b> <b>This is where the bulk of our code will reside</b> <b>Let's run this and see</b> <b>Here in Build and Run just assign the jdk version you are </b> <b>using.</b> <b>Apply. Run.</b> <b>And we got our first error</b> <b>package javafx.application does not exist</b> <b>This is because we have not added the JAVAFX SDK JARS yet.</b> <b>Normally you setup or config the project before you do </b> <b>anything</b> <b>But this is tutorial, I want to show the errors and share </b> <b>how to handle them.</b> <b>Now, to fix this</b> <b>Go To File > Project Structure...</b> <b>You see here the Project Information and the versions we are</b> <b> using</b> <b>Go To > Modules</b> <b>We can add them here, this is under Dependencies</b> <b>Click Add > Jars or Directories</b> <b>Just locate where you save your JavaFX SDK's</b> <b>in case If you have not downloaded it yet, see Description </b> <b>below for more details</b> <b>Ok now</b> <b>then just select the following JARS. Base. Controls, FXML, </b> <b>and Graphics</b> <b>Open</b> <b>now they are added. Click Apply and see Red ones at the back</b> <b>they are now valid</b> <b>Click Ok</b> <b>If we checked the FXML. it should be valid now too.</b> <b>Good</b> <b>Let's run again</b> <b>We have a new Error</b> <b>JavaFX Runtime components are missing</b> <b>This is because we have not added module-info.java </b> <b>and specify what modules we require and package to open. </b> <b>Let's do that.</b> <b>in Sample > Right Click</b> <b>New</b> <b>module-info.java</b> <b>and here we specify what modules we require</b> <b>controls</b> <b>javafx.fxml</b> <b>and last</b> <b>javafx.graphics</b> <b>these is all we need for now</b> <b>then opens</b> <b>this will allow access to our package Sample </b> <b>sample</b> <b>If you notice, these are the ones we have added in our</b> <b>Project Structure a while ago.</b> <b>the JavaFX SDKs</b> <b>Remember these JARS?</b> <b>Later we will add another</b> <b>for our Database connection</b> <b>but</b> <b>these are all we need for now</b> <b>Ok Let's run again.</b> <b>There you go. It run successfully.</b> <b>Now let's close this up and proceed to the next step.</b> <b>We are now going to Design and Build our login Screen</b> <b>To Start we</b> <b>will utilize what we already have.</b> <b>let's rename this sample.fxml</b> <b>just right Click</b> <b>Refactor</b> <b>Rename...</b> <b>Rename it as login.fxml</b> <b>Refactor</b> <b>Ok, we got it renamed succesfully</b> <b>and make sure that it reflects in the main.java as well.</b> <b>there you go</b> <b>A quick run, just to make sure, all is well.</b> <b>perfect.</b> <b>Close it and we Launch Scene Builder</b> <b>We are going to use this to Design and Build the User </b> <b>Interface of our Login Screen</b> <b>This is a visual layout tool that allow us quickly design </b> <b>User Interfaces</b> <b>In case you don't have it installed yet, see Description for</b> <b> download and install details.</b> <b>Alright</b> <b>From here </b> <b>Click > Open Project</b> <b>then we are going to open the login.fxml from our Project </b> <b>folder</b> <b>so basically whatever we do here generates code directly to </b> <b>login.fxml once we save our work.</b> <b>A quick run down for new users</b> <b>This is our Object Library</b> <b>which they are group accordingly</b> <b>Below here is the Hierarchy, which list out the objects we </b> <b>use, along their layout orders</b> <b>while in this side, we got our Properties, Layout and code </b> <b>related settings</b> <b>Ok now, let's work on our User Interface</b> <b>We start with Deleting this GridPane</b> <b>Replace it with BorderPane</b> <b>just Double-click to add</b> <b>see that below?</b> <b>it shows the sections as well</b> <b>now go to Layout</b> <b>Change the Pref Width to 520</b> <b>Next we need AnchorPane</b> <b>Just Drag it down to BorderPane-Insert Left</b> <b>then another for Insert-Right</b> <b>there you go</b> <b>next adjust the Pref Width and Height of left AnchorPane</b> <b>228 x 407</b> <b>then adjust the right side</b> <b>332x400</b> <b>we are going to utilize the JavaFX CSS</b> <b>click this Style</b> <b>fx-background-color</b> <b>set the color</b> <b>you can put common colors like Red, Blue, White and couple </b> <b>more</b> <b>but for now we will use a HEX code just type</b> <b>#263F73</b> <b>there you go</b> <b>Next we put a Label</b> <b>You can just type it here in the Library. It will show up as</b> <b> search result.</b> <b>Drag it over</b> <b>feel free to design and adjust objects around</b> <b>strecth this label end to end</b> <b>set Alignment as Center</b> <b>change our Font style and size</b> <b>Name it as Pluto</b> <b>set color to White</b> <b>set Effect as Drop Shadow</b> <b>Duplicate this Label</b> <b>'Command Key' + D</b> <b>Rename as 'Planet Nine'</b> <b>Adjust font style and size to your preference</b> <b>next, we utilize Line object</b> <b>feel free to adjust and align it as well to your liking</b> <b>change the color to White</b> <b>Set Effect as DropShadow</b> <b>set Stroke Width to 2</b> <b>then, we utilize Circle object</b> <b>feel free to resize and adjust it to your preferences</b> <b>change the color to light gray</b> <b>Effect as InnerShadow</b> <b>Stroke color shades of Gray</b> <b>Good</b> <b>then add another Circle</b> <b>Re-Arrange the Object Order</b> <b>there you go</b> <b>Set the Fill as Transparent</b> <b>Adjust the stroke color</b> <b>play around it and look for color you want</b> <b>this is just a static Orbit so feel free to adjust </b> <b>accordingly</b> <b>we need another Label, we can just duplicate this one</b> <b>Adjust font style and size</b> <b>Make it smaller</b> <b>and... put 'Copyright (c) 2021. All Rights Reserved.'</b> <b>this is just aesthetic</b> <b>Now it looks better</b> <b>Duplicate another label</b> <b>Put it here</b> <b>set Text as 'Secure Login'</b> <b>change Effect as InnerShadow</b> <b>Adjust the font size </b> <b>then change color</b> <b>good</b> <b>We need another Label</b> <b>call it 'Username'</b> <b>we need to increase the font size</b> <b>make it 14</b> <b>duplicate this label</b> <b>just position and align it with username</b> <b>set text as 'Password'</b> <b>now we are getting close</b> <b>Before we proceed, change Themes to Gluon Mobile Light</b> <b>Go To Preview > Themes > Mobile Light</b> <b>Good</b> <b>then search for TextField</b> <b>Drag it over and align to Username</b> <b>then look for PasswordField</b> <b>Drag it over and align it to Password</b> <b>alright</b> <b>again</b> <b>just adjust size and position to your preference</b> <b>by the way PasswordField is just plain text, it just Mask </b> <b>the display, so the password does not show.</b> <b>next, we look for Button</b> <b>drag it over</b> <b>position it below and adjust size</b> <b>you can name it as Login</b> <b>then change the color to White</b> <b>We will just copy the Anchor Pane color and paste it over</b> <b>Background color</b> <b>then just paste it here</b> <b>there you go</b> <b>Let's duplicate this Button</b> <b>name it as Cancel</b> <b>need some adjustment here</b> <b>let's preview how it looks</b> <b>GO TO Preview > Show Preview In Window</b> <b>there you go</b> <b>Let's test the textfield and passwordfield.</b> <b>as you can see, password field mask the entry by default.</b> <b>that's good. close this</b> <b>One last adjustment, need to give more space in between</b> <b>thats about right</b> <b>adjust the buttons as well</b> <b>good</b> <b>then center them all</b> <b>allright</b> <b>then center them all</b> <b>Save your work.</b> <b>Set the Prompt text as 'Username'</b> <b>then next Prompt text as 'Password'</b> <b>Lets Preview it</b> <b>You can see the Prompt Text were set</b> <b>Close this</b> <b>Save it again.</b> <b>Now we are going to assign FX ID's, it will be utilized in </b> <b>our Controller later.</b> <b>Go to Code</b> <b>I have established my own naming conventions, you may use </b> <b>yours.</b> <b>for example, I name this as UsernameTextField</b> <b>I include Object type for Easy and Readable code purposes</b> <b>It seems long but it will be helpful in the long run</b> <b>next</b> <b>Here our FX ID will be passwordPasswordField</b> <b>Next will be the Buttons</b> <b>we follow same convention, name it as loginButton</b> <b>same thing with Cancel Button</b> <b>cancelButton</b> <b>there you go</b> <b>just a quick review</b> <b>making sure we got FX ID's</b> <b>now we go and assign a Controller</b> <b>as you can see those objects with FX ID's are listed in the</b> <b> Component</b> <b>then we need to assign a controller, that will be </b> <b>sample.Controller</b> <b>if you recall we already have a controller class named </b> <b>Controller </b> <b>under sample package.</b> <b>we are just assigning it</b> <b>Let's save it so the fxml will be updated</b> <b>now let's go back to IntelliJ and see the actual FXML file</b> <b>ok, now lets check login.fxml</b> <b>it have more lines now as we have added alot</b> <b>if you check here, we got the fx:controller assigned.</b> <b>sample.Controller</b> <b>which we apply back here</b> <b>and this is our actual Controller class</b> <b>which we are going to utilized next</b> <b>to work on these objects</b> <b>alright! Now we start coding</b> <b>our first stop is in main.java</b> <b>we need to change the window or Stage size</b> <b>it should match what we have set in the Scene Builder or </b> <b>what is in the fxml</b> <b>Select the BorderPane</b> <b>Go To Layout</b> <b>Copy the Pref Width and Height</b> <b>then change the values here</b> <b>which is b520 x 400</b> <b>Let's run it and see</b> <b>there you go, all looks good</b> <b>we are going to change the color later</b> <b>right now, this is just a screen, with objects but no action</b> <b> or events</b> <b>Next, we are going to remove this Title Bar</b> <b>and then add action event for the cancel button to close the</b> <b> Login window.</b> <b>so we have a way to exit</b> <b>go to Controller</b> <b>we are going to use Cancel button in our FXML.</b> <b>so we need to annotate @FXML</b> <b>and if you notice IntelliJ automatically add an import here,</b> <b> but you can type it too.</b> <b>then private Button</b> <b>cancelButton</b> <b>Button is on red because we have not imported the Button </b> <b>class yet </b> <b>You can click Import Class here but if you are new or a </b> <b>beginner</b> <b>I really suggest, type it down so you become familiar.</b> <b>alright</b> <b>ok, it is now added</b> <b>again, this cancelButton is the FX ID of the Cancel button </b> <b>in our FXML.</b> <b>this one in Scene Builder</b> <b>this one if viewed as fxml</b> <b>Now we will create an action event method and call it </b> <b>cancelButtonOnAction </b> <b>Stage stage</b> <b>again you need to import the Stage Class</b> <b>I always recommend to manually type it out until you become </b> <b>so familiar.</b> <b>we will determine which Stage the cancelButton is</b> <b>then assign it to 'stage' variable</b> <b>and stage.close</b> <b>this should do it</b> <b>next we will assign this Action Event method in Scene </b> <b>Builder</b> <b>Select Cancel button</b> <b>then here in On Action, assign cancelButtonOnAction method.</b> <b>there you go</b> <b>so when Cancel button is click, On Action event</b> <b>will run this method</b> <b>this one</b> <b>save it</b> <b>if you checked the login fxml</b> <b>you will see the method in OnAction</b> <b>there you go</b> <b>ok, now we can run and test it out</b> <b>good</b> <b>click Cancel to close</b> <b>Good, it works as expected</b> <b>since we have a way to close within our Login screen</b> <b>we can now remove the title bar</b> <b>close this and proceed to main.java</b> <b>it is just a one liner, you just need to set Stagestyle to </b> <b>UNDECORATED.</b> <b>we just comment out the title, it is not needed anymore</b> <b>Let's run and check</b> <b>there you go</b> <b>let's see it with different background.</b> <b>alright, this is how it looks when it run as an app</b> <b>ok, lets segway here quickly</b> <b>as mentioned earlier, I will change the color</b> <b>to do that</b> <b>we just need to change the Left Achor pane and 2 buttons</b> <b>just copy the color</b> <b>looks good</b> <b>save it</b> <b>and now</b> <b>Preview</b> <b>alright</b> <b>close it up</b> <b>before we go back to IntelliJ, we will add a new label</b> <b>this will serve as sort of notification or warning depending</b> <b> on scenario</b> <b>Preview it</b> <b>looks good</b> <b>Now we need to make it a blank text by default</b> <b>A message will only appear depending on scenario</b> <b>assign an FX ID so we can use it</b> <b>ignore that warning</b> <b>save it</b> <b>check the component list</b> <b>there it is</b> <b>now back to IntelliJ</b> <b>here, we are going to annotate and declare the loginMessage </b> <b>label as well</b> <b>import the Label class</b> <b>good</b> <b>now we will create another action event method for login </b> <b>button</b> <b>let's test first the loginmessage label, make sure it is </b> <b>working along with the login button action event</b> <b>loginmessagelabel.setText</b> <b>let say "you try to login"</b> <b>now we go back to Scene Builder</b> <b>and assign the new method to Login button</b> <b>there</b> <b>save it</b> <b>switchback to IntelliJ</b> <b>and run it</b> <b>click Login button</b> <b>there you go, we got it</b> <b>I guess by now you noticed, i keep running every now and </b> <b>then</b> <b>it's because it helps you narrow the area and scope of </b> <b>possible errors</b> <b>let me adjust the login message a little bit</b> <b>save it</b> <b>run</b> <b>good</b> <b>now we are going to add a simple user input validation</b> <b>where we make sure that username and password are not blank.</b> <b>we need to import first a textfield and passwordfield class</b> <b>javafx</b> <b>PasswordFieldd</b> <b>they are in Gray, it means they were not use anywhere yet</b> <b>then here we annotate and declare our usernameTextfield and </b> <b>passwordPasswordfield</b> <b>we are going to put in place a simple user input validation </b> <b>using IF Condition</b> <b>where we ensure Username and Password are not blank </b> <b>so this will be usernameTextField</b> <b>usernameTextField</b> <b>getText()</b> <b>.isBlank()</b> <b>equals False</b> <b>and</b> <b>passwordPasswordField</b> <b>.getText()</b> <b>.isBlank()</b> <b>equals</b> <b>false</b> <b>then if it is true, then we put something here.</b> <b>let's move loginMessageLabel here</b> <b>allright</b> <b>then we copy here another loginMessageLabel and say</b> <b>Please enter Username and Password</b> <b>let's do a test run</b> <b>we will click Login button without any inputs</b> <b>ok we got our message in Red</b> <b>now let's try to put something and try to login</b> <b>and there you are, we got a new Message.</b> <b>close this</b> <b>We are now going to MySQL to create</b> <b>our table and insert sample data that we can use for our </b> <b>Login.</b> <b>Select the Database you want</b> <b>make it your default</b> <b>then Create a new table</b> <b>We just need here a primary key, firstname, lastname, </b> <b>username and password field</b> <b>you may use your own naming conventions on fieldnames</b> <b>set Constraints on them like not null or NN if you want</b> <b>especially for username set it unique or UQ as you dont want</b> <b> duplicate here</b> <b>there should only one username</b> <b>per account</b> <b>click Apply </b> <b>alright</b> <b>review it then Click Apply</b> <b>and Close</b> <b>Let's check our table</b> <b>it was created successfully</b> <b>it has the fields we need</b> <b>create a query so we can check the table</b> <b>SELECT * FROM UserAccounts</b> <b>ok</b> <b>then execute this</b> <b>as you can see we don't have any data yet</b> <b>we just need 2 records for now</b> <b>now let's Insert data that we can use for testing</b> <b>just change this to any appropriate test data you want</b> <b>you can copy this INSERT statement</b> <b>and you can change the data if you want</b> <b>then execute this INSERT</b> <b>there you go</b> <b>one row inserted</b> <b>we need one more</b> <b>just copy and change the data</b> <b>then execute this INSERT</b> <b>alright, we now have two Records in our UserAccounts table</b> <b>this is good to go, lets go the next step</b> <b>we are going to create a new class</b> <b>here in "sample" package</b> <b>Right Click > New</b> <b>java class</b> <b>Name it DatabaseConnection.java</b> <b>We will use this to establish a JDBC connection</b> <b>first lets import java.sql</b> <b>and it on error</b> <b>because we need to add this in our module-info.java before </b> <b>we can import</b> <b>and if you recall</b> <b>when we initially</b> <b>created our module-info.java</b> <b>i mentioned that</b> <b>we will going to add another</b> <b>and this is part of it</b> <b>then we go back to DatabaseConnection.java</b> <b>and we import java.sql.Connection</b> <b>alright</b> <b>import java.sql.DriverManager</b> <b>in here we create a public connection variable</b> <b>we are going to use this later as our return value</b> <b>create a new method, let's call it getConnection</b> <b>There are couple of ways to code your connection.</b> <b>You have couple of options when it comes to connection</b> <b>let's start with database name</b> <b>String databaseName</b> <b>let's make it empty string for now</b> <b>for this tutorial I will use the most basic.</b> <b>You can make and follow your own standard and conventions</b> <b>I always prefer to have a simple and readable code</b> <b>next database user</b> <b>and put it as blank as well this is the one you use as your </b> <b>database login</b> <b>when you login to your MySQL</b> <b>then of course database password</b> <b>and make it blank as well</b> <b>all empty, we are going to fill in them later</b> <b>next is the URL string, it will holds the address that </b> <b>points to our database we specify</b> <b>you can just follow this</b> <b>jdbc</b> <b>mysql</b> <b>localhost</b> <b>+ databaseName</b> <b>we need to put a try and catch here</b> <b>i prefer to complete the syntax to avoid missing braces</b> <b>we need a printStackTrace</b> <b>ok this is all we need for now</b> <b>then Class.forname, we will register and load the Driver </b> <b>class to memory</b> <b>and com.mysql.cj.jdbc.Driver</b> <b>next establish our Connection</b> <b>DatabaseLink = DriverManager.</b> <b>getConnection</b> <b>we will get our values from here</b> <b>we will pass these variables as arguments</b> <b>url</b> <b>databaseUser</b> <b>and databasePassword</b> <b>there are couple ways to established a connection however</b> <b>i prefer something readable</b> <b>now we will return databaseLink that is our return value</b> <b>again, you need to put an actual values here before you run</b> <b>don't forget that</b> <b>and this is what you use to login in MySQL and database</b> <b>where your user table is present.</b> <b>for example in my case the databasename</b> <b>is pocBase</b> <b>and will just fill up with username and password</b> <b>Let's go to Controller</b> <b>and we are going to expand this code</b> <b>If a user input pass this validation</b> <b>then we will connect to the database and validate the </b> <b>username and password.</b> <b>however instead of having all the codes here</b> <b>we will create a new method instead. </b> <b>that way, it helps our code to be in a manageable level.</b> <b>it is not a hard rule per se, it is just personal best </b> <b>practices I do</b> <b>feel free to do what you prefer</b> <b>because... when you have your own personal standard</b> <b>it will be easier to navigate to all your codes</b> <b>whether it is present, older or from previous years</b> <b>so long you follow the same practice it will be easier for </b> <b>you</b> <b>alright! Now</b> <b>create a new method</b> <b>public void </b> <b>this is a new method</b> <b>call it validate login</b> <b>copy this over here</b> <b>this will call the method</b> <b>comment it out, we don't need this here</b> <b>First we will create a new instance of our </b> <b>DatabaseConnection</b> <b>DatabaseConnection</b> <b>call it connectNow</b> <b>equals</b> <b>New DatabaseConnection</b> <b>and</b> <b>Connection</b> <b>We need to import Connection class too</b> <b>import java.sql.Connection</b> <b>and here connectDB</b> <b>connectNow</b> <b>getConnection</b> <b>this is simply the new instance of our DatabaseConnection </b> <b>class</b> <b>connectNow is using the only method we created for it</b> <b>if you recall we create this one</b> <b>getConnection()</b> <b>then we build our SQL query to fetch the data</b> <b>my suggestion is build the query in MySQL workbench</b> <b>that way you can test it as well. it will reduce possible </b> <b>error vectors in your code.</b> <b>and this is a very simple query</b> <b>SELECT count(1) FROM UserAccounts WHERE username = ''</b> <b>say Neo</b> <b>and Password = </b> <b>'kungfu'</b> <b>run it</b> <b>there you go, you got 0, it means, no matching result.</b> <b>this is because 'Neo' is a Firstname and not a username</b> <b>matrix is the actual username for this record</b> <b>change it</b> <b>run it again</b> <b>there you go, you got 1. It means a matching record has been</b> <b> found.</b> <b>copy this</b> <b>and paste it over here</b> <b>then we just need to tweak this a little bit</b> <b>we will replace the hardcoded value by UsernameTextfield and</b> <b> passwordPasswordField</b> <b>ensure that we preserved the single quotes</b> <b>we need that in our concatenation</b> <b>then + for String Concatenations</b> <b>and here</b> <b>and now replace this with what we have</b> <b>so this way, whatever user input in the username and </b> <b>password will be pass over to our SQLQuery</b> <b>and this passwordPasswordField</b> <b>to here</b> <b>semicolon, don't forget that</b> <b>next we need to implement TRY and Catch here</b> <b>Statement</b> <b>alright we need to import it as well</b> <b>see that here?</b> <b>statement = connectDB.createStatement();</b> <b>here, we are using the connection we declare</b> <b>then we need ResultSet that will handle the query result</b> <b>need to import it first also</b> <b>import class there you go</b> <b>queryResult = statement.executeQuery()</b> <b>use verifyLogin here</b> <b>it just simply execute a query similar to what we did here</b> <b>now we just need to process the query result</b> <b>Using WHILE statement</b> <b>queryResult.next()</b> <b>we just loop around the query result</b> <b>though for this case, we only expect 1 return row</b> <b>now we just need to simply check</b> <b>if we got 1 or 0.</b> <b>queryResult.getInt</b> <b>and</b> <b>columnindex 1.</b> <b>what we are doing is we just want to get the actual value of</b> <b> the first field. </b> <b>it so happen that we only have 1 field but if you have more,</b> <b> you can specify what field you want base on their numeric </b> <b>order</b> <b>base on our constraint we are saying that</b> <b>there should be only one unique username</b> <b>the actual value is the query result here</b> <b>and in our case it is just between 1 and 0</b> <b>either there is a matching record or none</b> <b>if the result is 1 then we will say</b> <b>loginMessageLabel.setText()</b> <b>Welcome!</b> <b>but</b> <b>if it does not match, if it is zero</b> <b>then it say loginMessagelabel.setText()</b> <b> "Invalid Login. Please Try again"</b> <b>and here </b> <b>e.printStackTrace();</b> <b>again</b> <b>make sure you put the Database Credentials before you run.</b> <b>and also as I mentioned we have one more SDK to add.</b> <b>but I want to run this and show you another common error we </b> <b>get</b> <b>run it</b> <b>pur a username and password</b> <b>login</b> <b>there goes the error</b> <b>if you scroll up, you will see the actual erorr</b> <b>it says we have error in our createStatement because our </b> <b>ConnectDB is null</b> <b>it simply telling us that it was not able to create a valid </b> <b>connection to the database hence a Null</b> <b>there are many possible reasons why... but in our</b> <b>we simply did not add MySQL j connector SDK yet</b> <b>so we know that is the cause</b> <b>Go To File > Project Strucutre... > Modules</b> <b>then add mysql connector JAR. it should be in the folder </b> <b>where you download it.</b> <b>See Description on how to Download if you have not done it </b> <b>yet.</b> <b>ok let's run it again.</b> <b>alright, let's try with negative test</b> <b>let's try an invalid login first</b> <b>Neo</b> <b>and this one Login</b> <b>there you go, we got the Invalid Login Message</b> <b>means that we dont have any matching record</b> <b>we don't have any user called Neo</b> <b>now let's try to login with a valid account</b> <b>Login</b> <b>perfect! we successully login</b> <b>So there you have it. A login Screen that connects to MySQL </b> <b>database to validate a user account.</b> <b>again this is just a basic tutorial</b> <b>there are other ways to do this</b> <b>in your future project I recommend</b> <b>you setup your project first</b> <b>you Design then Code and test</b> <b>Thank you for watching. Hope you learn something.</b>
Info
Channel: tookootek
Views: 3,916
Rating: undefined out of 5
Keywords: JavaFX, javafx tutorial, javafx tutorial for beginners, javafx scene builder, javafx intellij, javafx project, javafx gui, java, java tutorial, java tutorial for beginners, Java login, JavaFX project, javafx login within database mysql, javafx mysql, javafx user registration, java jdbc connection, java mysql, Java database, javafx database, javafx table, java programming, javafx control javafx, javafx scene builder tutorial, javafx login screen, gui, login form
Id: J0IE5LRyzx8
Channel Id: undefined
Length: 35min 42sec (2142 seconds)
Published: Sat May 15 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.