School System File
School System File
School System File
PRACTICES
A PROJECT ON
“SCHOOL SYSTEM”
Date : Date :
ID – SHEET
Roll No : ………………………….
Address : Anisabad,
Patna
Phone No : 7979007905
Sarthak
TABLE OF CONTENTS
Introduction
Java Details
Priliminary Design
Form Layouts
Database Design
Implementation
Bibliography
Teacher Remarks
INTRODUCTION
project.
What is java?
Java is a general purpose object oriented programming language . It is the first programming
language that is not tied to any particular hardware or operating system .The language is
based on the concept of an object. Java is highly derived from C++ . Most striking feature of
the language is that it is platform neutral language.
There were five primary goals in the creation of the Java language:
Java tools
In order to write java application or applets ,one need more than a language . The tools that
lets one to write , test , debug programs.
Java features
● Compiler and Interpreted
● Platform independent
● Simple
● Secure
● Familiar
● Portable
● Object-Oriented
● Robust
● Multithreaded
● High performance
● Distributed
● Dynamic
Compiler and Interpreted -There is a java compiler , named javac . The java compiler
takes input source code files (these files typically have the ext.java) and converts them into
compiled bytecode files.The java Interpreter known as javac can be used to execute java
application .The interpreter translates bytecode directly into program actions.
Platform independent- Java programs can be easily moved from one computer to
another, anywhere and anytime.Changes and upgradesmade in operatingsystems,
processors and system resources will not force any changes in java programs.
Simple - Java is designed to be easy for programmer to learn and use efficiently.
Secure- When we use a java compatible web browser, we can safely download java applets
without fear of virus infection. Java achieves this protection by confining a java program to
java execution environment and not allowing it access to other parts of the computer.
Familiar- It is modeled on C, C++ languages. Java code looks like C++.
Portable- Java compiler generates bytecode instructions that can be implemented on any
machine and also the size of the primitive data types are machine independent.
Object-Oriented - Java is a true object-oriented language. All program code and data
reside within objects and classes.
Robust -It provides many safeguards to ensure reliable code. It has strict compile time and
run time checking for data types. Designed as a garbage-collected language relieving the
programmers and also incorpates the concept of exception handling which captures series
errors.
Distributed- It has ability to share both data and programs. Java applications can open and
access remote objects on internet which enables multiple programmers at multiple remote
locations to collaborate and work together on single project.
Dynamic - Java is capable of dynamically in new class libraries , methods and objects .It
supports functions written in other languages like C,C++ called as native methods.
Automatic garbage collection -One idea behind Java's automatic memory management
model is that programmers should be spared the burden of having to perform manual
memory management. In some languages the programmer allocates memory to create any
object stored on the heap and is responsible for later manually deallocating that memory to
delete any such objects. If a programmer forgets to de-allocate memory or writes code that
fails to do so in a timely fashion, a memory leak can occur: the program will consume a
potentially arbitrarily large amount of memory. In addition, if a region of memory is de-
allocated twice, the program can become unstable and may crash.
In Java, this potential problem is avoided by automatic garbage collection. The programmer
determines when objects are created and the Java runtime is responsible for managing the
objects' lifecycle. The program or other objects can reference an object by holding a
reference to it (which, from a low-level point of view, is its address on the heap). When no
references to an object remain, the Java garbage collector automatically deletes the
unreachable object, freeing memory and preventing a memory leak. Memory leaks may still
occur if a programmer's code holds a reference to an object that is no longer needed—in
other words, they can still occur but at higher conceptual levels.
Comparing Java and C++, it is possible in C++ to implement similar functionality (for
example, a memory management model for specific classes can be designed in C++ to
improve speed and lower memory fragmentation considerably), with the possibly cost of
extra development time and some application complexity. In Java, garbage collection is built
in and virtually invisible to the developer. That is, developers may have no notion of when
garbage collection will take place as it may not necessarily correlate with any actions being
explicitly performed by the code they write. Depending on intended application, this can be
beneficial or disadvantageous: the programmer is freed from performing low-level tasks but
at the same time lose the option of writing lower level code.
Objects and Classes -An object is a software bundle of variables and related methods.
Objects are key to understanding object-oriented technology. Real-world objects share two
characteristics: They all have state and behavior.
Software objects are modeled after real-world objects in that they too have state and
behaviorClasses can also define class variables. A class variable contains information that is
shared by all instances of the class .A class can also declare class methods. You can invoke a
class method directly from the class, whereas you must invoke instance methods on a
particular instance.
Polymorphism - This means the ability to take more than one form. An operation may
exhibit different behaviour in different instances. The behaviour depends upon the types of
data used in the operation. It plays an important role in allowing objects having different
internal structures to share external interface.
The Java Database Connectivity (JDBC) API is the industry standard for database-
independent connectivity between the Java programming language and a wide range of
databases – SQL databases and other tabular data sources, such as spreadsheets or flat files.
The JDBC API provides a call-level API for SQL-based database access.
JDBC technology allows you to use the Java programming language to exploit "Write Once,
Run Anywhere" capabilities for applications that require access to enterprise data. With a
JDBC technology-enabled driver, you can connect all corporate data even in a
heterogeneous environment.
Driver
Database
Database
The JDBC architecture is based on a collection of java interfaces and classes that together enable you
to connect to data sources , to create and execute SQL statements and to retrieve and modify data in
a database.
The JDBC-ODBC Bridge –“sun.jdbc.odbc.jdbcodbcDriver”-is included with JDK and it enables Java
applications to access data through drivers written to the ODBC standard. The driver bridge is useful
for accessing data in data sources for which no pure JDBC drivers exist. The bridge works by
translating the JDBC methods into ODBC function calls.
● Data Defination Language (DDL) – DDL statements are used to describe the tables
and the data they contain. The subset of SQL statements used for modeling the structure
(rather than the contents) of a database or cube. The DDL gives you the ability to create,
modify, and remove databases and database objects.
● Data Manipulation Language (DML) – DML statements that are used to operate on
data in the database. These are statements that allow you to create or alter objects (such as
tables, indexes, views, and so on) in the database. The subset of SQL statements used to
retrieve and manipulate data. DML can be further divided into 2 groups:-
SELECT - SQL statement used to request a selection, projection, join, query, and so on,
from a SQL Server database.
Primary key – Primary key constraints identify the column or set of columns whose values
uniquely identify a row in a table. No two rows in a table can have the same primary key
value. You cannot enter a NULL value for any column in a primary key.
Insert- The Insert logical operator inserts each row from its input into the object specified
in the Argument column. To insert the data into a relation we either specify a tuple to be
inserted or write a query.
Delete- The Delete logical operator deletes from an object rows that satisfy the optional
predicate in the Argument column. We can delete only whole tuples; we cannot delete
values on only particular attributes.
Update- The Update logical operator updates each row from its input in the object
specified in the Argument column. It provides a way of modifying existing data in a table.
SWING
SWING is a set of classes that provides powerful and flexible functionality. In addition with
several components provided by AWT, swing supplies several exciting additions, including
tabbed panes, scroll panes, trees and tables. It also changes the images as the state of any
component changes. Swing is built upon the foundation of the AWT. Swing components are
written entirely in Java and therefore are Platform-independent .Swing is also termed also
light-weight and provide pluggable look and feel.
There are 2 Swing classes that are quite important:
Jframe and Component – Jframe extends the AWT class Frame. It contains additional
features that enable it to support Swing components. JComponent extends the AWT
component and Container classes. It is the top level class for all Swing components and
provides Swing pluggable look and feel.
Here are some of the Swing component classes:
CLASS DESCRIPTION
Abstract Button Abstract super class for Swing buttons.
Button Group Encapsulates a mutually exclusive set of
buttons.
Image Icon Encapsulates an icon.
JApplet The SWING version of APPLET.
JButton The SWING push button class.
JCheckBox The SWING check box class.
JComboBox Encapsulates a combo box .
JLabels The SWING version of a label.
JRadioButton The SWING version of a radio button.
JScrollPane Encapsulates a scrollable window.
JTabbedPane Encapsulates a tabbed window.
JTextField The SWING version of Text field.
JTree Encapsulates a tree based-control.
● Icons – Icons are encapsulated by the Image Icon class, which paints an icon from an
image.
● JLabel – Labels are the instances of the JLabel class which extends JComponent. It can
display text or icon. These are passive controls that do not support any interaction with the
user.
● JButton – JButton class provides the functionality of a push button. JButton allows an
icon of string to be associated with the push button.
● JComboBox– It is provided through the JComboBox class. It normally displays one entry
and can also display a drop down list that allows a user to select a different entry.
● JScrollPane– It is a component that presents a rectangular area in which a component
may be viewed. These are implemented in Swing by JScrollPane class.
● JTree - It is a component that presents a hierarchical view of data. A user has ability to
expand individual subtrees. These are implemented in Swing by JTree class.
1. It provides more powerful and more flexible components possible in AWT package.
For e.g. JButton can have both image as well as text field associated with it which is
not possible in awt package.
3. Further the Swing components can provide pluggable look and feel, which means
that it is easy to substitute another appearance and behavior for an element.
PRELIMINARY
DESIGN
(User Interface)
FORM LAYOUTS
DATABASE
DESIGN
IMPLEMENTATION
LOGIN
setBounds(new java.awt.Rectangle(80, 60, 0,
0));
package Student; setCursor(new
import java.sql.*; java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSO
import javax.swing.JOptionPane; R));
.addGroup(layout.createParallelGroup(javax.swing bindingGroup.bind();
.GroupLayout.Alignment.LEADING, false)
.addComponent(jPasswordField1) java.awt.Dimension screenSize =
.addComponent(jTextField1, java.awt.Toolkit.getDefaultToolkit().getScreenSize(
javax.swing.GroupLayout.PREFERRED_SIZE, 180, );
javax.swing.GroupLayout.PREFERRED_SIZE)) setBounds((screenSize.width-595)/2,
.addGap(105, 105, 105)) (screenSize.height-367)/2, 595, 367);
.addGroup(layout.createSequentialGroup() }// </editor-fold>
.addGap(178, 178, 178)
.addComponent(jButton1, private void
javax.swing.GroupLayout.PREFERRED_SIZE, 233, jButton1ActionPerformed(java.awt.event.ActionEv
javax.swing.GroupLayout.PREFERRED_SIZE) ent evt) {
.addContainerGap(168,
Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup() try{
.addContainerGap() int flag=0;
.addComponent(jLabel4, String sql="Select * from login;";
javax.swing.GroupLayout.PREFERRED_SIZE, 559, smt1=con.createStatement();
javax.swing.GroupLayout.PREFERRED_SIZE) rs=smt1.executeQuery(sql);
String log=jTextField1.getText();
String pass =new }
String(jPasswordField1.getPassword()); } catch (ClassNotFoundException ex) {
while(rs.next()) {
if(log.equals(rs.getString(1)) && java.util.logging.Logger.getLogger(login.class.getN
pass.equals(rs.getString(2))) { ame()).log(java.util.logging.Level.SEVERE, null, ex);
flag=1; } catch (InstantiationException ex) {
break;
} java.util.logging.Logger.getLogger(login.class.getN
} ame()).log(java.util.logging.Level.SEVERE, null, ex);
if(flag==1) { } catch (IllegalAccessException ex) {
new menu ().setVisible(true);
dispose(); java.util.logging.Logger.getLogger(login.class.getN
} else { ame()).log(java.util.logging.Level.SEVERE, null, ex);
JOptionPane.showMessageDialog(this, } catch
"Please check user name / password", "Error (javax.swing.UnsupportedLookAndFeelException
Occured !",JOptionPane.ERROR_MESSAGE); ex) {
}
} catch(Exception ex){ java.util.logging.Logger.getLogger(login.class.getN
} ame()).log(java.util.logging.Level.SEVERE, null, ex);
}
//</editor-fold>
}
java.awt.EventQueue.invokeLater(new
Runnable() {
/**************************************** @Override
CHANGE THEME NAME : Metal , Nimbus , public void run() {
CDE/Motif , Windows , Windows Classic ....for new login().setVisible(true);
more visit (www.ezindagi.in) ! }
****************************************/ });
}
public static void main(String args[]) {
// Variables declaration - do not modify
try { private javax.swing.JButton jButton1;
for private javax.swing.JLabel jLabel2;
(javax.swing.UIManager.LookAndFeelInfo info : private javax.swing.JLabel jLabel3;
javax.swing.UIManager.getInstalledLookAndFeels() private javax.swing.JLabel jLabel4;
){ private javax.swing.JPasswordField
if ("THEME jPasswordField1;
NAME".equals(info.getName())) { private javax.swing.JTextField jTextField1;
private org.jdesktop.beansbinding.BindingGroup
javax.swing.UIManager.setLookAndFeel(info.getCl bindingGroup;
assName()); // End of variables declaration
break;
} }
MAIN MENU
jButton4.setBackground(new java.awt.
package Student; Color(204, 204, 255));
0
public void jButton5.setText("Student Details List");
actionPerformed(java.awt.event.ActionEvent evt) { jButton5.addActionListener(new
jButton1ActionPerformed(evt); java.awt.event.ActionListener() {
} public void
}); actionPerformed(java.awt.event.ActionEvent evt) {
jButton5ActionPerformed(evt);
jButton3.setBackground(new }
java.awt.Color(204, 204, 255)); });
jButton3.setFont(new
java.awt.Font("Tahoma", 1, 20)); // NOI18N javax.swing.GroupLayout layout = new
jButton3.setForeground(new javax.swing.GroupLayout(getContentPane());
java.awt.Color(51, 0, 0)); getContentPane().setLayout(layout);
jButton3.setText("Delete Student Details"); layout.setHorizontalGroup(
jButton3.addActionListener(new
java.awt.event.ActionListener() { layout.createParallelGroup(javax.swing.GroupLayo
public void ut.Alignment.LEADING)
actionPerformed(java.awt.event.ActionEvent evt) {
jButton3ActionPerformed(evt); .addGroup(javax.swing.GroupLayout.Alignment.TR
} AILING, layout.createSequentialGroup()
}); .addGap(94, 94, 94)
jButton6.setBackground(new .addGroup(layout.createParallelGroup(javax.swing
java.awt.Color(102, 102, 102)); .GroupLayout.Alignment.LEADING)
jButton6.setFont(new .addComponent(jButton5,
java.awt.Font("Tahoma", 1, 18)); // NOI18N javax.swing.GroupLayout.DEFAULT_SIZE, 379,
jButton6.setForeground(new Short.MAX_VALUE)
java.awt.Color(255, 255, 255)); .addComponent(jButton4,
jButton6.setText("EXIT"); javax.swing.GroupLayout.Alignment.TRAILING,
jButton6.addActionListener(new javax.swing.GroupLayout.DEFAULT_SIZE, 379,
java.awt.event.ActionListener() { Short.MAX_VALUE)
public void .addComponent(jButton3,
actionPerformed(java.awt.event.ActionEvent evt) { javax.swing.GroupLayout.DEFAULT_SIZE, 379,
jButton6ActionPerformed(evt); Short.MAX_VALUE)
} .addComponent(jButton2,
}); javax.swing.GroupLayout.DEFAULT_SIZE, 379,
Short.MAX_VALUE)
jLabel4.setFont(new java.awt.Font("Tahoma", .addComponent(jButton1,
3, 36)); javax.swing.GroupLayout.DEFAULT_SIZE, 379,
jLabel4.setForeground(new Short.MAX_VALUE))
java.awt.Color(102, 102, 255)); .addGap(53, 53, 53)
jLabel4.setText(" School Management .addComponent(jButton6,
System"); javax.swing.GroupLayout.DEFAULT_SIZE, 75,
Short.MAX_VALUE)
jButton5.setBackground(new .addGap(90, 90, 90))
java.awt.Color(204, 204, 255)); .addGroup(layout.createSequentialGroup()
jButton5.setFont(new .addGap(50, 50, 50)
java.awt.Font("Tahoma", 1, 20)); // NOI18N .addComponent(jLabel4,
jButton5.setForeground(new javax.swing.GroupLayout.PREFERRED_SIZE, 559,
java.awt.Color(51, 0, 0)); javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(82,
Short.MAX_VALUE)) private void
); jButton4ActionPerformed(java.awt.event.ActionEv
layout.setVerticalGroup( ent evt) {
0
jLabel10.setFont(new java.awt.Font("Arial", 1, jTextField2.setForeground(new
18)); java.awt.Color(51, 0, 0));
jLabel10.setForeground(new
java.awt.Color(51, 0, 0)); jTextField6.setFont(new
jLabel10.setText("City / District : "); java.awt.Font("Tahoma", 1, 14));
jTextField6.setForeground(new
jLabel5.setFont(new java.awt.Font("Arial", 1, java.awt.Color(51, 0, 0));
18));
jLabel5.setForeground(new java.awt.Color(51, jTextField5.setFont(new
0, 0)); java.awt.Font("Tahoma", 1, 14));
jLabel5.setText("Father's Name : "); jTextField5.setForeground(new
java.awt.Color(51, 0, 0));
jLabel8.setFont(new java.awt.Font("Arial", 1,
18)); jTextField7.setFont(new
jLabel8.setForeground(new java.awt.Color(51, java.awt.Font("Tahoma", 1, 14));
0, 0)); jTextField7.setForeground(new
jLabel8.setText("Mother's Name : "); java.awt.Color(51, 0, 0));
jTextField3.setFont(new .addGroup(layout.createSequentialGroup()
java.awt.Font("Tahoma", 1, 14));
jTextField3.setForeground(new .addGroup(layout.createParallelGroup(javax.swing
java.awt.Color(51, 0, 0)); .GroupLayout.Alignment.TRAILING)
.addComponent(jLabel7)
jTextField9.setFont(new .addComponent(jLabel9)
java.awt.Font("Tahoma", 1, 14)); .addComponent(jLabel6)
jTextField9.setForeground(new .addComponent(jLabel10)
java.awt.Color(51, 0, 0));
.addGroup(layout.createSequentialGroup()
jTextField8.setFont(new
java.awt.Font("Tahoma", 1, 14)); .addGroup(layout.createParallelGroup(javax.swing
jTextField8.setForeground(new .GroupLayout.Alignment.TRAILING)
java.awt.Color(51, 0, 0)); .addComponent(jLabel5)
.addComponent(jLabel8)
jLabel11.setFont(new java.awt.Font("Arial", 1, .addComponent(jLabel4)
16)); .addComponent(jLabel3)
jLabel11.setText("ENTER ADMISSION NO."); .addComponent(jLabel1))
.addGap(5, 5, 5)))
jTextField10.setFont(new .addGap(29, 29, 29)
java.awt.Font("Tahoma", 1, 14));
jTextField10.setForeground(new .addGroup(layout.createParallelGroup(javax.swing
java.awt.Color(51, 0, 0)); .GroupLayout.Alignment.LEADING)
.addComponent(jTextField1,
jLabel2.setFont(new java.awt.Font("Tahoma", javax.swing.GroupLayout.PREFERRED_SIZE, 237,
3, 36)); javax.swing.GroupLayout.PREFERRED_SIZE)
jLabel2.setForeground(new
java.awt.Color(102, 102, 255)); .addGroup(layout.createSequentialGroup()
jLabel2.setText(" School Management
System"); .addGroup(layout.createParallelGroup(javax.swing
.GroupLayout.Alignment.LEADING)
javax.swing.GroupLayout layout = new
javax.swing.GroupLayout(getContentPane()); .addComponent(jTextField4,
getContentPane().setLayout(layout);
javax.swing.GroupLayout.PREFERRED_SIZE, 237, .addComponent(jTextField10,
javax.swing.GroupLayout.PREFERRED_SIZE) javax.swing.GroupLayout.PREFERRED_SIZE, 171,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jTextField2,
javax.swing.GroupLayout.PREFERRED_SIZE, 237, .addGroup(layout.createSequentialGroup()
javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(14, 14, 14)
.addComponent(jSeparator1,
.addComponent(jTextField6, javax.swing.GroupLayout.PREFERRED_SIZE, 435,
javax.swing.GroupLayout.PREFERRED_SIZE, 237, javax.swing.GroupLayout.PREFERRED_SIZE))))
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createSequentialGroup()
.addComponent(jTextField5, .addGap(56, 56, 56)
javax.swing.GroupLayout.PREFERRED_SIZE, 237, .addComponent(jLabel2,
javax.swing.GroupLayout.PREFERRED_SIZE) javax.swing.GroupLayout.PREFERRED_SIZE, 559,
javax.swing.GroupLayout.PREFERRED_SIZE)))
.addComponent(jTextField7, .addContainerGap(37,
javax.swing.GroupLayout.PREFERRED_SIZE, 237, Short.MAX_VALUE))
javax.swing.GroupLayout.PREFERRED_SIZE) );
layout.setVerticalGroup(
.addComponent(jTextField3,
javax.swing.GroupLayout.PREFERRED_SIZE, 237, layout.createParallelGroup(javax.swing.GroupLayo
javax.swing.GroupLayout.PREFERRED_SIZE)) ut.Alignment.LEADING)
.addGap(54, 54, 54) .addGroup(layout.createSequentialGroup()
.addGap(19, 19, 19)
.addGroup(layout.createParallelGroup(javax.swing .addComponent(jLabel2)
.GroupLayout.Alignment.LEADING, false) .addGap(26, 26, 26)
.addComponent(jButton4,
javax.swing.GroupLayout.DEFAULT_SIZE, .addGroup(layout.createParallelGroup(javax.swing
javax.swing.GroupLayout.DEFAULT_SIZE, .GroupLayout.Alignment.LEADING)
Short.MAX_VALUE)
.addComponent(jButton5, .addGroup(layout.createSequentialGroup()
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, .addGroup(layout.createParallelGroup(javax.swing
Short.MAX_VALUE) .GroupLayout.Alignment.BASELINE)
.addComponent(jButton3, .addComponent(jLabel11)
javax.swing.GroupLayout.PREFERRED_SIZE, 151, .addComponent(jTextField10,
javax.swing.GroupLayout.PREFERRED_SIZE))) javax.swing.GroupLayout.PREFERRED_SIZE,
.addComponent(jTextField9, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE, 237, javax.swing.GroupLayout.PREFERRED_SIZE))
javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18)
.addComponent(jTextField8, .addComponent(jSeparator1,
javax.swing.GroupLayout.PREFERRED_SIZE, 237, javax.swing.GroupLayout.PREFERRED_SIZE, 2,
javax.swing.GroupLayout.PREFERRED_SIZE))) javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18)
.addGroup(layout.createSequentialGroup()
.addGap(46, 46, 46) .addGroup(layout.createParallelGroup(javax.swing
.addComponent(jLabel11) .GroupLayout.Alignment.BASELINE)
.addGap(18, 18, 18) .addComponent(jLabel1)
.addComponent(jTextField1, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
javax.swing.GroupLayout.DEFAULT_SIZE, .addGap(18, 18, 18)
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createParallelGroup(javax.swing
.addPreferredGap(javax.swing.LayoutStyle.Compo .GroupLayout.Alignment.BASELINE)
nentPlacement.UNRELATED) .addComponent(jLabel10)
.addComponent(jTextField7,
.addGroup(layout.createParallelGroup(javax.swing javax.swing.GroupLayout.PREFERRED_SIZE,
.GroupLayout.Alignment.BASELINE) javax.swing.GroupLayout.DEFAULT_SIZE,
.addComponent(jLabel3) javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jTextField2, .addGap(18, 18, 18)
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, .addGroup(layout.createParallelGroup(javax.swing
javax.swing.GroupLayout.PREFERRED_SIZE)) .GroupLayout.Alignment.BASELINE)
.addGap(18, 18, 18) .addComponent(jLabel9)
.addComponent(jTextField8,
.addGroup(layout.createParallelGroup(javax.swing javax.swing.GroupLayout.PREFERRED_SIZE,
.GroupLayout.Alignment.BASELINE) javax.swing.GroupLayout.DEFAULT_SIZE,
.addComponent(jLabel4) javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jTextField3, .addGap(18, 18, 18)
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, .addGroup(layout.createParallelGroup(javax.swing
javax.swing.GroupLayout.PREFERRED_SIZE)) .GroupLayout.Alignment.BASELINE)
.addGap(18, 18, 18) .addComponent(jLabel7)
.addComponent(jTextField9,
.addGroup(layout.createParallelGroup(javax.swing javax.swing.GroupLayout.PREFERRED_SIZE,
.GroupLayout.Alignment.BASELINE) javax.swing.GroupLayout.DEFAULT_SIZE,
.addComponent(jLabel5) javax.swing.GroupLayout.PREFERRED_SIZE)))
.addComponent(jTextField4,
javax.swing.GroupLayout.PREFERRED_SIZE, .addGroup(javax.swing.GroupLayout.Alignment.TR
javax.swing.GroupLayout.DEFAULT_SIZE, AILING, layout.createSequentialGroup()
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18) .addPreferredGap(javax.swing.LayoutStyle.Compo
nentPlacement.RELATED, 95, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing .addComponent(jButton3,
.GroupLayout.Alignment.BASELINE) javax.swing.GroupLayout.PREFERRED_SIZE, 48,
.addComponent(jLabel8) javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jTextField5, .addGap(44, 44, 44)
javax.swing.GroupLayout.PREFERRED_SIZE, .addComponent(jButton5,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE, 49,
javax.swing.GroupLayout.PREFERRED_SIZE)) javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(18, 18, 18) .addGap(47, 47, 47)
.addComponent(jButton4,
.addGroup(layout.createParallelGroup(javax.swing javax.swing.GroupLayout.PREFERRED_SIZE, 49,
.GroupLayout.Alignment.BASELINE) javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel6) .addGap(73, 73, 73)))
.addComponent(jTextField6, .addGap(28, 28, 28))
javax.swing.GroupLayout.PREFERRED_SIZE, );
String uid = "root";
bindingGroup.bind(); String pwd = "root";
String url =
java.awt.Dimension screenSize = "jdbc:mysql://localhost:3306/school";
java.awt.Toolkit.getDefaultToolkit().getScreenSize(
); con= DriverManager.getConnection(url,
setBounds((screenSize.width-707)/2, uid, pwd);
(screenSize.height-560)/2, 707, 560); stmt = con.createStatement();
}// </editor-fold> String qry ="insert into
student(name,standard,rollno,fname,mname,addr
private void ess,city,religion,contact,admno)"
jButton4ActionPerformed(java.awt.event.ActionEv + "values('"+ jTextField1.getText() +
ent evt) { "',"
+ "'" +jTextField2.getText()+ "',"
new menu ().setVisible(true); + "'" + jTextField3.getText() +"',"
dispose(); + "'" + jTextField4.getText() +"',"
+ "'" + jTextField5.getText() +"',"
// TODO add your handling code here: + "'" + jTextField6.getText() +"',"
} + "'" + jTextField7.getText() +"',"
+ "'" + jTextField8.getText() +"',"
private void + "'" + jTextField9.getText() +"',"
jButton5ActionPerformed(java.awt.event.ActionEv + "'" + jTextField10.getText() +"' )" ;
ent evt) { // stmt = con.createStatement();
stmt.executeUpdate(qry);
JOptionPane.showMessageDialog(null,
jTextField1.setText(null); "Sucessfully Added Student Details :-)");
jTextField2.setText(null);
jTextField3.setText(null); stmt.close();
jTextField4.setText(null); con.close();
jTextField5.setText(null); }catch(Exception e) {
jTextField6.setText(null);
jTextField7.setText(null); JOptionPane.showMessageDialog(null,"Error
jTextField8.setText(null); Occur Not Added !");
jTextField9.setText(null); }
jTextField10.setText(null); }
jTextField1.setText(null);
jTextField2.setText(null);
// TODO add your handling code here: jTextField3.setText(null);
} jTextField4.setText(null);
jTextField5.setText(null);
private void jTextField6.setText(null);
jButton3ActionPerformed(java.awt.event.ActionEv jTextField7.setText(null);
ent evt) { jTextField8.setText(null);
jTextField9.setText(null);
int a = JOptionPane.showConfirmDialog(null, jTextField10.setText(null);
"wana add details for sure ?");
if (a==JOptionPane.YES_OPTION) {
try {
private javax.swing.JLabel jLabel4;
// TODO add your handling code here: private javax.swing.JLabel jLabel5;
} private javax.swing.JLabel jLabel6;
private javax.swing.JLabel jLabel7;
/** private javax.swing.JLabel jLabel8;
* @param args the command line arguments private javax.swing.JLabel jLabel9;
*/ private javax.swing.JSeparator jSeparator1;
public static void main(String args[]) { private javax.swing.JTextField jTextField1;
private javax.swing.JTextField jTextField10;
java.awt.EventQueue.invokeLater(new private javax.swing.JTextField jTextField2;
Runnable() { private javax.swing.JTextField jTextField3;
private javax.swing.JTextField jTextField4;
@Override private javax.swing.JTextField jTextField5;
public void run() { private javax.swing.JTextField jTextField6;
new add().setVisible(true); private javax.swing.JTextField jTextField7;
} private javax.swing.JTextField jTextField8;
}); private javax.swing.JTextField jTextField9;
} private org.jdesktop.beansbinding.BindingGroup
// Variables declaration - do not modify bindingGroup;
private javax.swing.JButton jButton3; // End of variables declaration
private javax.swing.JButton jButton4; }
private javax.swing.JButton jButton5;
private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel10;
private javax.swing.JLabel jLabel11;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
LIST
public void
package Student; windowGainedFocus(java.awt.event.WindowEvent
import javax.swing.table.*; evt) {
import java.sql.*; formWindowGainedFocus(evt);
import javax.swing.JOptionPane; }
public void
public class list extends javax.swing.JFrame { windowLostFocus(java.awt.event.WindowEvent
evt) {
/** Creates new form ItemListUI */ }
public list() { });
initComponents();
} jButton2.setBackground(new
java.awt.Color(204, 204, 255));
/** This method is called from within the jButton2.setFont(new
constructor to java.awt.Font("Tahoma", 1, 11)); // NOI18N
* initialize the form. jButton2.setText("Back to Menu");
* WARNING: Do NOT modify this code. The jButton2.addActionListener(new
content of this method is java.awt.event.ActionListener() {
* always regenerated by the Form Editor. public void
*/ actionPerformed(java.awt.event.ActionEvent evt) {
@SuppressWarnings("unchecked") jButton2ActionPerformed(evt);
// <editor-fold defaultstate="collapsed" }
desc="Generated Code"> });
private void initComponents() {
bindingGroup = new jTable1.setAutoCreateRowSorter(true);
org.jdesktop.beansbinding.BindingGroup();
jTable1.setBorder(javax.swing.BorderFactory.creat
jButton2 = new javax.swing.JButton(); eBevelBorder(javax.swing.border.BevelBorder.RAI
jScrollPane1 = new javax.swing.JScrollPane(); SED));
jTable1 = new javax.swing.JTable(); jTable1.setFont(new java.awt.Font("Tahoma",
jLabel6 = new javax.swing.JLabel(); 0, 12)); // NOI18N
jTable1.setModel(new
javax.swing.table.DefaultTableModel(
setDefaultCloseOperation(javax.swing.WindowCon new Object [][] {
stants.EXIT_ON_CLOSE); {null, null, null, null, null, null},
{null, null, null, null, null, null},
org.jdesktop.beansbinding.Binding binding = {null, null, null, null, null, null},
org.jdesktop.beansbinding.Bindings.createAutoBin {null, null, null, null, null, null},
ding(org.jdesktop.beansbinding.AutoBinding.Upda {null, null, null, null, null, null},
teStrategy.READ_WRITE, this, {null, null, null, null, null, null},
org.jdesktop.beansbinding.ELProperty.create("Sch {null, null, null, null, null, null},
ool Management System || www.ezindagi.in ||"), {null, null, null, null, null, null},
this, {null, null, null, null, null, null},
org.jdesktop.beansbinding.BeanProperty.create("ti {null, null, null, null, null, null},
tle")); {null, null, null, null, null, null},
bindingGroup.addBinding(binding); {null, null, null, null, null, null},
{null, null, null, null, null, null},
addWindowFocusListener(new {null, null, null, null, null, null},
java.awt.event.WindowFocusListener() { {null, null, null, null, null, null}
}, .addGap(26, 26, 26)
new String [] { .addComponent(jScrollPane1,
"Admission No.", "Name", "Roll No", javax.swing.GroupLayout.PREFERRED_SIZE, 172,
"Class", "Mobile No.", "City" javax.swing.GroupLayout.PREFERRED_SIZE)
} .addGap(18, 18, 18)
)); .addComponent(jButton2,
jTable1.setSelectionBackground(new javax.swing.GroupLayout.PREFERRED_SIZE, 34,
java.awt.Color(204, 204, 204)); javax.swing.GroupLayout.PREFERRED_SIZE)
jScrollPane1.setViewportView(jTable1); .addContainerGap(23,
Short.MAX_VALUE))
jLabel6.setFont(new java.awt.Font("Tahoma", );
3, 36)); // NOI18N
jLabel6.setForeground(new bindingGroup.bind();
java.awt.Color(102, 102, 255));
jLabel6.setText(" School Management java.awt.Dimension screenSize =
System"); java.awt.Toolkit.getDefaultToolkit().getScreenSize(
);
javax.swing.GroupLayout layout = new setBounds((screenSize.width-699)/2,
javax.swing.GroupLayout(getContentPane()); (screenSize.height-366)/2, 699, 366);
getContentPane().setLayout(layout); }// </editor-fold>
layout.setHorizontalGroup(
private void
layout.createParallelGroup(javax.swing.GroupLayo jButton2ActionPerformed(java.awt.event.ActionEv
ut.Alignment.LEADING) ent evt) {
.addGroup(layout.createSequentialGroup() this.setVisible(false);
.addContainerGap() new menu().setVisible(true);
}
.addGroup(layout.createParallelGroup(javax.swing
.GroupLayout.Alignment.LEADING) private void
formWindowGainedFocus(java.awt.event.Window
.addGroup(layout.createSequentialGroup() Event evt) {
.addComponent(jScrollPane1, // TODO add your handling code here:
javax.swing.GroupLayout.DEFAULT_SIZE, 663, // Before writting the followng line, you
Short.MAX_VALUE) should import the line:
.addContainerGap()) // import javax.swing.table.*; at the top of
your application
.addGroup(javax.swing.GroupLayout.Alignment.TR DefaultTableModel model =
AILING, layout.createSequentialGroup() (DefaultTableModel) jTable1.getModel();
.addComponent(jButton2, // Clear the existing table
javax.swing.GroupLayout.PREFERRED_SIZE, 150, int rows = model.getRowCount();
javax.swing.GroupLayout.PREFERRED_SIZE) if (rows > 0) {
.addGap(259, 259, 259)) for (int i = 0; i < rows; i++) {
model.removeRow(0);
.addGroup(javax.swing.GroupLayout.Alignment.TR }
AILING, layout.createSequentialGroup() }
.addComponent(jLabel6, // SQL Query
javax.swing.GroupLayout.PREFERRED_SIZE, 559, String query = "SELECT * FROM Student";
javax.swing.GroupLayout.PREFERRED_SIZE) try {
.addGap(56, 56, 56)))) // Connect to MySQL database
);
layout.setVerticalGroup( Class.forName("com.mysql.jdbc.Driver").newInsta
nce();
layout.createParallelGroup(javax.swing.GroupLayo Connection con = (Connection)
ut.Alignment.LEADING) DriverManager.getConnection("jdbc:mysql://local
.addGroup(layout.createSequentialGroup() host:3306/school","root","root");
.addContainerGap() // Create SQL statement and execute query.
.addComponent(jLabel6) Statement stmt = con.createStatement();
ResultSet rs = stmt.executeQuery(query);
/**
// Iterate through the result and display on * @param args the command line arguments
screen */
while (rs.next()) { public static void main(String args[]) {
String admno = rs.getString("admno"); java.awt.EventQueue.invokeLater(new
String name = rs.getString("name"); Runnable() {
String rollno = rs.getString("rollno"); public void run() {
String std = rs.getString("standard"); new list().setVisible(true);
String mobile = rs.getString("contact"); }
String city = rs.getString("city"); });
}
//System.out.println(admno + "|" + name
+ "|" + rollno + "|" + std + "|" + mobile + "|" + // Variables declaration - do not modify
city); private javax.swing.JButton jButton2;
model.addRow(new Object[] {admno, private javax.swing.JLabel jLabel6;
name, rollno, std, mobile, city}); private javax.swing.JScrollPane jScrollPane1;
} private javax.swing.JTable jTable1;
} catch (Exception e) { private org.jdesktop.beansbinding.BindingGroup
JOptionPane.showMessageDialog(this, bindingGroup;
e.getMessage()); // End of variables declaration
}
}}
}
NAVIGATION
package Student; jTextField1 = new javax.swing.JTextField();
import java.sql.*; jLabel19 = new javax.swing.JLabel();
import javax.swing.JOptionPane; jTextField10 = new javax.swing.JTextField();
jLabel6 = new javax.swing.JLabel();
public class Navigation extends javax.swing.JFrame
{
setDefaultCloseOperation(javax.swing.WindowCon
/** Creates new form PubNavUI */ stants.EXIT_ON_CLOSE);
public Navigation() { setBounds(new java.awt.Rectangle(200, 70, 0,
initComponents(); 0));
}
org.jdesktop.beansbinding.Binding binding =
/** This method is called from within the org.jdesktop.beansbinding.Bindings.createAutoBin
constructor to ding(org.jdesktop.beansbinding.AutoBinding.Upda
* initialize the form. teStrategy.READ_WRITE, this,
* WARNING: Do NOT modify this code. The org.jdesktop.beansbinding.ELProperty.create("Sch
content of this method is ool Management System || www.ezindagi.in ||"),
* always regenerated by the Form Editor. this,
*/ org.jdesktop.beansbinding.BeanProperty.create("ti
@SuppressWarnings("unchecked") tle"));
// <editor-fold defaultstate="collapsed" bindingGroup.addBinding(binding);
desc="Generated Code">
private void initComponents() { addWindowFocusListener(new
bindingGroup = new java.awt.event.WindowFocusListener() {
org.jdesktop.beansbinding.BindingGroup(); public void
windowGainedFocus(java.awt.event.WindowEvent
cmdFirst = new javax.swing.JButton(); evt) {
cmdNext = new javax.swing.JButton(); formWindowGainedFocus(evt);
cmdExit = new javax.swing.JButton(); }
cmdPrev = new javax.swing.JButton(); public void
cmdLast = new javax.swing.JButton(); windowLostFocus(java.awt.event.WindowEvent
jLabel18 = new javax.swing.JLabel(); evt) {
jLabel17 = new javax.swing.JLabel(); }
jLabel16 = new javax.swing.JLabel(); });
jLabel14 = new javax.swing.JLabel();
jLabel15 = new javax.swing.JLabel(); cmdFirst.setBackground(new
jLabel12 = new javax.swing.JLabel(); java.awt.Color(204, 204, 255));
jLabel13 = new javax.swing.JLabel(); cmdFirst.setFont(new
jLabel11 = new javax.swing.JLabel(); java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel10 = new javax.swing.JLabel(); cmdFirst.setText("First");
jTextField9 = new javax.swing.JTextField(); cmdFirst.addActionListener(new
jTextField8 = new javax.swing.JTextField(); java.awt.event.ActionListener() {
jTextField7 = new javax.swing.JTextField(); public void
jTextField6 = new javax.swing.JTextField(); actionPerformed(java.awt.event.ActionEvent evt) {
jTextField5 = new javax.swing.JTextField(); cmdFirstActionPerformed(evt);
jTextField4 = new javax.swing.JTextField(); }
jTextField3 = new javax.swing.JTextField(); });
jTextField2 = new javax.swing.JTextField();
0
cmdNext.setBackground(new
java.awt.Color(204, 204, 255)); jLabel17.setFont(new java.awt.Font("Arial", 1,
cmdNext.setFont(new 14));
java.awt.Font("Tahoma", 1, 12)); // NOI18N jLabel17.setForeground(new
cmdNext.setText("Next"); java.awt.Color(51, 0, 0));
cmdNext.addActionListener(new jLabel17.setText("Class : ");
java.awt.event.ActionListener() {
public void jLabel16.setFont(new java.awt.Font("Arial", 1,
actionPerformed(java.awt.event.ActionEvent evt) { 14));
cmdNextActionPerformed(evt); jLabel16.setForeground(new
} java.awt.Color(51, 0, 0));
}); jLabel16.setText("Roll No. : ");
jTextField8.setBorder(javax.swing.BorderFactory.cr jTextField1.setBorder(javax.swing.BorderFactory.cr
eateEtchedBorder()); eateEtchedBorder());
jTextField2.setBorder(javax.swing.BorderFactory.cr .addGroup(layout.createSequentialGroup()
eateEtchedBorder()); .addGap(87, 87, 87)
.addComponent(cmdFirst, javax.swing.GroupLayout.PREFERRED_SIZE, 187,
javax.swing.GroupLayout.PREFERRED_SIZE, 66, javax.swing.GroupLayout.PREFERRED_SIZE)))
javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18)
.addGap(28, 28, 28)
.addComponent(cmdNext, .addGroup(layout.createParallelGroup(javax.swing
javax.swing.GroupLayout.PREFERRED_SIZE, 64, .GroupLayout.Alignment.TRAILING)
javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(jLabel15)
.addGap(31, 31, 31) .addComponent(jLabel12)
.addComponent(cmdPrev) .addComponent(jLabel13)
.addGap(29, 29, 29) .addComponent(jLabel11)
.addComponent(cmdLast, .addComponent(jLabel10))
javax.swing.GroupLayout.PREFERRED_SIZE, 65,
javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.Compo
.addGap(37, 37, 37) nentPlacement.UNRELATED)
.addComponent(cmdExit,
javax.swing.GroupLayout.PREFERRED_SIZE, 60, .addGroup(layout.createParallelGroup(javax.swing
javax.swing.GroupLayout.PREFERRED_SIZE)) .GroupLayout.Alignment.LEADING, false)
.addComponent(jTextField9)
.addGroup(layout.createSequentialGroup() .addComponent(jTextField8)
.addComponent(jTextField7)
.addGroup(layout.createParallelGroup(javax.swing .addComponent(jTextField6)
.GroupLayout.Alignment.TRAILING) .addComponent(jTextField5,
javax.swing.GroupLayout.PREFERRED_SIZE, 187,
.addGroup(layout.createSequentialGroup() javax.swing.GroupLayout.PREFERRED_SIZE))))))
.addGroup(layout.createParallelGroup(javax.swing .addContainerGap(javax.swing.GroupLayout.DEFA
.GroupLayout.Alignment.TRAILING) ULT_SIZE, Short.MAX_VALUE))
.addComponent(jLabel18) );
.addComponent(jLabel17) layout.setVerticalGroup(
.addComponent(jLabel16)
layout.createParallelGroup(javax.swing.GroupLayo
.addComponent(jLabel14)) ut.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addPreferredGap(javax.swing.LayoutStyle.Compo .addGap(11, 11, 11)
nentPlacement.UNRELATED) .addComponent(jLabel6)
.addGap(37, 37, 37)
.addGroup(layout.createParallelGroup(javax.swing
.GroupLayout.Alignment.LEADING, false) .addGroup(layout.createParallelGroup(javax.swing
.GroupLayout.Alignment.LEADING)
.addComponent(jTextField4)
.addGroup(layout.createSequentialGroup()
.addComponent(jTextField3) .addGap(2, 2, 2)
.addComponent(jTextField2) .addGroup(layout.createParallelGroup(javax.swing
.GroupLayout.Alignment.BASELINE)
.addComponent(jTextField1, .addComponent(jLabel19)
javax.swing.GroupLayout.PREFERRED_SIZE, 187, .addComponent(jTextField10,
javax.swing.GroupLayout.PREFERRED_SIZE))) javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE,
.addGroup(layout.createSequentialGroup() javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jLabel19)
.addPreferredGap(javax.swing.LayoutStyle.Compo
.addPreferredGap(javax.swing.LayoutStyle.Compo nentPlacement.RELATED)
nentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing
.addComponent(jTextField10, .GroupLayout.Alignment.BASELINE)
.addComponent(jLabel18)
.addComponent(jTextField1, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
javax.swing.GroupLayout.DEFAULT_SIZE, .addGap(10, 10, 10)
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(10, 10, 10) .addGroup(layout.createParallelGroup(javax.swing
.GroupLayout.Alignment.BASELINE)
.addGroup(layout.createParallelGroup(javax.swing .addComponent(jLabel11)
.GroupLayout.Alignment.BASELINE) .addComponent(jTextField8,
.addComponent(jLabel17) javax.swing.GroupLayout.PREFERRED_SIZE,
.addComponent(jTextField2, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
javax.swing.GroupLayout.DEFAULT_SIZE, .addGap(10, 10, 10)
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(10, 10, 10) .addGroup(layout.createParallelGroup(javax.swing
.GroupLayout.Alignment.BASELINE)
.addGroup(layout.createParallelGroup(javax.swing .addComponent(jLabel10)
.GroupLayout.Alignment.BASELINE) .addComponent(jTextField9,
.addComponent(jLabel16) javax.swing.GroupLayout.PREFERRED_SIZE,
.addComponent(jTextField3, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))))
javax.swing.GroupLayout.DEFAULT_SIZE, .addGap(38, 38, 38)
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(10, 10, 10) .addGroup(layout.createParallelGroup(javax.swing
.GroupLayout.Alignment.LEADING)
.addGroup(layout.createParallelGroup(javax.swing .addComponent(cmdPrev,
.GroupLayout.Alignment.BASELINE) javax.swing.GroupLayout.DEFAULT_SIZE, 34,
.addComponent(jLabel14) Short.MAX_VALUE)
.addComponent(jTextField4, .addComponent(cmdExit,
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, 34,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
javax.swing.GroupLayout.PREFERRED_SIZE))) .addComponent(cmdLast,
javax.swing.GroupLayout.DEFAULT_SIZE, 34,
.addGroup(layout.createSequentialGroup() Short.MAX_VALUE)
.addComponent(cmdNext,
.addGroup(layout.createParallelGroup(javax.swing javax.swing.GroupLayout.DEFAULT_SIZE, 34,
.GroupLayout.Alignment.BASELINE) Short.MAX_VALUE)
.addComponent(jLabel15) .addComponent(cmdFirst,
.addComponent(jTextField5, javax.swing.GroupLayout.DEFAULT_SIZE, 34,
javax.swing.GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE))
javax.swing.GroupLayout.DEFAULT_SIZE, .addGap(19, 19, 19))
javax.swing.GroupLayout.PREFERRED_SIZE)) );
.addGap(10, 10, 10)
bindingGroup.bind();
.addGroup(layout.createParallelGroup(javax.swing
.GroupLayout.Alignment.BASELINE) java.awt.Dimension screenSize =
.addComponent(jLabel12) java.awt.Toolkit.getDefaultToolkit().getScreenSize(
.addComponent(jTextField6, );
javax.swing.GroupLayout.PREFERRED_SIZE, setBounds((screenSize.width-677)/2,
javax.swing.GroupLayout.DEFAULT_SIZE, (screenSize.height-366)/2, 677, 366);
javax.swing.GroupLayout.PREFERRED_SIZE)) }// </editor-fold>
.addGap(10, 10, 10) // Global variables
Statement stmt = null;
.addGroup(layout.createParallelGroup(javax.swing ResultSet rs = null;
.GroupLayout.Alignment.BASELINE) String SQL = "SELECT * FROM Student";
.addComponent(jLabel13) public void disable_textfields() {
.addComponent(jTextField7,
javax.swing.GroupLayout.PREFERRED_SIZE, jTextField1.setEditable(false);
jTextField2.setEditable(false); JOptionPane.showMessageDialog(this,
jTextField3.setEditable(false); e.getMessage());
jTextField4.setEditable(false); }
jTextField5.setEditable(false); }
jTextField6.setEditable(false);
jTextField7.setEditable(false); private void
jTextField8.setEditable(false); cmdNextActionPerformed(java.awt.event.ActionEv
jTextField9.setEditable(false); ent evt) {
jTextField10.setEditable(false); try {
Class.forName("com.mysql.jdbc.Driver");
} Connection con = (Connection)
.addGroup(layout.createParallelGroup(javax.swing javax.swing.GroupLayout.PREFERRED_SIZE,
.GroupLayout.Alignment.LEADING) javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup() .addGap(10, 10, 10)
.addGroup(layout.createParallelGroup(javax.swing .addGroup(layout.createParallelGroup(javax.swing
.GroupLayout.Alignment.BASELINE) .GroupLayout.Alignment.BASELINE)
.addComponent(jLabel19) .addComponent(jLabel15)
.addComponent(jTextField10, .addComponent(jTextField5,
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)) javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(10, 10, 10)
.addPreferredGap(javax.swing.LayoutStyle.Compo
nentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing
.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel12)
.addComponent(jTextField6, .addPreferredGap(javax.swing.LayoutStyle.Compo
javax.swing.GroupLayout.PREFERRED_SIZE, nentPlacement.RELATED)
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createParallelGroup(javax.swing
.addGap(10, 10, 10) .GroupLayout.Alignment.LEADING)
.addGroup(layout.createParallelGroup(javax.swing .addGroup(layout.createParallelGroup(javax.swing
.GroupLayout.Alignment.BASELINE) .GroupLayout.Alignment.BASELINE)
.addComponent(jLabel13) .addComponent(cmdExit,
.addComponent(jTextField7, javax.swing.GroupLayout.DEFAULT_SIZE, 38,
javax.swing.GroupLayout.PREFERRED_SIZE, Short.MAX_VALUE)
javax.swing.GroupLayout.DEFAULT_SIZE, .addComponent(cmdExit1,
javax.swing.GroupLayout.PREFERRED_SIZE)) javax.swing.GroupLayout.DEFAULT_SIZE, 38,
.addGap(10, 10, 10) Short.MAX_VALUE))
.addComponent(cmdUpdate,
.addGroup(layout.createParallelGroup(javax.swing javax.swing.GroupLayout.DEFAULT_SIZE, 38,
.GroupLayout.Alignment.BASELINE) Short.MAX_VALUE))
.addComponent(jLabel11)
.addComponent(jTextField8,
javax.swing.GroupLayout.PREFERRED_SIZE, .addGap(21, 21, 21))
);
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)) bindingGroup.bind();
.addGap(10, 10, 10)
java.awt.Dimension screenSize =
.addGroup(layout.createParallelGroup(javax.swing java.awt.Toolkit.getDefaultToolkit().getScreenSize(
.GroupLayout.Alignment.BASELINE) );
.addComponent(jLabel10) setBounds((screenSize.width-646)/2,
.addComponent(jTextField9, (screenSize.height-528)/2, 646, 528);
javax.swing.GroupLayout.PREFERRED_SIZE, }// </editor-fold>
javax.swing.GroupLayout.DEFAULT_SIZE, Statement stmt = null;
javax.swing.GroupLayout.PREFERRED_SIZE))) ResultSet rs = null;
String SQL = "SELECT * FROM Student";
.addGroup(layout.createSequentialGroup()
.addGap(12, 12, 12) private void
.addComponent(jLabel6) cmdExitActionPerformed(java.awt.event.ActionEv
ent evt) {
.addPreferredGap(javax.swing.LayoutStyle.Compo
nentPlacement.RELATED) jTextField1.setText(null);
.addComponent(jScrollPane1, jTextField2.setText(null);
javax.swing.GroupLayout.PREFERRED_SIZE, 255, jTextField3.setText(null);
javax.swing.GroupLayout.PREFERRED_SIZE))) jTextField4.setText(null);
.addGap(27, 27, 27)
.addComponent(jSeparator2,
javax.swing.GroupLayout.PREFERRED_SIZE, 21, jTextField5.setText(null);
javax.swing.GroupLayout.PREFERRED_SIZE) jTextField6.setText(null);
jTextField7.setText(null);
jTextField8.setText(null);
jTextField9.setText(null); else
jTextField10.setText(null);
JOptionPane.showMessageDialog(this,"Record
modified Sucessfully");
} } catch (Exception e) {
JOptionPane.showMessageDialog(this,
private void e.getMessage());
cmdUpdateActionPerformed(java.awt.event.Actio }
nEvent evt) { }
try {
Class.forName("com.mysql.jdbc.Driver"); private void
Connection con = (Connection) jList1MouseClicked(java.awt.event.MouseEvent
evt) {
DriverManager.getConnection("jdbc:mysql://local // getSelectedValue() method extracts the
host:3306/school","root","root"); current cursor location value into a variable
stmt = con.createStatement(); String admno = (String)
rs = stmt.executeQuery(SQL); jList1.getSelectedValue();
// Extract the first 4 characters as Member No
int admno = into a variable
Integer.parseInt(jTextField10.getText()); String Mno =admno.trim().substring(0, 2);
String name = jTextField1.getText(); String query = "SELECT * FROM Student
String standard = jTextField2.getText(); WHERE admno = " + (Mno) + ";";
try {
jTextField7.setFont(new .addGroup(layout.createParallelGroup(javax.swing
java.awt.Font("Tahoma", 1, 14)); .GroupLayout.Alignment.LEADING)
jTextField7.setForeground(new
java.awt.Color(51, 0, 0)); .addGroup(layout.createSequentialGroup()
.addGap(15, 15, 15)
jTextField7.setBorder(javax.swing.BorderFactory.cr .addComponent(jScrollPane1,
eateEtchedBorder()); javax.swing.GroupLayout.PREFERRED_SIZE, 171,
javax.swing.GroupLayout.PREFERRED_SIZE))
jTextField10.setFont(new
java.awt.Font("Tahoma", 1, 14)); .addGroup(layout.createSequentialGroup()
jTextField10.setForeground(new .addGap(32, 32, 32)
java.awt.Color(51, 0, 0)); .addComponent(jLabel6,
javax.swing.GroupLayout.PREFERRED_SIZE, 140,
jTextField10.setBorder(javax.swing.BorderFactory. javax.swing.GroupLayout.PREFERRED_SIZE)))
createEtchedBorder()); .addGap(34, 34, 34)
.addGroup(layout.createParallelGroup(javax.swing .addPreferredGap(javax.swing.LayoutStyle.Compo
.GroupLayout.Alignment.BASELINE) nentPlacement.RELATED)
.addComponent(jLabel14) .addComponent(jScrollPane1,
.addComponent(jTextField4, javax.swing.GroupLayout.PREFERRED_SIZE, 255,
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
javax.swing.GroupLayout.DEFAULT_SIZE, .addGap(27, 27, 27)
javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jSeparator2,
.addGap(10, 10, 10) javax.swing.GroupLayout.PREFERRED_SIZE, 21,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createParallelGroup(javax.swing
.GroupLayout.Alignment.BASELINE) .addPreferredGap(javax.swing.LayoutStyle.Compo
.addComponent(jLabel15) nentPlacement.RELATED)
.addComponent(jTextField5,
javax.swing.GroupLayout.PREFERRED_SIZE, .addGroup(layout.createParallelGroup(javax.swing
javax.swing.GroupLayout.DEFAULT_SIZE, .GroupLayout.Alignment.LEADING)
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(10, 10, 10) .addGroup(layout.createParallelGroup(javax.swing
.GroupLayout.Alignment.BASELINE)
.addGroup(layout.createParallelGroup(javax.swing .addComponent(cmdExit,
.GroupLayout.Alignment.BASELINE) javax.swing.GroupLayout.DEFAULT_SIZE, 38,
.addComponent(jLabel12) Short.MAX_VALUE)
.addComponent(jTextField6, .addComponent(cmdExit1,
javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, 38,
javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(cmdUpdate,
.addGap(10, 10, 10) javax.swing.GroupLayout.DEFAULT_SIZE, 38,
Short.MAX_VALUE))
.addGroup(layout.createParallelGroup(javax.swing .addGap(19, 19, 19))
.GroupLayout.Alignment.BASELINE) );
.addComponent(jLabel13)
.addComponent(jTextField7, bindingGroup.bind();
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, java.awt.Dimension screenSize =
javax.swing.GroupLayout.PREFERRED_SIZE)) java.awt.Toolkit.getDefaultToolkit().getScreenSize(
.addGap(10, 10, 10) );
setBounds((screenSize.width-646)/2,
.addGroup(layout.createParallelGroup(javax.swing (screenSize.height-528)/2, 646, 528);
.GroupLayout.Alignment.BASELINE) }// </editor-fold>
.addComponent(jLabel11) Statement stmt = null;
.addComponent(jTextField8, ResultSet rs = null;
javax.swing.GroupLayout.PREFERRED_SIZE, String SQL = "SELECT * FROM Student";
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)) private void
.addGap(10, 10, 10) cmdExitActionPerformed(java.awt.event.ActionEv
ent evt) {
.addGroup(layout.createParallelGroup(javax.swing
.GroupLayout.Alignment.BASELINE) jTextField1.setText(null);
.addComponent(jLabel10) jTextField2.setText(null);
.addComponent(jTextField9, jTextField3.setText(null);
javax.swing.GroupLayout.PREFERRED_SIZE, jTextField4.setText(null);
jTextField5.setText(null); String admno = (String)
jTextField6.setText(null); jList1.getSelectedValue();
jTextField7.setText(null); // Extract the first 4 characters as Member No
jTextField8.setText(null); into a variable
jTextField9.setText(null); String Mno =admno.trim().substring(0, 2);
jTextField10.setText(null); String query = "SELECT * FROM Student
WHERE admno = " + (Mno) + ";";
} try {
Writtten by:
2. Oxford 12th IP