You are on page 1of 52

“ ”

Senior Secondary Examination (AISSCE – 2018-19)

Submitted By: Submitted To:

Shubham Kumar Saurabh Sir


(Roll No: _______) (Informatics Practices Teacher)
CERTIFICATE .

This is to certify that the project titled “CAR

SHOWROOM SYSTEM” submitted by Miss/Master

Shubham Kumar having roll no ________ of CLASS XII

has completed this project for partial rollback in full -

fillment of the requirement for thesenior secondary

examination (AISSCE)embodies the bonafide work

done by him/her under my supervision.

Internal Supervisor External Supervisor


Signature Signature

Name : Saurabh sir Name :

Date : Date :
ID – SHEET

Roll No : ………………………….

Name of Student : Shubham Kumar

Address : Phulwari Sarif,


Patna

Phone No : 7903301797

Email Address : subhamkumar555@gmail.com

Supervisor : Saurabh Sir

Project Title : Car Showroom

Front End Tool : Java & Netbeans

Back End Tool : MySQL


ACKNOWLEDGEMENT

It would be our outmost pleasure to express


our sincere thanks to our Informatics Practices
Teacher “Saurabh Sir”in providing a helping
hand in this project.

His unflagging patience, creativity and


immense knowledge that he shared with us
have proved highly beneficial to us and have
made our Project possible and successful.

Shubham Kumar
TABLE OF CONTENTS

 Introduction

 Java Details

 Priliminary Design

 Form Layouts

 Database Design

 Implementation

 Bibliography

 Teacher Remarks
INTRODUCTION

This program is designed for the use

of CarShowroom System and its

functioning Main Objective of this

project to facilitate the transactions

through use of electronic medium.

We use java netbeans 6.5 software

and Mysql to programming our

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:

• It should use the object-oriented programming methodology.


• It should allow the same program to be executed on multiple operating systems.
• It should contain built-in support for using computer networks.
• It should be designed to execute code from remote sources securely.
• It should be easy to use and borrow the good parts of older object-oriented languages like
C++.

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.

Multithreaded - Java supports handling multiple tasks simultaneously which greatly


improves the interactive performance of graphical applications.

High performance- Java performance is impressive for an interpreted language , mainly


due to use of immediate bytecode . Use of multithreaded and further its architecture is also
designed to reduce overheads during runtime.

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.

Java Magic: The Bytecode

Bytecode is a highly optimized set of instruction designed to be executed by the java


runtime system, which is called Java Virtual Machine and it exists only inside the computer
memory.

Java Program Java Compiler Virtual Machine

Source code Bytecode


Process of Compilation

Bytecode Java Interpreter Machine code


Virtual Machine Real Machine

Process of converting Bytecode into Machine code

Object Oriented Programming

Object Oriented Programming is an approach that provides a way of modularizing programs


by creating partitioned memory area for both data and functions that can be used as
templates for creating copies of such modules on demand.

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.

Encapsulation - Wrapping of data and methods into a single unit is known as


encapsulation. It is the most striking feature of class. The data is not accessible to outside
world and only those methods which are wrapped in the class can access it. The insulation
of the data from direct access by the program is called data hiding.

Inheritance - Inheritance is the process by which objects of one class acquire the property
of objects of another class. Each subclass inherits state .However, subclasses are not limited
to the states and behaviors provided to them by their superclass. Subclasses can add
variables and methods to the ones they inherit from the superclass. It supports the concept
of hierarchical classification it also provides the use of reusability. .
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.

Java SE - Java Database Connectivity (JDBC)

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.

Advantages of JDBC Technology :

Leverage Existing Enterprise Data

Simplified Enterprise Development

Zero Configuration for Network Computers

Driver Loads database drivers and manages the


manager connections between the application and the
driver
Driver Translates API calls into operations for a
specific data source
Connection A session between an application and a
database
Statement A SQL statement to perform a query or
update operation
Metadata Information about returned data , database
and driver
Resultset Logical set of columns and rows of data
returned by executing a statement
Driver Manager Connection Statement ResultSet

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.

SQL-STRUCTURED QUERY LANGUAGE


SQL is not a procedural language. It is not used to define complex processes; we can use
SQL to use commands that define and manipulate data. SQL is different from other
languages.

• SQL is very readable.

• In SQL we always issue commands.

SQL statements fall into two groups:-

● 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 Statements – Statements that return a set of results.

● Everything else – Statements that don’t return a set of results.


Here are some of the quries defined:-

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.

Here are the some of the components used:

● JApplet– Applet that use SWING must be subclass of JApplet.


JApplet is rich with functionality that is not found in Applet.

● 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.

● JTextFields – Text field is encapsulated by the JTextComponent class which extends


JComponent. JTextField allows you to edit one line of text.

● JButton – JButton class provides the functionality of a push button. JButton allows an
icon of string to be associated with the push button.

● JCheckBox – It is supported by the JCheckBox class. It is a control that is used to turn an


option on or off.

● JTextArea - Text area is encapsulated by the JTextComponent class which extends


JComponent. JTextArea allows you to edit multiline of text.

● JRadioButton – it is supported by the JRadioButton class. It can be configured into a


group of check boxes in which only one check box can be checked at any one time.

● 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.

ADVANTAGES OF (JAVAX) SWING:

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.
2. Unlike AWT components SWING components are not implemented by platform-
specific code. Instead they are written entirely in java and therefore are platform
independent. Thus term lightweight is used to describe such elements.

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
PassWordTF = new
javax.swing.JPasswordField();
jLabel4 = new javax.swing.JLabel();
jLabel1 = new javax.swing.JLabel();
jLabel6 = new javax.swing.JLabel();
LogInB = new javax.swing.JButton();
invalidl = new javax.swing.JLabel();
***************************************** invalid = new javax.swing.JLabel();

LOGIN javax.swing.GroupLayout jDialog1Layout =


new
***************************************** javax.swing.GroupLayout(jDialog1.getContentPane
());
import com.mysql.jdbc.Connection;
import com.mysql.jdbc.Statement;
jDialog1.getContentPane().setLayout(jDialog1Layo
import java.sql.DriverManager;
ut);
import java.sql.ResultSet;
jDialog1Layout.setHorizontalGroup(
public class login extends javax.swing.JFrame {
jDialog1Layout.createParallelGroup(javax.swing.Gr
oupLayout.Alignment.LEADING)
/** Creates new form login */
.addGap(0, 400, Short.MAX_VALUE)
public login() {
);
initComponents();
jDialog1Layout.setVerticalGroup(
}

jDialog1Layout.createParallelGroup(javax.swing.Gr
/** This method is called from within the
oupLayout.Alignment.LEADING)
constructor to
.addGap(0, 300, Short.MAX_VALUE)
* initialize the form.
);
* WARNING: Do NOT modify this code. The
content of this method is
* always regenerated by the Form Editor.
setDefaultCloseOperation(javax.swing.WindowCon
*/
stants.EXIT_ON_CLOSE);
@SuppressWarnings("unchecked")
setTitle("City Sports Shop Management
// <editor-fold defaultstate="collapsed"
System");
desc="Generated Code">
setBounds(new java.awt.Rectangle(200, 70, 0,
private void initComponents() {
0));
jPopupMenu1 = new
jLabel3.setFont(new java.awt.Font("Tahoma",
javax.swing.JPopupMenu();
1, 12)); // NOI18N
jPopupMenu2 = new
jLabel3.setForeground(new java.awt.Color(0,
javax.swing.JPopupMenu();
153, 255));
jDialog1 = new javax.swing.JDialog();
jLabel3.setText("PASSWORD");
jLabel3 = new javax.swing.JLabel();
jLabel2 = new javax.swing.JLabel();
jLabel2.setFont(new java.awt.Font("Tahoma",
idtf = new javax.swing.JTextField();
1, 12)); // NOI18N
jLabel2.setForeground(new java.awt.Color(0, javax.swing.GroupLayout layout = new
153, 255)); javax.swing.GroupLayout(getContentPane());
jLabel2.setText("LOGIN ID"); getContentPane().setLayout(layout);
layout.setHorizontalGroup(
idtf.setBackground(new java.awt.Color(204,
255, 204)); layout.createParallelGroup(javax.swing.GroupLayo
ut.Alignment.LEADING)
PassWordTF.setBackground(new .addGroup(layout.createSequentialGroup()
java.awt.Color(204, 255, 204)); .addGap(20, 20, 20)

jLabel4.setBackground(new .addGroup(layout.createParallelGroup(javax.swing
java.awt.Color(204, 204, 255)); .GroupLayout.Alignment.LEADING)
jLabel4.setFont(new java.awt.Font("Colonna .addComponent(jLabel1)
MT", 3, 24)); // NOI18N
jLabel4.setForeground(new java.awt.Color(51, .addGroup(javax.swing.GroupLayout.Alignment.TR
153, 255)); AILING, layout.createSequentialGroup()
jLabel4.setText("SHOP MANAGEMENT
SYSTEM"); .addPreferredGap(javax.swing.LayoutStyle.Compo
nentPlacement.RELATED, 115,
jLabel1.setIcon(new javax.swing.GroupLayout.PREFERRED_SIZE)
javax.swing.ImageIcon(getClass().getResource("/sp .addComponent(jLabel4,
orts.png"))); // NOI18N javax.swing.GroupLayout.PREFERRED_SIZE, 370,
javax.swing.GroupLayout.PREFERRED_SIZE)
jLabel6.setFont(new java.awt.Font("Poor .addGap(5, 5, 5))
Richard", 0, 18));
jLabel6.setForeground(new java.awt.Color(0, .addGroup(javax.swing.GroupLayout.Alignment.TR
153, 255)); AILING, layout.createSequentialGroup()
jLabel6.setText("LOG IN TO CONTINUE"); .addGap(55, 55, 55)

LogInB.setFont(new java.awt.Font("Tahoma", .addGroup(layout.createParallelGroup(javax.swing


1, 18)); // NOI18N .GroupLayout.Alignment.LEADING)
LogInB.setForeground(new java.awt.Color(51,
153, 255)); .addGroup(layout.createSequentialGroup()
LogInB.setText("Log In");
LogInB.addActionListener(new .addGroup(layout.createParallelGroup(javax.swing
java.awt.event.ActionListener() { .GroupLayout.Alignment.LEADING)
public void
actionPerformed(java.awt.event.ActionEvent evt) { .addGroup(layout.createSequentialGroup()
LogInBActionPerformed(evt); .addGap(147, 147, 147)
} .addComponent(jLabel6,
}); javax.swing.GroupLayout.PREFERRED_SIZE, 210,
javax.swing.GroupLayout.PREFERRED_SIZE))
invalidl.setFont(new java.awt.Font("Tahoma",
1, 12)); .addGroup(layout.createSequentialGroup()

invalid.setFont(new java.awt.Font("Tahoma", .addGroup(layout.createParallelGroup(javax.swing


1, 12)); // NOI18N .GroupLayout.Alignment.LEADING)
invalid.setText(" "); .addComponent(jLabel3)
.addComponent(jLabel2, .addComponent(jLabel4,
javax.swing.GroupLayout.PREFERRED_SIZE, 68, javax.swing.GroupLayout.PREFERRED_SIZE, 31,
javax.swing.GroupLayout.PREFERRED_SIZE)) javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(49, 49, 49) .addGap(26, 26, 26)
.addComponent(jLabel1,
.addGroup(layout.createParallelGroup(javax.swing javax.swing.GroupLayout.PREFERRED_SIZE, 102,
.GroupLayout.Alignment.LEADING) javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(idtf,
javax.swing.GroupLayout.DEFAULT_SIZE, 244, .addPreferredGap(javax.swing.LayoutStyle.Compo
Short.MAX_VALUE) nentPlacement.RELATED, 23, Short.MAX_VALUE)
.addComponent(jLabel6)
.addComponent(PassWordTF,
javax.swing.GroupLayout.PREFERRED_SIZE, 244, .addPreferredGap(javax.swing.LayoutStyle.Compo
javax.swing.GroupLayout.PREFERRED_SIZE)))) nentPlacement.UNRELATED)
.addGap(50, 50, 50))
.addGroup(layout.createParallelGroup(javax.swing
.addGroup(layout.createSequentialGroup() .GroupLayout.Alignment.BASELINE)
.addComponent(LogInB, .addComponent(jLabel2)
javax.swing.GroupLayout.PREFERRED_SIZE, 98, .addComponent(idtf,
javax.swing.GroupLayout.PREFERRED_SIZE) javax.swing.GroupLayout.PREFERRED_SIZE,
.addGap(49, 49, 49) javax.swing.GroupLayout.DEFAULT_SIZE,
.addComponent(invalid, javax.swing.GroupLayout.PREFERRED_SIZE))
javax.swing.GroupLayout.PREFERRED_SIZE, 183, .addGap(18, 18, 18)
javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(20, 20, 20))) .addGroup(layout.createParallelGroup(javax.swing
.GroupLayout.Alignment.BASELINE)
.addPreferredGap(javax.swing.LayoutStyle.Compo .addComponent(PassWordTF,
nentPlacement.RELATED) javax.swing.GroupLayout.PREFERRED_SIZE,
.addComponent(invalidl) javax.swing.GroupLayout.DEFAULT_SIZE,
.addContainerGap(36, javax.swing.GroupLayout.PREFERRED_SIZE)
Short.MAX_VALUE)) .addComponent(jLabel3))
); .addGap(28, 28, 28)
layout.setVerticalGroup(
.addGroup(layout.createParallelGroup(javax.swing
layout.createParallelGroup(javax.swing.GroupLayo .GroupLayout.Alignment.BASELINE)
ut.Alignment.LEADING) .addComponent(LogInB,
javax.swing.GroupLayout.PREFERRED_SIZE, 33,
.addGroup(javax.swing.GroupLayout.Alignment.TR javax.swing.GroupLayout.PREFERRED_SIZE)
AILING, layout.createSequentialGroup() .addComponent(invalid))
.addContainerGap(372, .addGap(34, 34, 34))
Short.MAX_VALUE) );
.addComponent(invalidl)
.addGap(33, 33, 33)) java.awt.Dimension screenSize =
java.awt.Toolkit.getDefaultToolkit().getScreenSize(
.addGroup(javax.swing.GroupLayout.Alignment.TR );
AILING, layout.createSequentialGroup() setBounds((screenSize.width-568)/2,
.addGap(38, 38, 38) (screenSize.height-443)/2, 568, 443);
}// </editor-fold>
private void });
LogInBActionPerformed(java.awt.event.ActionEve }
nt evt) {
// TODO add your handling code here: // Variables declaration - do not modify
invalid.setText(""); private javax.swing.JButton LogInB;
String PWord = PassWordTF.getText(); private javax.swing.JPasswordField PassWordTF;
String ID = idtf.getText(); private javax.swing.JTextField idtf;
String str = null; private javax.swing.JLabel invalid;
Statement stmt=null; private javax.swing.JLabel invalidl;
ResultSet rs = null; private javax.swing.JDialog jDialog1;
try { private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
Class.forName("java.sql.Driver"); private javax.swing.JLabel jLabel3;
String database = private javax.swing.JLabel jLabel4;
"jdbc:mysql://localhost:3306/CARSHOWROOM"; private javax.swing.JLabel jLabel6;
Connection conn = (Connection) private javax.swing.JPopupMenu jPopupMenu1;
DriverManager.getConnection(database, "root", private javax.swing.JPopupMenu jPopupMenu2;
"root"); // End of variables declaration
stmt = (Statement) conn.createStatement(); }
String sql = "select * from login where
userID = '" + ID + "'";
rs = stmt.executeQuery(sql); *****************************************
rs.next();
str = rs.getString("Password"); MAIN UI
rs.close();
*****************************************
stmt.close();
conn.close(); import java.sql.*;
if(str.equals(PWord)) { public class MainMenuUI extends
MainMenuUI m = new MainMenuUI(); javax.swing.JFrame {
m.setVisible(true);
this.setVisible(false); /** Creates new form MainMenuUI */
} else { public MainMenuUI() {
invalid.setText("Incorrect ID or initComponents();
Password"); }
}
} catch (Exception e) { /** This method is called from within the
invalid.setText("Incorrect ID or Password");} constructor to
} * initialize the form.
* WARNING: Do NOT modify this code. The
/** content of this method is
* @param args the command line arguments * always regenerated by the Form Editor.
*/ */
public static void main(String args[]) { @SuppressWarnings("unchecked")
// <editor-fold defaultstate="collapsed"
java.awt.EventQueue.invokeLater(new desc="Generated Code">
Runnable() { private void initComponents() {
public void run() {
new login().setVisible(true); jLabel1 = new javax.swing.JLabel();
} jMenuBar1 = new javax.swing.JMenuBar();
jMenu1 = new javax.swing.JMenu(); mnuCARSAdd.setText("CARS Entry");
mnuCustAdd = new javax.swing.JMenuCARS(); mnuCARSAdd.addActionListener(new
mnuCARSAdd = new java.awt.event.ActionListener() {
javax.swing.JMenuCARS(); public void
mnuOrder = new javax.swing.JMenuCARS(); actionPerformed(java.awt.event.ActionEvent evt) {
jMenu2 = new javax.swing.JMenu(); mnuCARSAddActionPerformed(evt);
ListCust = new javax.swing.JMenuCARS(); }
ListCARS = new javax.swing.JMenuCARS(); });
ListOrder = new javax.swing.JMenuCARS(); jMenu1.add(mnuCARSAdd);
jMenu3 = new javax.swing.JMenu();
jMenuCARS1 = new javax.swing.JMenuCARS(); mnuOrder.setFont(new java.awt.Font("Segoe
UI", 1, 14)); // NOI18N
mnuOrder.setText("Order Entry");
setDefaultCloseOperation(javax.swing.WindowCon mnuOrder.addActionListener(new
stants.EXIT_ON_CLOSE); java.awt.event.ActionListener() {
setTitle("Sports Shop Mangement"); public void
actionPerformed(java.awt.event.ActionEvent evt) {
jLabel1.setFont(new java.awt.Font("Elephant", mnuOrderActionPerformed(evt);
1, 48)); // NOI18N }
jLabel1.setText(" SPORTS SHOP !"); });
jMenu1.add(mnuOrder);

jMenu1.setBorder(javax.swing.BorderFactory.creat jMenuBar1.add(jMenu1);
eEtchedBorder());
jMenu1.setText("Sports Club");
jMenu1.setFont(new java.awt.Font("Segoe jMenu2.setBorder(javax.swing.BorderFactory.creat
UI", 1, 18)); // NOI18N eEtchedBorder());
jMenu1.addActionListener(new jMenu2.setText("View");
java.awt.event.ActionListener() { jMenu2.setFont(new java.awt.Font("Segoe
public void UI", 1, 18)); // NOI18N
actionPerformed(java.awt.event.ActionEvent evt) { jMenu2.addActionListener(new
jMenu1ActionPerformed(evt); java.awt.event.ActionListener() {
} public void
}); actionPerformed(java.awt.event.ActionEvent evt) {
jMenu2ActionPerformed(evt);
mnuCustAdd.setFont(new }
java.awt.Font("Segoe UI", 1, 14)); // NOI18N });
mnuCustAdd.setText("Cusomer Entry");
mnuCustAdd.addActionListener(new ListCust.setFont(new java.awt.Font("Segoe
java.awt.event.ActionListener() { UI", 1, 14)); // NOI18N
public void ListCust.setText("Customer List");
actionPerformed(java.awt.event.ActionEvent evt) { ListCust.addActionListener(new
mnuCustAddActionPerformed(evt); java.awt.event.ActionListener() {
} public void
}); actionPerformed(java.awt.event.ActionEvent evt) {
jMenu1.add(mnuCustAdd); ListCustActionPerformed(evt);
}
mnuCARSAdd.setFont(new });
java.awt.Font("Segoe UI", 1, 14)); // NOI18N jMenu2.add(ListCust);
}
ListCARS.setFont(new java.awt.Font("Segoe });
UI", 1, 14)); // NOI18N jMenu3.add(jMenuCARS1);
ListCARS.setText("CARS List");
ListCARS.addActionListener(new jMenuBar1.add(jMenu3);
java.awt.event.ActionListener() {
public void setJMenuBar(jMenuBar1);
actionPerformed(java.awt.event.ActionEvent evt) {
ListCARSActionPerformed(evt); javax.swing.GroupLayout layout = new
} javax.swing.GroupLayout(getContentPane());
}); getContentPane().setLayout(layout);
jMenu2.add(ListCARS); layout.setHorizontalGroup(

ListOrder.setFont(new java.awt.Font("Segoe layout.createParallelGroup(javax.swing.GroupLayo


UI", 1, 14)); // NOI18N ut.Alignment.LEADING)
ListOrder.setText("Order List"); .addGroup(layout.createSequentialGroup()
ListOrder.addActionListener(new .addContainerGap()
java.awt.event.ActionListener() { .addComponent(jLabel1)
public void
actionPerformed(java.awt.event.ActionEvent evt) { .addContainerGap(javax.swing.GroupLayout.DEFA
ListOrderActionPerformed(evt); ULT_SIZE, Short.MAX_VALUE))
} );
}); layout.setVerticalGroup(
jMenu2.add(ListOrder);
layout.createParallelGroup(javax.swing.GroupLayo
jMenuBar1.add(jMenu2); ut.Alignment.LEADING)

.addGroup(javax.swing.GroupLayout.Alignment.TR
jMenu3.setBorder(javax.swing.BorderFactory.creat AILING, layout.createSequentialGroup()
eEtchedBorder()); .addContainerGap(110,
jMenu3.setText("quit"); Short.MAX_VALUE)
jMenu3.setFont(new java.awt.Font("Segoe .addComponent(jLabel1,
UI", 1, 18)); // NOI18N javax.swing.GroupLayout.PREFERRED_SIZE, 107,
jMenu3.addActionListener(new javax.swing.GroupLayout.PREFERRED_SIZE)
java.awt.event.ActionListener() { .addGap(115, 115, 115))
public void );
actionPerformed(java.awt.event.ActionEvent evt) {
jMenu3ActionPerformed(evt); java.awt.Dimension screenSize =
} java.awt.Toolkit.getDefaultToolkit().getScreenSize(
}); );
setBounds((screenSize.width-527)/2,
jMenuCARS1.setFont(new (screenSize.height-401)/2, 527, 401);
java.awt.Font("Segoe UI", 1, 14)); // NOI18N }// </editor-fold>
jMenuCARS1.setText("Application");
jMenuCARS1.addActionListener(new private void
java.awt.event.ActionListener() { mnuCustAddActionPerformed(java.awt.event.Acti
public void onEvent evt) {
actionPerformed(java.awt.event.ActionEvent evt) { this.setVisible(false);
jMenuCARS1ActionPerformed(evt); new ShopINUI().setVisible(true);
} }

private void private void


mnuCARSAddActionPerformed(java.awt.event.Acti jMenu3ActionPerformed(java.awt.event.ActionEve
onEvent evt) { nt evt) {
this.setVisible(false); // TODO add your handling code here:
new CARSINUI().setVisible(true);
} }

private void private void


mnuOrderActionPerformed(java.awt.event.Action jMenuCARS1ActionPerformed(java.awt.event.Acti
Event evt) { onEvent evt) {
this.setVisible(false); System.exit(0); // TODO add your handling
new OrderINUI().setVisible(true); code here:
} }

private void /**


jMenu1ActionPerformed(java.awt.event.ActionEve * @param args the command line arguments
nt evt) { */
// TODO add your handling code here: public static void main(String args[]) {
} java.awt.EventQueue.invokeLater(new
Runnable() {
private void public void run() {
jMenu2ActionPerformed(java.awt.event.ActionEve new MainMenuUI().setVisible(true);
nt evt) { }
});
} }

private void // Variables declaration - do not modify


ListCustActionPerformed(java.awt.event.ActionEve private javax.swing.JMenuCARS ListCust;
nt evt) { private javax.swing.JMenuCARS ListCARS;
this.setVisible(false); private javax.swing.JMenuCARS ListOrder;
new CustListUI().setVisible(true); private javax.swing.JLabel jLabel1;
} private javax.swing.JMenu jMenu1;
private javax.swing.JMenu jMenu2;
private void private javax.swing.JMenu jMenu3;
ListCARSActionPerformed(java.awt.event.ActionEv private javax.swing.JMenuBar jMenuBar1;
ent evt) { private javax.swing.JMenuCARS jMenuCARS1;
this.setVisible(false); private javax.swing.JMenuCARS mnuCustAdd;
new CARSListUI().setVisible(true); private javax.swing.JMenuCARS mnuCARSAdd;
private javax.swing.JMenuCARS mnuOrder;
} // End of variables declaration

private void }
ListOrderActionPerformed(java.awt.event.ActionE
vent evt) {
this.setVisible(false); *****************************************
new OrdListUI().setVisible(true); CUSTOMER DETAILS
*****************************************
import java.sql.*; jLabel6.setFont(new java.awt.Font("Tahoma",
import javax.swing.JOptionPane; 1, 24));
jLabel6.setText("CARSHOWROOM Data Entry
public class ShopINUI extends javax.swing.JFrame { Form");

/** Creates new form ShopINUI */ jLabel1.setFont(new java.awt.Font("Tahoma",


public ShopINUI() { 1, 12));
initComponents(); jLabel1.setText("CARSHOWROOM's ID.:");
}
txtSHName.setFont(new
/** This method is called from within the java.awt.Font("Tahoma", 1, 12));
constructor to
* initialize the form. txtSHAddress.setFont(new
* WARNING: Do NOT modify this code. The java.awt.Font("Tahoma", 1, 12));
content of this method is
* always regenerated by the Form Editor. btnBack.setFont(new
*/ java.awt.Font("Tahoma", 1, 12));
@SuppressWarnings("unchecked") btnBack.setText("Back to Main");
// <editor-fold defaultstate="collapsed" btnBack.addActionListener(new
desc="Generated Code"> java.awt.event.ActionListener() {
private void initComponents() { public void
actionPerformed(java.awt.event.ActionEvent evt) {
txtSHPhone = new javax.swing.JTextField(); btnBackActionPerformed(evt);
jLabel6 = new javax.swing.JLabel(); }
jLabel1 = new javax.swing.JLabel(); });
txtSHName = new javax.swing.JTextField();
txtSHAddress = new javax.swing.JTextField(); btnSave.setFont(new
btnBack = new javax.swing.JButton(); java.awt.Font("Tahoma", 1, 12));
btnSave = new javax.swing.JButton(); btnSave.setText("Save");
txtSHCity = new javax.swing.JTextField(); btnSave.addActionListener(new
btnClear = new javax.swing.JButton(); java.awt.event.ActionListener() {
jLabel3 = new javax.swing.JLabel(); public void
jLabel4 = new javax.swing.JLabel(); actionPerformed(java.awt.event.ActionEvent evt) {
jLabel2 = new javax.swing.JLabel(); btnSaveActionPerformed(evt);
txtSHno = new javax.swing.JTextField(); }
jLabel5 = new javax.swing.JLabel(); });

txtSHCity.setFont(new
setDefaultCloseOperation(javax.swing.WindowCon java.awt.Font("Tahoma", 1, 12));
stants.EXIT_ON_CLOSE);
setTitle("CARSHOWROOM Data Entry Form"); btnClear.setFont(new
setCursor(new java.awt.Font("Tahoma", 1, 12));
java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSO btnClear.setText("Clear");
R)); btnClear.addActionListener(new
java.awt.event.ActionListener() {
txtSHPhone.setFont(new public void
java.awt.Font("Tahoma", 1, 12)); actionPerformed(java.awt.event.ActionEvent evt) {
btnClearActionPerformed(evt);
}
}); .addComponent(jLabel3))

jLabel3.setFont(new java.awt.Font("Tahoma", .addPreferredGap(javax.swing.LayoutStyle.Compo


1, 12)); nentPlacement.RELATED)
jLabel3.setText("Address:");
.addGroup(layout.createParallelGroup(javax.swing
jLabel4.setFont(new java.awt.Font("Tahoma", .GroupLayout.Alignment.LEADING)
1, 12)); .addComponent(txtSHno,
jLabel4.setText("City:"); javax.swing.GroupLayout.PREFERRED_SIZE, 62,
javax.swing.GroupLayout.PREFERRED_SIZE)
jLabel2.setFont(new java.awt.Font("Tahoma", .addComponent(txtSHName,
1, 12)); javax.swing.GroupLayout.PREFERRED_SIZE, 228,
jLabel2.setText("Name:"); javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(txtSHAddress,
txtSHno.setFont(new javax.swing.GroupLayout.PREFERRED_SIZE, 321,
java.awt.Font("Tahoma", 1, 12)); javax.swing.GroupLayout.PREFERRED_SIZE)))

jLabel5.setFont(new java.awt.Font("Tahoma", .addGroup(layout.createSequentialGroup()


1, 12)); .addGap(42, 42, 42)
jLabel5.setText("Phone No.:");
.addGroup(layout.createParallelGroup(javax.swing
javax.swing.GroupLayout layout = new .GroupLayout.Alignment.TRAILING)
javax.swing.GroupLayout(getContentPane()); .addComponent(jLabel4)
getContentPane().setLayout(layout); .addComponent(jLabel5))
layout.setHorizontalGroup(
.addPreferredGap(javax.swing.LayoutStyle.Compo
layout.createParallelGroup(javax.swing.GroupLayo nentPlacement.RELATED)
ut.Alignment.LEADING)
.addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing
.GroupLayout.Alignment.LEADING)
.addGroup(layout.createParallelGroup(javax.swing .addComponent(txtSHPhone,
.GroupLayout.Alignment.LEADING) javax.swing.GroupLayout.PREFERRED_SIZE, 126,
javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createSequentialGroup() .addComponent(txtSHCity,
.addGap(86, 86, 86) javax.swing.GroupLayout.PREFERRED_SIZE, 145,
.addComponent(jLabel6)) javax.swing.GroupLayout.PREFERRED_SIZE))))))
.addContainerGap(40,
.addGroup(layout.createSequentialGroup() Short.MAX_VALUE))
.addGap(37, 37, 37)
.addGroup(javax.swing.GroupLayout.Alignment.TR
.addGroup(layout.createParallelGroup(javax.swing AILING, layout.createSequentialGroup()
.GroupLayout.Alignment.LEADING) .addContainerGap(78, Short.MAX_VALUE)
.addComponent(btnSave)
.addGroup(layout.createSequentialGroup() .addGap(43, 43, 43)
.addComponent(btnBack)
.addGroup(layout.createParallelGroup(javax.swing .addGap(56, 56, 56)
.GroupLayout.Alignment.TRAILING) .addComponent(btnClear)
.addComponent(jLabel2) .addGap(98, 98, 98))
.addComponent(jLabel1) );
layout.setVerticalGroup(
.addPreferredGap(javax.swing.LayoutStyle.Compo
layout.createParallelGroup(javax.swing.GroupLayo nentPlacement.UNRELATED)
ut.Alignment.LEADING)
.addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing
.addGap(24, 24, 24) .GroupLayout.Alignment.BASELINE)
.addComponent(jLabel6) .addComponent(jLabel5)
.addGap(39, 39, 39) .addComponent(txtSHPhone,
javax.swing.GroupLayout.PREFERRED_SIZE,
.addGroup(layout.createParallelGroup(javax.swing javax.swing.GroupLayout.DEFAULT_SIZE,
.GroupLayout.Alignment.LEADING) javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jLabel1) .addGap(43, 43, 43)

.addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing
.addComponent(txtSHno, .GroupLayout.Alignment.LEADING, false)
javax.swing.GroupLayout.PREFERRED_SIZE, .addComponent(btnClear,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE) javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.Compo .addComponent(btnBack,
nentPlacement.RELATED) javax.swing.GroupLayout.DEFAULT_SIZE, 35,
Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing .addComponent(btnSave,
.GroupLayout.Alignment.BASELINE) javax.swing.GroupLayout.DEFAULT_SIZE, 35,
.addComponent(txtSHName, Short.MAX_VALUE))
javax.swing.GroupLayout.PREFERRED_SIZE, .addGap(24, 24, 24))
javax.swing.GroupLayout.DEFAULT_SIZE, );
javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(jLabel2)) java.awt.Dimension screenSize =
.addGap(16, 16, 16) java.awt.Toolkit.getDefaultToolkit().getScreenSize(
);
.addGroup(layout.createParallelGroup(javax.swing setBounds((screenSize.width-526)/2,
.GroupLayout.Alignment.BASELINE) (screenSize.height-388)/2, 526, 388);
.addComponent(txtSHAddress, }// </editor-fold>
javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, private void
javax.swing.GroupLayout.PREFERRED_SIZE) btnBackActionPerformed(java.awt.event.ActionEv
.addComponent(jLabel3)))) ent evt) {
.addGap(18, 18, 18) this.setVisible(false);
new MainMenuUI().setVisible(true);
.addGroup(layout.createParallelGroup(javax.swing }
.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel4) private void
.addComponent(txtSHCity, btnSaveActionPerformed(java.awt.event.ActionEv
javax.swing.GroupLayout.PREFERRED_SIZE, ent evt) {
javax.swing.GroupLayout.DEFAULT_SIZE, try {
javax.swing.GroupLayout.PREFERRED_SIZE)) Class.forName("com.mysql.jdbc.Driver");
Connection con = (Connection)
// TODO add your handling code here:
DriverManager.getConnection("jdbc:mysql://local txtSHno.setText("");
host:3306/CARSHOWROOM","root","root"); txtSHName.setText("");
Statement stmt = null; txtSHAddress.setText("");
ResultSet rs = null; // ResultSet for txtSHCity.setText("");
CARSHOWROOM table. txtSHPhone.setText("");
String SQL = "SELECT * FROM }
CARSHOWROOM";
stmt = con.createStatement(); // /**
Connection string for ResultSet - rs. * @param args the command line arguments
rs = stmt.executeQuery(SQL); */
public static void main(String args[]) {
// Data transfer from JTextField control to java.awt.EventQueue.invokeLater(new
variables Runnable() {
String shno = txtSHno.getText().trim(); public void run() {
String shname = txtSHName.getText(); new ShopINUI().setVisible(true);
String shadd = txtSHAddress.getText(); }
String shcity = txtSHCity.getText(); });
double shphone = }
Double.parseDouble(txtSHPhone.getText());
if (shno.length() <= 4) { // Variables declaration - do not modify
String strSQL = "INSERT INTO private javax.swing.JButton btnBack;
CARSHOWROOM(Shopper_id, Name, Address, private javax.swing.JButton btnClear;
City, Phone) VALUES private javax.swing.JButton btnSave;
('"+(shno)+"','"+(shname)+"','"+(shadd)+"','"+(shcit private javax.swing.JLabel jLabel1;
y)+"',"+(shphone)+")"; private javax.swing.JLabel jLabel2;
JOptionPane.showMessageDialog(this, private javax.swing.JLabel jLabel3;
"Record successfully inserted"); private javax.swing.JLabel jLabel4;
int rowsEffected = private javax.swing.JLabel jLabel5;
stmt.executeUpdate(strSQL); private javax.swing.JLabel jLabel6;
System.out.println(rowsEffected + " rows private javax.swing.JTextField txtSHAddress;
effected"); private javax.swing.JTextField txtSHCity;
} private javax.swing.JTextField txtSHName;
else { private javax.swing.JTextField txtSHPhone;
JOptionPane.showMessageDialog(this, private javax.swing.JTextField txtSHno;
"Customer ID should not more than 4 character."); // End of variables declaration
}
con.close(); }
} catch (Exception e) {

JOptionPane.showMessageDialog(this,e.getMessa
ge()); *****************************************
e.printStackTrace(); CAR
}
DETAILS********************************
}
*********

private void import java.sql.*;


btnClearActionPerformed(java.awt.event.ActionEv import javax.swing.JOptionPane;
ent evt) {
public class CARSINUI extends javax.swing.JFrame { txtCARSName.setFont(new
java.awt.Font("Tahoma", 1, 12));
/** Creates new form CARSINUI */
public CARSINUI() { jLabel13.setFont(new
initComponents(); java.awt.Font("Tahoma", 1, 12));
} jLabel13.setText("Price:");

/** This method is called from within the btnClear.setFont(new


constructor to java.awt.Font("Tahoma", 1, 12));
* initialize the form. btnClear.setText("Clear");
* WARNING: Do NOT modify this code. The btnClear.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") btnClearActionPerformed(evt);
// <editor-fold defaultstate="collapsed" }
desc="Generated Code"> });
private void initComponents() {
txtCARSPrice.setFont(new
jLabel3 = new javax.swing.JLabel(); java.awt.Font("Tahoma", 1, 12));
jLabel1 = new javax.swing.JLabel();
txtCARSno = new javax.swing.JTextField(); btnSave.setFont(new
txtCARSName = new javax.swing.JTextField(); java.awt.Font("Tahoma", 1, 12));
jLabel13 = new javax.swing.JLabel(); btnSave.setText("Save");
btnClear = new javax.swing.JButton(); btnSave.addActionListener(new
txtCARSPrice = new javax.swing.JTextField(); java.awt.event.ActionListener() {
btnSave = new javax.swing.JButton(); public void
btnBack = new javax.swing.JButton(); actionPerformed(java.awt.event.ActionEvent evt) {
txtCARSDesc = new javax.swing.JTextField(); btnSaveActionPerformed(evt);
jLabel15 = new javax.swing.JLabel(); }
jLabel14 = new javax.swing.JLabel(); });

btnBack.setFont(new
setDefaultCloseOperation(javax.swing.WindowCon java.awt.Font("Tahoma", 1, 12));
stants.EXIT_ON_CLOSE); btnBack.setText("Back to Main");
setTitle("Sports CARS Entry Form"); btnBack.addActionListener(new
java.awt.event.ActionListener() {
jLabel3.setFont(new java.awt.Font("Tahoma", public void
1, 12)); actionPerformed(java.awt.event.ActionEvent evt) {
jLabel3.setText("CARS Id.:"); btnBackActionPerformed(evt);
}
jLabel1.setFont(new java.awt.Font("Tahoma", });
1, 24));
jLabel1.setText("Sports CARS Entry Form"); txtCARSDesc.setFont(new
java.awt.Font("Tahoma", 1, 12));
txtCARSno.setFont(new
java.awt.Font("Tahoma", 1, 12)); jLabel15.setFont(new
java.awt.Font("Tahoma", 1, 12));
jLabel15.setText("Description:");
.addComponent(txtCARSName,
jLabel14.setFont(new javax.swing.GroupLayout.DEFAULT_SIZE, 123,
java.awt.Font("Tahoma", 1, 12)); Short.MAX_VALUE)
jLabel14.setText("CARS Name:"); .addGap(81, 81, 81))
.addComponent(txtCARSPrice,
javax.swing.GroupLayout layout = new javax.swing.GroupLayout.PREFERRED_SIZE, 92,
javax.swing.GroupLayout(getContentPane()); javax.swing.GroupLayout.PREFERRED_SIZE)
getContentPane().setLayout(layout); .addComponent(txtCARSno,
layout.setHorizontalGroup( javax.swing.GroupLayout.PREFERRED_SIZE, 90,
javax.swing.GroupLayout.PREFERRED_SIZE))
layout.createParallelGroup(javax.swing.GroupLayo .addGap(118, 118, 118))
ut.Alignment.LEADING)
.addGroup(layout.createSequentialGroup() .addGroup(javax.swing.GroupLayout.Alignment.TR
.addGap(59, 59, 59) AILING, layout.createSequentialGroup()
.addContainerGap(109,
.addGroup(layout.createParallelGroup(javax.swing Short.MAX_VALUE)
.GroupLayout.Alignment.TRAILING) .addComponent(jLabel1)
.addComponent(jLabel15, .addGap(80, 80, 80))
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.DEFAULT_SIZE, .addGroup(javax.swing.GroupLayout.Alignment.TR
Short.MAX_VALUE) AILING, layout.createSequentialGroup()
.addComponent(jLabel14, .addContainerGap(78, Short.MAX_VALUE)
javax.swing.GroupLayout.Alignment.LEADING, .addComponent(btnSave)
javax.swing.GroupLayout.DEFAULT_SIZE, 73, .addGap(47, 47, 47)
Short.MAX_VALUE) .addComponent(btnBack)
.addGap(48, 48, 48)
.addGroup(layout.createSequentialGroup() .addComponent(btnClear)
.addGap(19, 19, 19) .addGap(64, 64, 64))
.addComponent(jLabel3, );
javax.swing.GroupLayout.DEFAULT_SIZE, layout.setVerticalGroup(
javax.swing.GroupLayout.DEFAULT_SIZE,
Short.MAX_VALUE)) layout.createParallelGroup(javax.swing.GroupLayo
ut.Alignment.LEADING)
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addGap(27, 27, 27) .addGap(27, 27, 27)
.addComponent(jLabel13, .addComponent(jLabel1)
javax.swing.GroupLayout.DEFAULT_SIZE, 46, .addGap(35, 35, 35)
Short.MAX_VALUE)))
.addGap(18, 18, 18) .addGroup(layout.createParallelGroup(javax.swing
.GroupLayout.Alignment.BASELINE)
.addGroup(layout.createParallelGroup(javax.swing .addComponent(jLabel3,
.GroupLayout.Alignment.LEADING) javax.swing.GroupLayout.PREFERRED_SIZE, 29,
.addComponent(txtCARSDesc, javax.swing.GroupLayout.PREFERRED_SIZE)
javax.swing.GroupLayout.PREFERRED_SIZE, 204, .addComponent(txtCARSno))
javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(18, 18, 18)

.addGroup(javax.swing.GroupLayout.Alignment.TR .addGroup(layout.createParallelGroup(javax.swing
AILING, layout.createSequentialGroup() .GroupLayout.Alignment.BASELINE)
.addComponent(jLabel14)
.addComponent(txtCARSName)) }
.addGap(21, 21, 21)
private void
.addGroup(layout.createParallelGroup(javax.swing btnSaveActionPerformed(java.awt.event.ActionEv
.GroupLayout.Alignment.BASELINE) ent evt) {
.addComponent(jLabel15) try {
.addComponent(txtCARSDesc, Class.forName("com.mysql.jdbc.Driver");
javax.swing.GroupLayout.PREFERRED_SIZE, Connection con = (Connection)
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)) DriverManager.getConnection("jdbc:mysql://local
.addGap(33, 33, 33) host:3306/CARSHOWROOM","root","root");
Statement stmt = null;
.addGroup(layout.createParallelGroup(javax.swing ResultSet rs = null; // ResultSet for
.GroupLayout.Alignment.BASELINE) CARSHOWROOM table.
.addComponent(jLabel13) String SQL = "SELECT * FROM CARS";
.addComponent(txtCARSPrice)) stmt = con.createStatement(); //
.addGap(47, 47, 47) Connection string for ResultSet - rs.
rs = stmt.executeQuery(SQL);
.addGroup(layout.createParallelGroup(javax.swing
.GroupLayout.Alignment.LEADING, false) // Data transfer from JTextField control to
.addComponent(btnClear, variables
javax.swing.GroupLayout.DEFAULT_SIZE, String CARSno = txtCARSno.getText();
javax.swing.GroupLayout.DEFAULT_SIZE, String CARSname = txtCARSName.getText();
Short.MAX_VALUE) String desc = txtCARSDesc.getText();
.addComponent(btnBack, double CARSprice =
javax.swing.GroupLayout.DEFAULT_SIZE, Double.parseDouble(txtCARSPrice.getText());
javax.swing.GroupLayout.DEFAULT_SIZE, String strSQL = "INSERT INTO CARS(CARS_Id,
Short.MAX_VALUE) CARS_Name, Description, Price) VALUES
.addComponent(btnSave, ('"+(CARSno)+"','"+(CARSname)+"','"+(desc)+"',"+(C
javax.swing.GroupLayout.PREFERRED_SIZE, 33, ARSprice)+")";
javax.swing.GroupLayout.PREFERRED_SIZE)) JOptionPane.showMessageDialog(this,
.addGap(30, 30, 30)) "Record successfully inserted");
); int rowsEffected =
stmt.executeUpdate(strSQL);
java.awt.Dimension screenSize = System.out.println(rowsEffected + " rows
java.awt.Toolkit.getDefaultToolkit().getScreenSize( effected");
); con.close();
setBounds((screenSize.width-482)/2, } catch (Exception e) {
(screenSize.height-403)/2, 482, 403);
}// </editor-fold> JOptionPane.showMessageDialog(this,e.getMessa
ge());
private void e.printStackTrace();
btnClearActionPerformed(java.awt.event.ActionEv }
ent evt) { }
// TODO add your handling code here:
txtCARSno.setText(""); private void
txtCARSName.setText(""); btnBackActionPerformed(java.awt.event.ActionEv
txtCARSDesc.setText(""); ent evt) {
txtCARSPrice.setText(""); this.setVisible(false);
new MainMenuUI().setVisible(true);
} /** This method is called from within the
constructor to
/** * initialize the form.
* @param args the command line arguments * WARNING: Do NOT modify this code. The
*/ content of this method is
public static void main(String args[]) { * always regenerated by the Form Editor.
java.awt.EventQueue.invokeLater(new */
Runnable() { @SuppressWarnings("unchecked")
public void run() { // <editor-fold defaultstate="collapsed"
new CARSINUI().setVisible(true); desc="Generated Code">
} private void initComponents() {
});
} buttonGroup1 = new
javax.swing.ButtonGroup();
// Variables declaration - do not modify jLabel9 = new javax.swing.JLabel();
private javax.swing.JButton btnBack; txtOrdno = new javax.swing.JTextField();
private javax.swing.JButton btnClear; jLabel2 = new javax.swing.JLabel();
private javax.swing.JButton btnSave; jLabel3 = new javax.swing.JLabel();
private javax.swing.JLabel jLabel1; jLabel4 = new javax.swing.JLabel();
private javax.swing.JLabel jLabel13; btnClear = new javax.swing.JButton();
private javax.swing.JLabel jLabel14; txtOrdDate = new javax.swing.JTextField();
private javax.swing.JLabel jLabel15; txtOrdQty = new javax.swing.JTextField();
private javax.swing.JLabel jLabel3; btnBack = new javax.swing.JButton();
private javax.swing.JTextField txtCARSDesc; jLabel10 = new javax.swing.JLabel();
private javax.swing.JTextField txtCARSName; btnSave = new javax.swing.JButton();
private javax.swing.JTextField txtCARSPrice; jLabel1 = new javax.swing.JLabel();
private javax.swing.JTextField txtCARSno; jLabel8 = new javax.swing.JLabel();
// End of variables declaration txtCARSPrice = new javax.swing.JTextField();
jLabel5 = new javax.swing.JLabel();
} jLabel7 = new javax.swing.JLabel();
txtSID = new javax.swing.JTextField();
txtSName = new javax.swing.JTextField();
***************************************** jLabel6 = new javax.swing.JLabel();
ORDER DETAILS txtCARSID = new javax.swing.JTextField();
jScrollPane1 = new javax.swing.JScrollPane();
UI*************************************** jList1 = new javax.swing.JList();
** jScrollPane2 = new javax.swing.JScrollPane();
jList2 = new javax.swing.JList();
import java.sql.*; jPanel1 = new javax.swing.JPanel();
import javax.swing.DefaultListModel; rdYes = new javax.swing.JRadioButton();
import javax.swing.JOptionPane; rdNo = new javax.swing.JRadioButton();
jLabel11 = new javax.swing.JLabel();
public class OrderINUI extends javax.swing.JFrame txtDisc = new javax.swing.JTextField();
{

/** Creates new form OrderINUI */ setDefaultCloseOperation(javax.swing.WindowCon


public OrderINUI() { stants.EXIT_ON_CLOSE);
initComponents(); setTitle("Order Form");
}
addWindowFocusListener(new public void
java.awt.event.WindowFocusListener() { actionPerformed(java.awt.event.ActionEvent evt) {
public void txtOrdDateActionPerformed(evt);
windowGainedFocus(java.awt.event.WindowEvent }
evt) { });
formWindowGainedFocus(evt);
} txtOrdQty.setFont(new
public void java.awt.Font("Tahoma", 1, 12)); // NOI18N
windowLostFocus(java.awt.event.WindowEvent
evt) { btnBack.setFont(new
} java.awt.Font("Tahoma", 1, 12)); // NOI18N
}); btnBack.setText("Back to Main");
btnBack.addActionListener(new
jLabel9.setFont(new java.awt.Font("Tahoma", java.awt.event.ActionListener() {
1, 12)); public void
jLabel9.setText("Order Quantity:"); actionPerformed(java.awt.event.ActionEvent evt) {
btnBackActionPerformed(evt);
txtOrdno.setFont(new }
java.awt.Font("Tahoma", 1, 12)); });

jLabel2.setFont(new java.awt.Font("Tahoma", jLabel10.setFont(new


1, 12)); java.awt.Font("Tahoma", 1, 24)); // NOI18N
jLabel2.setText("Date:"); jLabel10.setText("Sports CARS Order Form");

jLabel3.setFont(new java.awt.Font("Tahoma", btnSave.setFont(new


1, 12)); // NOI18N java.awt.Font("Tahoma", 1, 12)); // NOI18N
jLabel3.setText("CARSHOWROOM Id and btnSave.setText("Save Order");
Name"); btnSave.addActionListener(new
java.awt.event.ActionListener() {
jLabel4.setFont(new java.awt.Font("Tahoma", public void
1, 12)); actionPerformed(java.awt.event.ActionEvent evt) {
jLabel4.setText("CARS Id and Name"); btnSaveActionPerformed(evt);
}
btnClear.setFont(new });
java.awt.Font("Tahoma", 1, 12)); // NOI18N
btnClear.setText("Clear"); jLabel1.setFont(new java.awt.Font("Tahoma",
btnClear.addActionListener(new 1, 12));
java.awt.event.ActionListener() { jLabel1.setText("Order No.:");
public void
actionPerformed(java.awt.event.ActionEvent evt) { jLabel8.setFont(new java.awt.Font("Tahoma",
btnClearActionPerformed(evt); 1, 12)); // NOI18N
} jLabel8.setText("CARS price:");
});
txtCARSPrice.setFont(new
txtOrdDate.setFont(new java.awt.Font("Tahoma", 1, 12)); // NOI18N
java.awt.Font("Tahoma", 1, 12));
txtOrdDate.addActionListener(new jLabel5.setText("ID.:");
java.awt.event.ActionListener() {
jLabel7.setText("Name:");
jLabel6.setText("CARS ID.:"); .addPreferredGap(javax.swing.LayoutStyle.Compo
nentPlacement.RELATED, 26, Short.MAX_VALUE)
jList1.setModel(new DefaultListModel()); .addComponent(rdNo)
jList1.addMouseListener(new .addGap(20, 20, 20))
java.awt.event.MouseAdapter() { );
public void jPanel1Layout.setVerticalGroup(
mouseClicked(java.awt.event.MouseEvent evt) {
jList1MouseClicked(evt); jPanel1Layout.createParallelGroup(javax.swing.Gr
} oupLayout.Alignment.LEADING)
});
jScrollPane1.setViewportView(jList1); .addGroup(jPanel1Layout.createSequentialGroup()

jList2.setModel(new DefaultListModel()); .addGroup(jPanel1Layout.createParallelGroup(java


jList2.addMouseListener(new x.swing.GroupLayout.Alignment.BASELINE)
java.awt.event.MouseAdapter() { .addComponent(rdYes)
public void .addComponent(rdNo))
mouseClicked(java.awt.event.MouseEvent evt) {
jList2MouseClicked(evt); .addContainerGap(javax.swing.GroupLayout.DEFA
} ULT_SIZE, Short.MAX_VALUE))
}); );
jScrollPane2.setViewportView(jList2);
jLabel11.setFont(new
java.awt.Font("Tahoma", 1, 12)); // NOI18N
jPanel1.setBorder(javax.swing.BorderFactory.creat jLabel11.setText("Discount (%):");
eTitledBorder("Discount"));
txtDisc.setFont(new java.awt.Font("Tahoma",
buttonGroup1.add(rdYes); 1, 12)); // NOI18N
rdYes.setFont(new java.awt.Font("Tahoma",
1, 10)); javax.swing.GroupLayout layout = new
rdYes.setText("Yes"); javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
buttonGroup1.add(rdNo); layout.setHorizontalGroup(
rdNo.setFont(new java.awt.Font("Tahoma", 1,
10)); layout.createParallelGroup(javax.swing.GroupLayo
rdNo.setText("No"); ut.Alignment.LEADING)

javax.swing.GroupLayout jPanel1Layout = new .addGroup(javax.swing.GroupLayout.Alignment.TR


javax.swing.GroupLayout(jPanel1); AILING, layout.createSequentialGroup()
jPanel1.setLayout(jPanel1Layout); .addGap(37, 37, 37)
jPanel1Layout.setHorizontalGroup(
.addGroup(layout.createParallelGroup(javax.swing
jPanel1Layout.createParallelGroup(javax.swing.Gr .GroupLayout.Alignment.LEADING)
oupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TR
.addGroup(jPanel1Layout.createSequentialGroup() AILING,
.addContainerGap() layout.createParallelGroup(javax.swing.GroupLayo
.addComponent(rdYes) ut.Alignment.LEADING)
.addComponent(txtOrdno,
.addGroup(layout.createSequentialGroup() javax.swing.GroupLayout.PREFERRED_SIZE, 62,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createParallelGroup(javax.swing .addComponent(jScrollPane1,
.GroupLayout.Alignment.LEADING) javax.swing.GroupLayout.PREFERRED_SIZE, 203,
.addComponent(jLabel7) javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jLabel5)) .addGap(119, 119, 119)
.addGap(6, 6, 6)
.addGroup(layout.createParallelGroup(javax.swing
.addGroup(layout.createParallelGroup(javax.swing .GroupLayout.Alignment.LEADING)
.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createSequentialGroup() .addComponent(jLabel2)
.addGap(13, 13, 13) .addGap(18, 18, 18)
.addComponent(txtSID, .addComponent(txtOrdDate,
javax.swing.GroupLayout.PREFERRED_SIZE, 88, javax.swing.GroupLayout.PREFERRED_SIZE, 112,
javax.swing.GroupLayout.PREFERRED_SIZE)) javax.swing.GroupLayout.PREFERRED_SIZE))
.addComponent(jLabel4)
.addGroup(layout.createSequentialGroup() .addComponent(jScrollPane2,
.addGap(12, 12, 12) javax.swing.GroupLayout.PREFERRED_SIZE, 231,
.addComponent(txtSName, javax.swing.GroupLayout.PREFERRED_SIZE)
javax.swing.GroupLayout.PREFERRED_SIZE, 167,
javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(layout.createSequentialGroup()
.addGap(25, 25, 25))
.addGroup(layout.createParallelGroup(javax.swing
.addGroup(javax.swing.GroupLayout.Alignment.TR .GroupLayout.Alignment.LEADING)
AILING, layout.createSequentialGroup() .addComponent(jLabel8)
.addComponent(jLabel9, .addComponent(jLabel6))
javax.swing.GroupLayout.DEFAULT_SIZE, 110, .addGap(39, 39, 39)
Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing
.addPreferredGap(javax.swing.LayoutStyle.Compo .GroupLayout.Alignment.LEADING)
nentPlacement.RELATED) .addComponent(txtCARSID,
.addComponent(txtOrdQty, javax.swing.GroupLayout.PREFERRED_SIZE, 116,
javax.swing.GroupLayout.PREFERRED_SIZE, 102, javax.swing.GroupLayout.PREFERRED_SIZE)
javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(txtCARSPrice,
.addGap(337, 337, 337))) javax.swing.GroupLayout.PREFERRED_SIZE, 89,
javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGroup(layout.createSequentialGroup() .addComponent(jPanel1,
javax.swing.GroupLayout.PREFERRED_SIZE,
.addGroup(layout.createParallelGroup(javax.swing javax.swing.GroupLayout.DEFAULT_SIZE,
.GroupLayout.Alignment.LEADING) javax.swing.GroupLayout.PREFERRED_SIZE)

.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addComponent(jLabel1) .addComponent(jLabel11)
.addGap(18, 18, 18)
.addPreferredGap(javax.swing.LayoutStyle.Compo .addComponent(txtDisc,
nentPlacement.UNRELATED) javax.swing.GroupLayout.PREFERRED_SIZE, 76,
javax.swing.GroupLayout.PREFERRED_SIZE))))
.addComponent(jLabel3))
.addGap(27, 27, 27)) .addPreferredGap(javax.swing.LayoutStyle.Compo
.addGroup(layout.createSequentialGroup() nentPlacement.RELATED)
.addGap(156, 156, 156)
.addComponent(jLabel10) .addGroup(layout.createParallelGroup(javax.swing
.addContainerGap(175, .GroupLayout.Alignment.LEADING)
Short.MAX_VALUE)) .addComponent(jScrollPane1,
.addGroup(layout.createSequentialGroup() javax.swing.GroupLayout.PREFERRED_SIZE,
.addGap(68, 68, 68) javax.swing.GroupLayout.DEFAULT_SIZE,
.addComponent(btnSave) javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(30, 30, 30) .addComponent(jScrollPane2,
.addComponent(btnBack, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE, 163, javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE) javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(26, 26, 26)
.addComponent(btnClear, .addPreferredGap(javax.swing.LayoutStyle.Compo
javax.swing.GroupLayout.PREFERRED_SIZE, 87, nentPlacement.RELATED)
javax.swing.GroupLayout.PREFERRED_SIZE)
.addContainerGap(144, .addGroup(layout.createParallelGroup(javax.swing
Short.MAX_VALUE)) .GroupLayout.Alignment.LEADING)
);
layout.setVerticalGroup( .addGroup(layout.createSequentialGroup()

layout.createParallelGroup(javax.swing.GroupLayo .addGroup(layout.createParallelGroup(javax.swing
ut.Alignment.LEADING) .GroupLayout.Alignment.BASELINE)
.addGroup(layout.createSequentialGroup() .addComponent(jLabel5)
.addGap(11, 11, 11) .addComponent(txtSID,
.addComponent(jLabel10) javax.swing.GroupLayout.PREFERRED_SIZE,
.addGap(18, 18, 18) javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createParallelGroup(javax.swing .addGap(18, 18, 18)
.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel2) .addGroup(layout.createParallelGroup(javax.swing
.addComponent(jLabel1) .GroupLayout.Alignment.BASELINE)
.addComponent(txtOrdno, .addComponent(jLabel7)
javax.swing.GroupLayout.PREFERRED_SIZE, .addComponent(txtSName,
javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE) javax.swing.GroupLayout.DEFAULT_SIZE,
.addComponent(txtOrdDate, javax.swing.GroupLayout.PREFERRED_SIZE))
javax.swing.GroupLayout.PREFERRED_SIZE, .addGap(30, 30, 30)
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createParallelGroup(javax.swing
.addGap(23, 23, 23) .GroupLayout.Alignment.BASELINE)
.addComponent(jLabel9)
.addGroup(layout.createParallelGroup(javax.swing .addComponent(txtOrdQty,
.GroupLayout.Alignment.BASELINE) javax.swing.GroupLayout.PREFERRED_SIZE,
.addComponent(jLabel3) javax.swing.GroupLayout.DEFAULT_SIZE,
.addComponent(jLabel4)) javax.swing.GroupLayout.PREFERRED_SIZE)))
.addComponent(btnSave,
.addGroup(layout.createSequentialGroup() javax.swing.GroupLayout.DEFAULT_SIZE, 35,
Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing .addComponent(btnBack,
.GroupLayout.Alignment.LEADING) javax.swing.GroupLayout.DEFAULT_SIZE, 34,
Short.MAX_VALUE)))
.addGroup(layout.createSequentialGroup() .addGap(19, 19, 19))
.addComponent(txtCARSID, );
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(18, 18, 18) );
setBounds((screenSize.width-633)/2,
.addGroup(layout.createParallelGroup(javax.swing (screenSize.height-529)/2, 633, 529);
.GroupLayout.Alignment.BASELINE) }// </editor-fold>
.addComponent(jLabel8)
.addComponent(txtCARSPrice, private void
javax.swing.GroupLayout.PREFERRED_SIZE, btnClearActionPerformed(java.awt.event.ActionEv
javax.swing.GroupLayout.DEFAULT_SIZE, ent evt) {
javax.swing.GroupLayout.PREFERRED_SIZE))) // TODO add your handling code here:
.addComponent(jLabel6)) txtOrdno.setText("");
txtOrdDate.setText("");
.addPreferredGap(javax.swing.LayoutStyle.Compo txtSID.setText("");
nentPlacement.UNRELATED) txtCARSID.setText("");
.addComponent(jPanel1, txtSName.setText("");
javax.swing.GroupLayout.PREFERRED_SIZE, 43, txtCARSPrice.setText("");
javax.swing.GroupLayout.PREFERRED_SIZE))) txtOrdQty.setText("");
.addGap(18, 18, 18) }

.addGroup(layout.createParallelGroup(javax.swing private void


.GroupLayout.Alignment.BASELINE) btnBackActionPerformed(java.awt.event.ActionEv
.addComponent(jLabel11) ent evt) {
.addComponent(txtDisc, this.setVisible(false);
javax.swing.GroupLayout.PREFERRED_SIZE, new MainMenuUI().setVisible(true);
javax.swing.GroupLayout.DEFAULT_SIZE, }
javax.swing.GroupLayout.PREFERRED_SIZE))
private void
.addPreferredGap(javax.swing.LayoutStyle.Compo btnSaveActionPerformed(java.awt.event.ActionEv
nentPlacement.RELATED, 26, Short.MAX_VALUE) ent evt) {
try {
.addGroup(layout.createParallelGroup(javax.swing Class.forName("com.mysql.jdbc.Driver");
.GroupLayout.Alignment.LEADING, false) Connection con = (Connection)
.addComponent(btnClear,
javax.swing.GroupLayout.DEFAULT_SIZE, DriverManager.getConnection("jdbc:mysql://local
javax.swing.GroupLayout.DEFAULT_SIZE, host:3306/CARSHOWROOM","root","root");
Short.MAX_VALUE) Statement stmt = null;
ResultSet rs = null; // ResultSet for
.addGroup(layout.createParallelGroup(javax.swing CARSHOWROOM table.
.GroupLayout.Alignment.BASELINE) String SQL = "SELECT * FROM orderCARS";
stmt = con.createStatement(); // }
Connection string for ResultSet - rs. }
rs = stmt.executeQuery(SQL);
private void
float discP = 0; // Discount formWindowGainedFocus(java.awt.event.Window
// Data transfer from JTextField control to Event evt) {
variables // Creating a ListModel object sModel to
String Ordno = txtOrdno.getText(); perform DefaultListModel
String OrdDate = txtOrdDate.getText(); // method operations for CARSHOWROOM list
String CARSID = txtCARSID.getText(); DefaultListModel sModel = (DefaultListModel)
String ShopID = txtSID.getText(); jList1.getModel();
String CARSPrice = txtCARSPrice.getText();
double iPrice = // Creating a ListModel object iModel to
Double.parseDouble(txtCARSPrice.getText()); perform DefaultComboBoxModel
String ordQty = txtOrdQty.getText(); // method operations for CARS list
DefaultListModel iModel = (DefaultListModel)
if (rdYes.isSelected()) { jList2.getModel();
discP = Float.parseFloat(txtDisc.getText());
} sModel.clear();
else { iModel.clear();
discP=0; try {
} Class.forName("com.mysql.jdbc.Driver");
Connection con = (Connection)
double amt =
(Integer.parseInt(txtOrdQty.getText()) * DriverManager.getConnection("jdbc:mysql://local
Double.parseDouble(txtCARSPrice.getText())) - host:3306/CARSHOWROOM","root","root");
(Integer.parseInt(txtOrdQty.getText()) * Statement stmt = null;
Double.parseDouble(txtCARSPrice.getText()))*(disc ResultSet rs = null;
P*0.01); ResultSet rs1 = null;
String strSQL = "INSERT INTO
orderCARS(orderno, OrderDate, CARS_Id, String SQL = "SELECT * FROM
Shopper_Id, Quantity, price, discount, Amount ) CARSHOWROOM";
VALUES String SQL1 = "SELECT * FROM CARS";
('"+(Ordno)+"','"+(OrdDate)+"','"+(CARSID)+"','"+(S stmt = con.createStatement();
hopID)+"',"+(ordQty)+","+iPrice+","+
discP+","+(amt)+")"; // Steps to extract CARSHOWROOMs id and
JOptionPane.showMessageDialog(this, name
"Order successfully placed"); rs = stmt.executeQuery(SQL);
int rowsEffected = while (rs.next()) {
stmt.executeUpdate(strSQL); String sID = rs.getString("Shopper_id");
System.out.println(rowsEffected + " rows String Sname = rs.getString("Name");
effected"); sModel.addElement(sID + " - " + Sname);
con.close(); }
jList1.setModel(sModel);
} catch (Exception e) {
// Steps to extract CARS id and name
JOptionPane.showMessageDialog(this,e.getMessa rs1 = stmt.executeQuery(SQL1);
ge()); while (rs1.next()) {
e.printStackTrace(); String iID = rs1.getString("CARS_Id");
String Iname = String Iame= CARSIDName.substring(7);
rs1.getString("CARS_Name"); txtCARSID.setText(CARSID);
iModel.addElement(iID + " - " + Iname); String SQL = "SELECT * FROM CARS where
} CARS_Id = '"+(CARSID)+"'";
jList2.setModel(iModel); stmt = con.createStatement();
con.close(); rs = stmt.executeQuery(SQL);

} catch (Exception e) { while (rs.next()) {


double iprice = rs.getDouble("Price");
JOptionPane.showMessageDialog(this,e.getMessa
ge()); txtCARSPrice.setText(Double.toString(iprice));
e.printStackTrace(); }
} con.close();
} catch (Exception e) {
}
JOptionPane.showMessageDialog(this,e.getMessa
private void ge());
jList1MouseClicked(java.awt.event.MouseEvent e.printStackTrace();
evt) { }
// Extracting supplier id and name into a
variable SidName }
String SidName = (String)
jList1.getSelectedValue(); private void
String Sid = SidName.substring(0, 3); txtOrdDateActionPerformed(java.awt.event.Action
String Sname= SidName.substring(6); Event evt) {
// TODO add your handling code here:
// Displays ID and name from ComboBox1 }
txtSID.setText(Sid);
txtSName.setText(Sname); /**
} * @param args the command line arguments
*/
private void public static void main(String args[]) {
jList2MouseClicked(java.awt.event.MouseEvent java.awt.EventQueue.invokeLater(new
evt) { Runnable() {
try { public void run() {
Class.forName("com.mysql.jdbc.Driver"); new OrderINUI().setVisible(true);
Connection con = (Connection) }
});
DriverManager.getConnection("jdbc:mysql://local }
host:3306/CARSHOWROOM","root","root");
Statement stmt = null; // Variables declaration - do not modify
ResultSet rs = null; private javax.swing.JButton btnBack;
private javax.swing.JButton btnClear;
// Extracting CARS id and CARS name into a private javax.swing.JButton btnSave;
variable CARSIDName private javax.swing.ButtonGroup buttonGroup1;
String CARSIDName = (String) private javax.swing.JLabel jLabel1;
jList2.getSelectedValue(); private javax.swing.JLabel jLabel10;
String CARSID = CARSIDName.substring(0, private javax.swing.JLabel jLabel11;
3); private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3; * WARNING: Do NOT modify this code. The
private javax.swing.JLabel jLabel4; content of this method is
private javax.swing.JLabel jLabel5; * always regenerated by the Form Editor.
private javax.swing.JLabel jLabel6; */
private javax.swing.JLabel jLabel7; @SuppressWarnings("unchecked")
private javax.swing.JLabel jLabel8; // <editor-fold defaultstate="collapsed"
private javax.swing.JLabel jLabel9; desc="Generated Code">
private javax.swing.JList jList1; private void initComponents() {
private javax.swing.JList jList2;
private javax.swing.JPanel jPanel1; jButton1 = new javax.swing.JButton();
private javax.swing.JScrollPane jScrollPane1; jButton2 = new javax.swing.JButton();
private javax.swing.JScrollPane jScrollPane2; jScrollPane1 = new javax.swing.JScrollPane();
private javax.swing.JRadioButton rdNo; jTable1 = new javax.swing.JTable();
private javax.swing.JRadioButton rdYes; jLabel1 = new javax.swing.JLabel();
private javax.swing.JTextField txtDisc;
private javax.swing.JTextField txtCARSID;
private javax.swing.JTextField txtCARSPrice; setDefaultCloseOperation(javax.swing.WindowCon
private javax.swing.JTextField txtOrdDate; stants.EXIT_ON_CLOSE);
private javax.swing.JTextField txtOrdQty; setTitle("Customers list");
private javax.swing.JTextField txtOrdno;
private javax.swing.JTextField txtSID; jButton1.setFont(new
private javax.swing.JTextField txtSName; java.awt.Font("Tahoma", 1, 12)); // NOI18N
// End of variables declaration jButton1.setText("Display/Query");
jButton1.addActionListener(new
} java.awt.event.ActionListener() {
public void
actionPerformed(java.awt.event.ActionEvent evt) {
jButton1ActionPerformed(evt);
***************************************** }
CUSTOMER });

LIST************************************* jButton2.setFont(new
**** java.awt.Font("Tahoma", 1, 12)); // NOI18N
jButton2.setText("Back to Menu");
import java.sql.*; jButton2.addActionListener(new
import javax.swing.table.*; java.awt.event.ActionListener() {
import javax.swing.JOptionPane; public void
actionPerformed(java.awt.event.ActionEvent evt) {
public class CustListUI extends javax.swing.JFrame jButton2ActionPerformed(evt);
{ }
});
/** Creates new form CustListUI */
public CustListUI() { jTable1.setModel(new
initComponents(); javax.swing.table.DefaultTableModel(
} new Object [][] {
{null, null, null, null, null},
/** This method is called from within the {null, null, null, null, null},
constructor to {null, null, null, null, null},
* initialize the form. {null, null, null, null, null},
{null, null, null, null, null}, );
{null, null, null, null, null}, layout.setVerticalGroup(
{null, null, null, null, null},
{null, null, null, null, null}, layout.createParallelGroup(javax.swing.GroupLayo
{null, null, null, null, null}, ut.Alignment.LEADING)
{null, null, null, null, null} .addGroup(layout.createSequentialGroup()
}, .addGap(20, 20, 20)
new String [] { .addComponent(jLabel1)
"Customer ID", "Name", "Address", "City", .addGap(18, 18, 18)
"Phone" .addComponent(jScrollPane1,
} javax.swing.GroupLayout.PREFERRED_SIZE, 172,
)); javax.swing.GroupLayout.PREFERRED_SIZE)
jScrollPane1.setViewportView(jTable1); .addGap(35, 35, 35)

jLabel1.setFont(new java.awt.Font("Tahoma", .addGroup(layout.createParallelGroup(javax.swing


1, 24)); // NOI18N .GroupLayout.Alignment.LEADING, false)
jLabel1.setText("Customer List"); .addComponent(jButton2,
javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout layout = new javax.swing.GroupLayout.DEFAULT_SIZE,
javax.swing.GroupLayout(getContentPane()); Short.MAX_VALUE)
getContentPane().setLayout(layout); .addComponent(jButton1,
layout.setHorizontalGroup( javax.swing.GroupLayout.DEFAULT_SIZE, 32,
Short.MAX_VALUE))
layout.createParallelGroup(javax.swing.GroupLayo .addContainerGap(13,
ut.Alignment.LEADING) Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup() );

.addGroup(layout.createParallelGroup(javax.swing java.awt.Dimension screenSize =


.GroupLayout.Alignment.LEADING) java.awt.Toolkit.getDefaultToolkit().getScreenSize(
);
.addGroup(layout.createSequentialGroup() setBounds((screenSize.width-623)/2,
.addGap(203, 203, 203) (screenSize.height-357)/2, 623, 357);
.addComponent(jLabel1)) }// </editor-fold>

.addGroup(layout.createSequentialGroup() private void


.addContainerGap() jButton1ActionPerformed(java.awt.event.ActionEv
ent evt) {
.addGroup(layout.createParallelGroup(javax.swing // Before writting the followng line, you
.GroupLayout.Alignment.LEADING) should import the line:
.addComponent(jScrollPane1, // import javax.swing.table.*; at the top of
javax.swing.GroupLayout.DEFAULT_SIZE, 587, your application
Short.MAX_VALUE)
DefaultTableModel model =
.addGroup(layout.createSequentialGroup() (DefaultTableModel) jTable1.getModel();
.addGap(161, 161, 161) // Clear the existing table
.addComponent(jButton1) int rows = model.getRowCount();
.addGap(39, 39, 39) if (rows > 0) {
.addComponent(jButton2))))) for (int i = 0; i < rows; i++) {
.addContainerGap()) model.removeRow(0);
} java.awt.EventQueue.invokeLater(new
} Runnable() {
// SQL Query public void run() {
String query = "SELECT * FROM new CustListUI().setVisible(true);
CARSHOWROOM"; }
try { });
// Connect to MySQL database }

// Variables declaration - do not modify


Class.forName("com.mysql.jdbc.Driver").newInsta private javax.swing.JButton jButton1;
nce();
Connection con = (Connection) private javax.swing.JButton jButton2;
DriverManager.getConnection("jdbc:mysql://local private javax.swing.JLabel jLabel1;
host:3306/CARSHOWROOM","root","root");
// Create SQL statement and execute query. private javax.swing.JScrollPane jScrollPane1;
Statement stmt = con.createStatement(); private javax.swing.JTable jTable1;
// End of variables declaration
ResultSet rs = stmt.executeQuery(query);
}
// Iterate through the result and display on
screen
while (rs.next()) { *****************************************
String Sid = rs.getString("Shopper_id"); CAR
String SName = rs.getString("Name");
String SAddress = rs.getString("Address"); LIST*************************************
String SCity = rs.getString("City"); ***
String SPhone = rs.getString("Phone");
import java;
System.out.println(Sid + "|" + SName +
import javax.swing.table.*;
"|" + SAddress + "|" + SCity + "|" + SPhone);
import java.sql.*;
model.addRow(new Object[] {Sid, SName,
import javax.swing.JOptionPane;
SAddress, SCity, SPhone});
}
public class CARSListUI extends javax.swing.JFrame
} catch (Exception e) {
{
JOptionPane.showMessageDialog(this,
e.getMessage());
/** Creates new form CARSListUI */
}
public CARSListUI() {
}
initComponents();
}
private void
jButton2ActionPerformed(java.awt.event.ActionEv
/** This method is called from within the
ent evt) {
constructor to
this.setVisible(false);
* initialize the form.
new MainMenuUI().setVisible(true);
* WARNING: Do NOT modify this code. The
}
content of this method is
* always regenerated by the Form Editor.
/**
*/
* @param args the command line arguments
@SuppressWarnings("unchecked")
*/
// <editor-fold defaultstate="collapsed"
public static void main(String args[]) {
desc="Generated Code">
private void initComponents() { new String [] {
"CARS ID", "Name", "Description", "Price"
jButton2 = new javax.swing.JButton(); }
jButton1 = new javax.swing.JButton(); ));
jScrollPane1 = new javax.swing.JScrollPane(); jScrollPane1.setViewportView(jTable1);
jTable1 = new javax.swing.JTable();
jLabel1 = new javax.swing.JLabel(); jLabel1.setFont(new java.awt.Font("Tahoma",
1, 24)); // NOI18N
jLabel1.setText("CARS List");
setDefaultCloseOperation(javax.swing.WindowCon
stants.EXIT_ON_CLOSE); javax.swing.GroupLayout layout = new
setTitle("List of CARSs in shop"); javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
jButton2.setFont(new layout.setHorizontalGroup(
java.awt.Font("Tahoma", 1, 11)); // NOI18N
jButton2.setText("Back to Menu"); layout.createParallelGroup(javax.swing.GroupLayo
jButton2.addActionListener(new ut.Alignment.LEADING)
java.awt.event.ActionListener() { .addGroup(layout.createSequentialGroup()
public void
actionPerformed(java.awt.event.ActionEvent evt) { .addGroup(layout.createParallelGroup(javax.swing
jButton2ActionPerformed(evt); .GroupLayout.Alignment.LEADING)
}
}); .addGroup(layout.createSequentialGroup()
.addGap(219, 219, 219)
jButton1.setFont(new .addComponent(jLabel1))
java.awt.Font("Tahoma", 1, 12)); // NOI18N
jButton1.setText("Display/Query"); .addGroup(javax.swing.GroupLayout.Alignment.TR
jButton1.addActionListener(new AILING, layout.createSequentialGroup()
java.awt.event.ActionListener() { .addContainerGap()
public void
actionPerformed(java.awt.event.ActionEvent evt) { .addGroup(layout.createParallelGroup(javax.swing
jButton1ActionPerformed(evt); .GroupLayout.Alignment.LEADING)
} .addComponent(jScrollPane1,
}); javax.swing.GroupLayout.DEFAULT_SIZE, 564,
Short.MAX_VALUE)
jTable1.setModel(new
javax.swing.table.DefaultTableModel( .addGroup(layout.createSequentialGroup()
new Object [][] { .addGap(137, 137, 137)
{null, null, null, null}, .addComponent(jButton1)
{null, null, null, null}, .addGap(62, 62, 62)
{null, null, null, null}, .addComponent(jButton2)))))
{null, null, null, null}, .addContainerGap())
{null, null, null, null}, );
{null, null, null, null}, layout.setVerticalGroup(
{null, null, null, null},
{null, null, null, null}, layout.createParallelGroup(javax.swing.GroupLayo
{null, null, null, null}, ut.Alignment.LEADING)
{null, null, null, null} .addGroup(layout.createSequentialGroup()
}, .addContainerGap()
.addComponent(jLabel1) }
.addGap(27, 27, 27) // SQL Query
.addComponent(jScrollPane1, String query = "SELECT * FROM CARS";
javax.swing.GroupLayout.PREFERRED_SIZE, 172, try {
javax.swing.GroupLayout.PREFERRED_SIZE) // Connect to MySQL database
.addGap(35, 35, 35)
Class.forName("com.mysql.jdbc.Driver").newInsta
.addGroup(layout.createParallelGroup(javax.swing nce();
.GroupLayout.Alignment.LEADING, false) Connection con = (Connection)
.addComponent(jButton2, DriverManager.getConnection("jdbc:mysql://local
javax.swing.GroupLayout.DEFAULT_SIZE, host:3306/CARSHOWROOM","root","root");
javax.swing.GroupLayout.DEFAULT_SIZE, // Create SQL statement and execute query.
Short.MAX_VALUE) Statement stmt = con.createStatement();
.addComponent(jButton1, ResultSet rs = stmt.executeQuery(query);
javax.swing.GroupLayout.DEFAULT_SIZE, 32,
Short.MAX_VALUE)) // Iterate through the result and display on
.addContainerGap(22, screen
Short.MAX_VALUE)) while (rs.next()) {
); String ITid = rs.getString("CARS_id");
String IName =
java.awt.Dimension screenSize = rs.getString("CARS_Name");
java.awt.Toolkit.getDefaultToolkit().getScreenSize( String IDesc = rs.getString("Description");
); String IPrice = rs.getString("Price");
setBounds((screenSize.width-600)/2, System.out.println(ITid + "|" + IName +
(screenSize.height-366)/2, 600, 366); "|" + IDesc + "|" + IPrice);
}// </editor-fold> model.addRow(new Object[] {ITid, IName,
IDesc, IPrice});
private void }
jButton2ActionPerformed(java.awt.event.ActionEv } catch (Exception e) {
ent evt) { JOptionPane.showMessageDialog(this,
this.setVisible(false); e.getMessage());
new MainMenuUI().setVisible(true); }
} }

private void /**


jButton1ActionPerformed(java.awt.event.ActionEv * @param args the command line arguments
ent evt) { */
// Before writting the followng line, you public static void main(String args[]) {
should import the line: java.awt.EventQueue.invokeLater(new
// import javax.swing.table.*; at the top of Runnable() {
your application public void run() {
DefaultTableModel model = new CARSListUI().setVisible(true);
(DefaultTableModel) jTable1.getModel(); }
// Clear the existing table });
int rows = model.getRowCount(); }
if (rows > 0) {
for (int i = 0; i < rows; i++) { // Variables declaration - do not modify
model.removeRow(0); private javax.swing.JButton jButton1;
} private javax.swing.JButton jButton2;
private javax.swing.JLabel jLabel1; jButton2 = new javax.swing.JButton();
private javax.swing.JScrollPane jScrollPane1;
jButton1 = new javax.swing.JButton();
private javax.swing.JTable jTable1;
// End of variables declaration jScrollPane1 = new javax.swing.JScrollPane();

} jTable1 = new javax.swing.JTable();

jLabel1 = new javax.swing.JLabel();

setDefaultCloseOperation(javax.swing.WindowCon
***************************************** stants.EXIT_ON_CLOSE);
ORDER
setTitle("List of orders");
LIST*************************************
****
jButton2.setFont(new
import java; java.awt.Font("Tahoma", 1, 11)); // NOI18N
import javax.swing.table.*;
jButton2.setText("Back to Menu");
import java.sql.*;
jButton2.addActionListener(new
import javax.swing.JOptionPane; java.awt.event.ActionListener() {
public class OrdListUI extends javax.swing.JFrame { public void
actionPerformed(java.awt.event.ActionEvent evt) {

jButton2ActionPerformed(evt);
/** Creates new form OrdListUI */
}
public OrdListUI() {
});
initComponents();

}
jButton1.setFont(new
java.awt.Font("Tahoma", 1, 12)); // NOI18N
/** This method is called from within the jButton1.setText("Display/Query");
constructor to
jButton1.addActionListener(new
* initialize the form. java.awt.event.ActionListener() {
* WARNING: Do NOT modify this code. The public void
content of this method is actionPerformed(java.awt.event.ActionEvent evt) {
* always regenerated by the Form Editor. jButton1ActionPerformed(evt);
*/ }
@SuppressWarnings("unchecked") });
// <editor-fold defaultstate="collapsed"
desc="Generated Code">
jTable1.setModel(new
private void initComponents() { javax.swing.table.DefaultTableModel(
new Object [][] {
.addGroup(layout.createParallelGroup(javax.swing
{null, null, null, null, null, null, null, null}, .GroupLayout.Alignment.LEADING)

{null, null, null, null, null, null, null, null}, .addComponent(jScrollPane1,


javax.swing.GroupLayout.DEFAULT_SIZE, 588,
{null, null, null, null, null, null, null, null}, Short.MAX_VALUE)
{null, null, null, null, null, null, null, null},
.addGroup(layout.createSequentialGroup()
{null, null, null, null, null, null, null, null},
.addGap(161, 161, 161)
{null, null, null, null, null, null, null, null},
.addComponent(jButton1)
{null, null, null, null, null, null, null, null},
.addGap(70, 70, 70)
{null, null, null, null, null, null, null, null},
.addComponent(jButton2))
{null, null, null, null, null, null, null, null},

{null, null, null, null, null, null, null, null}


.addGroup(javax.swing.GroupLayout.Alignment.TR
}, AILING, layout.createSequentialGroup()

new String [] { .addComponent(jLabel1)

"Order No.", "Order Date", "CARS Id", .addGap(234, 234, 234)))


"Customer Id", "Quantity", "Price", "Discount(%)",
.addContainerGap())
"Amount"
);
}

));
layout.createParallelGroup(javax.swing.GroupLayo
jScrollPane1.setViewportView(jTable1); ut.Alignment.LEADING)

.addComponent(jScrollPane1,
javax.swing.GroupLayout.PREFERRED_SIZE, 172,
jLabel1.setFont(new java.awt.Font("Tahoma", javax.swing.GroupLayout.PREFERRED_SIZE)
1, 24)); // NOI18N
.addGap(35, 35, 35)
jLabel1.setText("Order List");

.addGroup(layout.createParallelGroup(javax.swing
.GroupLayout.Alignment.LEADING)
javax.swing.GroupLayout layout = new
javax.swing.GroupLayout(getContentPane()); .addComponent(jButton1,
javax.swing.GroupLayout.PREFERRED_SIZE, 37,
getContentPane().setLayout(layout); javax.swing.GroupLayout.PREFERRED_SIZE)

layout.setHorizontalGroup( .addComponent(jButton2,
javax.swing.GroupLayout.DEFAULT_SIZE, 37,
Short.MAX_VALUE))
layout.createParallelGroup(javax.swing.GroupLayo
ut.Alignment.LEADING) .addGap(27, 27, 27))

.addGroup(layout.createSequentialGroup() );

.addContainerGap()
java.awt.Dimension screenSize = Connection con = (Connection)
java.awt.Toolkit.getDefaultToolkit().getScreenSize( DriverManager.getConnection("jdbc:mysql://local
); host:3306/CARSHOWROOM","root","root");

setBounds((screenSize.width-624)/2, // Create SQL statement and execute query.


(screenSize.height-393)/2, 624, 393);
Statement stmt = con.createStatement();
}// </editor-fold>
ResultSet rs = stmt.executeQuery(query);

private void
jButton2ActionPerformed(java.awt.event.ActionEv // Iterate through the result and display on
ent evt) { screen

this.setVisible(false); while (rs.next()) {

new MainMenuUI().setVisible(true); String Ordno = rs.getString("Orderno");

} String Ordd = rs.getString("OrderDate");

String OCARSid = rs.getString("CARS_Id");

private void String OSid = rs.getString("Shopper_Id");


jButton1ActionPerformed(java.awt.event.ActionEv
ent evt) { String OQty = rs.getString("Quantity");

// Before writting the followng line, you String IPrice = rs.getString("price");


should import the line:
String Disc = rs.getString("discount");
// import javax.swing.table.*; at the top of
String OAmount = rs.getString("Amount");
your application
System.out.println(Ordno + "|" + Ordd +
DefaultTableModel model =
"|" +OCARSid + "|" + OSid + "|" + OQty + "|" +
(DefaultTableModel) jTable1.getModel();
IPrice + "|" + Disc + "|" + OAmount);
// Clear the existing table
model.addRow(new Object[] {Ordno,
int rows = model.getRowCount(); Ordd, OCARSid, OSid, OQty, IPrice, Disc,
OAmount});
if (rows > 0) {
}
for (int i = 0; i < rows; i++) {
} catch (Exception e) {
model.removeRow(0);

}
JOptionPane.showMessageDialog(this,
// SQL Query e.getMessage());

String query = "SELECT * FROM orderCARS"; public static void main(String args[]) {

try { java.awt.EventQueue.invokeLater(new
Runnable() {
// Connect to MySQL database
public void run() {

Class.forName("com.mysql.jdbc.Driver").newInsta new OrdListUI().setVisible(true);


nce();
}

}); }

private javax.swing.JLabel jLabel1;

private javax.swing.JScrollPane jScrollPane1;


private javax.swing.JTable jTable1; // End of
variables declaration

BIBILOGRAPHY

Book: INFORMATICS PRACTICES

Writtten by:

1. Sumita Arora 12th IP

2. Oxford 12th IP

You might also like