0% found this document useful (0 votes)
12 views

165 Java Record Ex13

Uploaded by

ramesh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views

165 Java Record Ex13

Uploaded by

ramesh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 8

CS22409-JAVA PROGRAMMING LABORATORY

EX.NO: 13
DATE:
STUDENT MANAGEMENT APP

QUESTION:
Develop Student management application using JavaFX controls, layouts and menus

AIM:
To develop a Student management application using JavaFX controls, layouts
and menus

ALGORITHM:
1. Initialization:
1.1. Initialize the GUI components including labels, text fields, buttons, and
table view.
1.2. Set up event handlers for button clicks (e.g., Add New, Update,
Delete, Logout).
2. Add New Student:
2.1. When the "+ Add New Student" button is clicked, open the "add_student"
form. 2.2.Allow the user to input student details including name, age, grade, and
city.
2.3. Validate the input fields to ensure they are not empty.
2.4. If all fields are filled, add the new student details to the
database. 2.5.Display a success message if the student is added
successfully.
2.6.Reset the input fields for the next entry.
3. Update Student Details:
3.1. When a row in the table view is selected and the "Update" button is
clicked, populate the "student_detail-form" with the selected student's
information.
3.2. Allow the user to edit the student details.
3.3.Validate the input fields to ensure they are not
empty.
3.4.If all fields are filled, update the student details in the database.
3.5.Display a success message if the update is successful.
3.6.Refresh the table view to reflect the changes.
4. Delete Student:
4.1. When a row in the table view is selected and the "Delete" button is
clicked, prompt the user for confirmation.
4.2. If the user confirms, delete the selected student's details from the
database. 4.3.Display a success message if the deletion is successful.
4.4.Refresh the table view to reflect the changes.
5. View Student Details:
5.1. Populate the table view with existing student details from the database
upon application startup.
5.2. Display student details including ID, user ID, name, age, grade, and city.
6. Logout:

Roll No: Page No:


6.1. When the "Logout" button is clicked, log the user out of the
system. 6.2.Close the current window or return to the login screen.

Roll No: Page No:


PROGRAM:

#student_detail-form

<?xml version="1.0" encoding="UTF-8"?>


<?import javafx.scene.Cursor?>
<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.TableColumn?>
<?import javafx.scene.control.TableView?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.effect.Blend?>
<?import javafx.scene.image.Image?>
<?import javafx.scene.image.ImageView?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.text.Font?>
<AnchorPane fx:id="root" prefHeight="783.0" prefWidth="864.0" style="-
fx- background-color: #FDFEFE;" xmlns="http://javafx.com/javafx/16"
xmlns:fx="http://javafx.com/fxml/1"
fx:controller="controller.StudentDetailsFormController">
<children>
<Label layoutX="33.0" layoutY="17.0" prefHeight="59.0" prefWidth="363.0"
text="Student Details Form " textAlignment="CENTER" textFill="#0d0d0d">
<font>
<Font name="System Bold" size="32.0" />
</font>
</Label>
<Label fx:id="lblSmsWelcome" layoutX="32.0" layoutY="73.0" text="Hi
Ushan Welcome to the Student Management System" textFill="#0d0d0d">
<font>
<Font name="System Bold" size="15.0" />
</font></Label>
<Label fx:id="lblSmsId" layoutX="122.0" layoutY="105.0"
text="Id" textFill="#0d0d0d">
<font>
<Font name="System Bold" size="18.0" />
</font></Label>
<Button layoutX="628.0" layoutY="67.0" mnemonicParsing="false"
onAction="#btnSmsAddNewStudent" prefHeight="38.0" prefWidth="202.0"
style="- fx-background-color: green;" text="+ Add New Student"
textFill="WHITE">
<font>
<Font name="System Bold" size="16.0" />
</font>
<cursor>
<Cursor fx:constant="HAND" />
</cursor>

Roll No: Page No:


<effect>
<Blend mode="RED" />
</effect>
</Button>
<Button layoutX="627.0" layoutY="19.0" mnemonicParsing="false"
onAction="#btnLogOutOnAction" prefHeight="38.0" prefWidth="202.0" style="-
fx- background-color: red;" text="Log Out" textFill="WHITE">
<font>
<Font name="System Bold" size="16.0" />
</font></Button>
<TableView fx:id="tblViewStudentDetails" layoutX="34.0"
layoutY="149.0" prefHeight="398.0" prefWidth="798.0">
<columns>
<TableColumn prefWidth="89.60003662109375" text="ID" />
<TableColumn prefWidth="97.5999755859375" text="User_ID" />
<TableColumn prefWidth="228.0" text="Name" />
<TableColumn prefWidth="108.79998779296875" text="Age" />
<TableColumn prefWidth="104.800048828125" text="Grade" />
<TableColumn prefWidth="168.00006103515625" text="City" />
</columns>
</TableView>
<ImageView fitHeight="81.0" fitWidth="124.0" layoutX="17.0" layoutY="681.0"
pickOnBounds="true" preserveRatio="true">
<image>
<Image url="@../images/logo.png" />
</image>
</ImageView>
<TextField fx:id="txtName" layoutX="517.0" layoutY="570.0" prefHeight="38.0"
prefWidth="316.0">
<font>
<Font name="System Italic" size="16.0" />
</font></TextField>
<TextField fx:id="txtAge" layoutX="517.0" layoutY="618.0"
prefHeight="38.0" prefWidth="316.0">
<font>
<Font name="System Italic" size="16.0" />
</font></TextField>
<TextField fx:id="txtGrade" layoutX="517.0" layoutY="665.0" prefHeight="38.0"
prefWidth="316.0">
<font>
<Font name="System Italic" size="16.0" />
</font></TextField>
<TextField fx:id="txtCity" layoutX="517.0" layoutY="714.0"
prefHeight="38.0" prefWidth="316.0">
<font>
<Font name="System Italic" size="16.0" />
</font></TextField>

Roll No: Page No:


<Button fx:id="btnUpdate" layoutX="214.0" layoutY="645.0"
mnemonicParsing="false" onAction="#btnUpdateOnAction"
prefHeight="20.0" prefWidth="202.0" style="-fx-background-color: Green;"
text="Update" textFill="WHITE">
<font>
<Font name="System Bold" size="16.0" />
</font></Button>
<Button fx:id="btnDelete" layoutX="214.0" layoutY="694.0"
mnemonicParsing="false" onAction="#btnDeleteOnAction"
prefHeight="26.0" prefWidth="202.0" style="-fx-background-color: red;"
text="Delete" textFill="WHITE">
<font>
<Font name="System Bold" size="16.0" />
</font></Button>
<Label fx:id="lblStudentId" layoutX="324.0" layoutY="581.0" text=".">
<font>
<Font name="System Bold" size="16.0" />
</font></Label>
<Label layoutX="33.0" layoutY="104.0" prefHeight="27.0" prefWidth="88.0"
text="User Id :: ">
<font>
<Font name="System Bold" size="18.0" />
</font>
</Label>
<Label layoutX="456.0" layoutY="576.0" text="Name">
<font>
<Font name="System Bold" size="16.0" />
</font>
</Label>
<Label layoutX="463.0" layoutY="624.0" text="Age">
<font>
<Font name="System Bold" size="16.0" />
</font>
</Label>
<Label layoutX="455.0" layoutY="671.0" text="Grade">
<font>
<Font name="System Bold" size="16.0" />
</font>
</Label>
<Label layoutX="463.0" layoutY="720.0" text="City">
<font>
<Font name="System Bold" size="16.0" />
</font>
</Label>
<Label layoutX="214.0" layoutY="580.0" text="Student Id">
<font>
<Font name="System Bold" size="19.0" />
</font>

Roll No: Page No:


</Label>
</children>
</AnchorPane>

#add_student

<?xml version="1.0" encoding="UTF-8"?>


<?import javafx.scene.control.Button?>
<?import javafx.scene.control.Label?>
<?import javafx.scene.control.TextField?>
<?import javafx.scene.layout.AnchorPane?>
<?import javafx.scene.text.Font?>
<AnchorPane fx:id="root" prefHeight="601.0" prefWidth="510.0" style="-
fx- background-color: #FDFEFE;" xmlns="http://javafx.com/javafx/16"
xmlns:fx="http://javafx.com/fxml/1"
fx:controller="controller.AddStudentController">
<children>
<Label layoutX="36.0" layoutY="32.0" text="Add New
Student" textAlignment="CENTER">
<font>
<Font name="System Bold" size="29.0" />
</font></Label>
<Button layoutX="340.0" layoutY="41.0" mnemonicParsing="false"
onAction="#btnOnActionAddNew" prefHeight="40.0" prefWidth="138.0" style="-
fx- background-color: #6C3483;" text="+ Add New" textFill="WHITE">
<font>
<Font name="System Bold" size="16.0" />
</font></Button>
<Label layoutX="37.0" layoutY="140.0" text="Student Name">
<font>
<Font name="System Bold Italic" size="18.0" />
</font></Label>
<Label layoutX="37.0" layoutY="231.0" text="Student Age">
<font>
<Font name="System Bold Italic" size="18.0" />
</font></Label>
<Label layoutX="37.0" layoutY="311.0" text="Student Grade">
<font>
<Font name="System Bold Italic" size="18.0" />
</font></Label>
<Label layoutX="42.0" layoutY="395.0" text="Student City">
<font>
<Font name="System Bold Italic" size="18.0" />
</font></Label>
<TextField fx:id="txtStudentName" layoutX="38.0"
layoutY="177.0" prefHeight="43.0" prefWidth="424.0">
<font>
<Font name="System Italic" size="18.0" />

Roll No: Page No:


</font></TextField>
<TextField fx:id="txtStudentAge" layoutX="38.0"
layoutY="259.0" prefHeight="43.0" prefWidth="424.0">
<font>
<Font name="System Italic" size="18.0" />
</font></TextField>
<TextField fx:id="txtStudentGrade" layoutX="42.0"
layoutY="340.0" prefHeight="43.0" prefWidth="424.0">
<font>
<Font name="System Italic" size="18.0" />
</font></TextField>
<TextField fx:id="txtStudentCity" layoutX="44.0"
layoutY="422.0" prefHeight="43.0" prefWidth="424.0">
<font>
<Font name="System Italic" size="18.0" />
</font></TextField>
<Button fx:id="btnAddStudent" layoutX="81.0" layoutY="501.0"
mnemonicParsing="false" onAction="#btnOnActionAdd"
prefHeight="43.0" prefWidth="163.0" style="-fx-background-color:
#6C3483;" text="Add " textFill="WHITE">
<font>
<Font name="System Bold" size="18.0" />
</font></Button>
<Label fx:id="lblStudentId" layoutX="134.0" layoutY="81.0" text="Student Id">
<font>
<Font name="System Bold Italic" size="16.0" />
</font></Label>
<Button layoutX="278.0" layoutY="501.0" mnemonicParsing="false"
onAction="#btnBackOnAction" prefHeight="43.0" prefWidth="163.0" style="-
fx- background-color: #6C3483;" text="Back" textFill="WHITE">
<font>
<Font name="System Bold" size="18.0" />
</font>
</Button>
<Label fx:id="lblCheckText" layoutX="184.0" layoutY="472.0" text="Text
Field Connot be Empty" textFill="RED">
<font>
<Font name="System Bold" size="12.0" />
</font>
</Label>
<Label layoutX="38.0" layoutY="81.0" text="Student ID :">
<font>
<Font name="System Bold" size="16.0" />
</font>
</Label>
</children>
</AnchorPane>

Roll No: Page No:


SAMPLE INPUT AND OUTPUT:

RESULT:
Thus the program to develop a Student management application using
JavaFX controls, layouts and menus, has been executed successfully.

Roll No: Page No:

You might also like