[go: up one dir, main page]

0% found this document useful (0 votes)
9 views4 pages

AJP Lecture 3 Notes - Ur Engineering Friend

The document provides an overview of Swing, a Java library for creating graphical user interfaces, highlighting its features such as improved functionality over AWT, portability, and support for MVC architecture. It also explains the MVC design pattern, detailing the roles of Model, View, and Controller in application development. Additionally, the document outlines the advantages of using MVC, including scalability, maintainability, and code reusability.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views4 pages

AJP Lecture 3 Notes - Ur Engineering Friend

The document provides an overview of Swing, a Java library for creating graphical user interfaces, highlighting its features such as improved functionality over AWT, portability, and support for MVC architecture. It also explains the MVC design pattern, detailing the roles of Model, View, and Controller in application development. Additionally, the document outlines the advantages of using MVC, including scalability, maintainability, and code reusability.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Advance Java

Lecture #3
Notes

Quote of the day: The expert in anything was once a beginner

What is Swing ?

Swing is a Java Foundation Classes JFC] library and an extension of the Abstract
Window Toolkit [AWT]. Swing offers much-improved functionality over AWT,
new components, expanded components features, excellent event handling
with drag and drop support.

 Swing is a Set Of API ( API- Set Of Classes and Interfaces )


 Swing is Provided to Design a Graphical User Interfaces
 Swing is an Extension library to the AWT (Abstract Window Toolkit)
 Includes New and improved Components that have been enhancing the
looks and Functionality of GUI’s
 Swing can be used to build(Develop) The Standalone swing GUI Apps
Also as Servlets And Applets
 It Employs model/view design architecture
 Swing is more portable and more flexible than AWT, The Swing is built
on top of the AWT
 Swing is Entirely written in Java
 Java Swing Components are Platform-independent And The Swing
Components are lightweight

MSBTE NEXT ICON COURSE YOUTUBE CHANNEL – UR ENGINEERING FRIEND


 Swing Supports Pluggable look and feels And Swing provides more
powerful components
 such as tables, lists, Scrollpanes, Colourchooser, tabbedpane, etc
 Further Swing Follows MVC

How to create frame in Swing ?


import javax.swing.*;
class gui{
public static void main(String args[]){
JFrame frame = new JFrame("My First GUI");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(300,300);
JButton button = new JButton("Press");
frame.getContentPane().add(button); // Adds Button to content pane
of frame
frame.setVisible(true);
}
}

MSBTE NEXT ICON COURSE YOUTUBE CHANNEL – UR ENGINEERING FRIEND


MVC Architecture

The Model-View-Controller (MVC) is a well-known design pattern in the web


development field. It is way to organize our code. It specifies that a program or
application shall consist of data model, presentation information and control
information. The MVC pattern needs all these components to be separated as
different objects.

 Model: It represents the business layer of application. It is an object to


carry the data that can also contain the logic to update controller if data is
changed.
 View: It represents the presentation layer of application. It is used to
visualize the data that the model contains.
 Controller: It works on both the model and view. It is used to manage
the flow of application, i.e. data flow in the model object and to update
the view whenever data is changed.

MSBTE NEXT ICON COURSE YOUTUBE CHANNEL – UR ENGINEERING FRIEND


1. A client (browser) sends a request to the controller on the server side, for
a page.
2. The controller then calls the model. It gathers the requested data.
3. Then the controller transfers the data retrieved to the view layer.
4. Now the result is sent back to the browser (client) by the view.

Advantages of MVC Architecture

 MVC has the feature of scalability that in turn helps the growth of
application.
 The components are easy to maintain because there is less dependency.
 A model can be reused by multiple views that provides reusability of
code.
 The developers can work with the three layers (Model, View, and
Controller) simultaneously.
 Using MVC, the application becomes more understandable.
 Using MVC, each layer is maintained separately therefore we do not
require to deal with massive code.
 The extending and testing of application is easier.

MSBTE NEXT ICON COURSE YOUTUBE CHANNEL – UR ENGINEERING FRIEND

You might also like