In this chapter we will discuss about the Java as a
programming language and how it is used to develop various graphical user
interface systems using Java swing components and JDBC which allows us to
connect a database with desktop software.
We will build a software on the lines of student
management system which would include not only student account but even teacher
accounts for various previous lacking exchanges between them.
3.1.1 Flow Chart
3.2 Graphical User Interface using Java Swings
Java Swing is a part
of Java Foundation Classes (JFC) that is used to create window-based
applications. It is built on the top of AWT (Abstract Windowing Toolkit)
API and entirely written in java.
Unlike AWT, Java Swing provides platform-independent and
The javax.swing package provides classes for java swing API such
as JButton, JTextField, JTextArea, JRadioButton, JCheckbox, JMenu,
JFrame -frame is an instance of JFrame. Frame is
a window where we can have title, border, menu, buttons, text fields and several
other components. Any swing application must have a frame in it to store other
JPanel – A panel is an instance of
JPanel. A frame can have more than one panels and each panel can have several
components. You can also call them parts of Frame. Panels are useful for
grouping components and placing them to appropriate locations in a frame.
JLabel – A label is an instance of JLabel
class. A label is unselectable text and images. If you want to display a string
or an image on a frame, you can do so by using labels. In the above example we
wanted to display texts “User” & “Password” just before the text fields, we
did this by creating and adding labels to the appropriate positions.
JTextField – Used for capturing user inputs,
these are the text boxes where user enters the data.
JPasswordField – Similar to text fields but the
entered data gets hidden and displayed as dots on GUI.
JButton – A button is an instance of
JButton class. In the above example we have a button “Login”.
This is a very basic example of the how the system
will interact with the user using the JFrame as the outer container with the
JTextfield and JLabel as the elements of the JPanel inside it with a JButton to
use it to move to the next frame after validating the credentials of the user.
3.3 JDBC (Java Database Connectivity) connection to
an Application Programming Interface(API) used to connect Java
application with Database. JDBC is used to interact with various type of
Database such as Oracle, MS Access, My SQL and SQL Server. JDBC can also be
defined as the platform-independent interface between a relational database and
Java programming. It allows java program to execute SQL statement and retrieve
result from database.
are 4 different types of drivers present in JDBC.
are using Type-1 Driver or JDBC-ODBC bridge
Easy to use
Allow easy connectivity
to all database supported by the ODBC Driver.
Slow execution time
Dependent on ODBC
Uses Java Native
Interface(JNI) to make ODBC call.
3.3.3 The following 5 steps are the basic steps
involve in connecting a Java application
with Database using JDBC.
1. Register the Driver
2. Create a Connection
3. Create SQL Statement
4. Execute SQL Statement
5. Closing the connection
for connecting jdbc with GUI
a connection between the GUI and the database using the connection class
a jdbc statement object
Statement: Execute simple sql queries without
an SQL Statement object.
Executing a SQL statement with the Statement object, and
returning a jdbc ResultSet.
ResultSet provides access to a
table of data generated by executing a Statement. The table rows are retrieved
in sequence. A ResultSet maintains a cursor pointing to its current row of
data. The next() method is used to successively step through the rows of the
Creating User friendly experience
To the benefit of
software and applications everywhere, UX has become an increasingly important
step in the Software Development lifecycle. Even though UX is a slightly
surreptitious layer of design, it’s no less important. It, by the nature of its
name, defines the experience of the users. That experience determines whether
or not they want to come back for more, or run screaming in the other
UX is something anyone
can do. The problem is not everyone can do it well. We can undertake the visual
design for a website, but we guarantee you that it will look dreadful and
If you learn nothing
else about UX we ask you to remember these two things.
1. Know the user.
2. You are not the user (in most cases).
If you don’t know your
user base, their habits and tendencies, and why they do or do not perform
certain actions, then you can’t be expected to design a good experience for
them. Even if you are very similar to your users, remember that you are only
one person and that does not define the qualities of your user base as a whole.
Get to know your users and design the experience with them in mind. The role of
a UXer is to have that knowledge, constantly expand it, and then design with
those users in mind, crafting amazing experiences that will delight and fulfill
Let’s look at all the
possible steps a UXer might take in defining the UX of a product. These steps
create the ideal process. These steps aren’t always possible to complete in the
real world, but we need to cover all of them so that you’re aware when you can
leave out certain steps and why. Sometimes you don’t necessarily leave out a
step, but it is melded into another step, or replaced using a combination of
experience, knowledge, and intuition.
Requirements gathering is one of the first steps in designing
the UX. During this stage you need to ask a lot of questions. Many questions
may not be able to be answered right away but note those and be persistent.
There are several types of requirements:
1. Business Requirements: The goals and needs of other parts of your
company or what’s necessary to monetize the product. Unfortunately, this often
trumps some things you may want to do. It’s a necessary evil if your product is
anything beyond a project for pure enjoyment.
2. Design Requirements: Sometimes there may be special design
considerations or needs that must be met.
3. Technology Requirements: There could be a specific technology need
(platform, language, etc.) you need to consider in the design. What are your
4. User Requirements: Who is this product for? Who is the main
audience? Is there a fringe audience and, if so, who is it? Does it cover your
entire user base or support a subset?