SD Module-1 Advanced JAVA. Assignment No. 4

Similar documents
SD Module-1 Advanced JAVA

GUI in Java TalentHome Solutions

PROGRAMMING DESIGN USING JAVA (ITT 303) Unit 7

Packages: Putting Classes Together

Table of Contents. Chapter 1 Getting Started with Java SE 7 1. Chapter 2 Exploring Class Members in Java 15. iii. Introduction of Java SE 7...

CSE 143. Event-driven Programming and Graphical User Interfaces (GUIs) with Swing/AWT

SD Module-1 Advanced JAVA

Control Flow: Overview CSE3461. An Example of Sequential Control. Control Flow: Revisited. Control Flow Paradigms: Reacting to the User

Example Programs. COSC 3461 User Interfaces. GUI Program Organization. Outline. DemoHelloWorld.java DemoHelloWorld2.java DemoSwing.

GUI Program Organization. Sequential vs. Event-driven Programming. Sequential Programming. Outline

Swing. By Iqtidar Ali

COMPSCI 230. Software Design and Construction. Swing

GUI Basics. Object Orientated Programming in Java. Benjamin Kenwright

Introduction to the JAVA UI classes Advanced HCI IAT351

CSE 331. Event-driven Programming and Graphical User Interfaces (GUIs) with Swing/AWT

All the Swing components start with J. The hierarchy diagram is shown below. JComponent is the base class.

Graphics. Lecture 18 COP 3252 Summer June 6, 2017

Chapter 6: Graphical User Interfaces

11/7/12. Discussion of Roulette Assignment. Objectives. Compiler s Names of Classes. GUI Review. Window Events

Sri Vidya College of Engineering & Technology

Window Interfaces Using Swing Objects

Systems Programming Graphical User Interfaces

Java Graphical User Interfaces AWT (Abstract Window Toolkit) & Swing

CSE 331. Event- driven Programming and Graphical User Interfaces (GUIs) with Swing/AWT

BASICS OF GRAPHICAL APPS

Advanced Java Programming (17625) Event Handling. 20 Marks

CS111: PROGRAMMING LANGUAGE II

CONTENTS. Chapter 1 Getting Started with Java SE 6 1. Chapter 2 Exploring Variables, Data Types, Operators and Arrays 13

MODEL UPDATES MANIPULATES USER

Handling Mouse and Keyboard Events

Window Interfaces Using Swing Objects

The AWT Event Model 9

Graphical User Interfaces (GUIs)

Graphic User Interfaces. - GUI concepts - Swing - AWT

14.2 Java s New Nimbus Look-and-Feel 551 Sample GUI: The SwingSet3 Demo Application As an example of a GUI, consider Fig. 14.1, which shows the SwingS

GUI DYNAMICS Lecture July 26 CS2110 Summer 2011

Java & Graphical User Interface II. Wang Yang wyang AT njnet.edu.cn

Dr. Hikmat A. M. AbdelJaber

GUI Software Architecture

Lecture 5: Java Graphics

GUI Design. Overview of Part 1 of the Course. Overview of Java GUI Programming

Graphical Applications

Overloading Example. Overloading. When to Overload. Overloading Example (cont'd) (class Point continued.)

Swing from A to Z Some Simple Components. Preface

Graphical User Interfaces. Comp 152

Module 4 Multi threaded Programming, Event Handling. OOC 4 th Sem, B Div Prof. Mouna M. Naravani

GUI Programming: Swing and Event Handling

Course Status Networking GUI Wrap-up. CS Java. Introduction to Java. Andy Mroczkowski

Handout 14 Graphical User Interface (GUI) with Swing, Event Handling

Starting Out with Java: From Control Structures Through Objects Sixth Edition

Basicsof. JavaGUI and SWING

Which of the following syntax used to attach an input stream to console?

Programming graphics

Unit 7: Event driven programming

G51PRG: Introduction to Programming Second semester Applets and graphics

Chapter 8. Java continued. CS Hugh Anderson s notes. Page number: 264 ALERT. MCQ test next week. This time. This place.

Java continued. Chapter 8 ALERT ALERT. Last week. MCQ test next week. This time. This place. Closed book. Assignment #2 is for groups of 3

Java AWT Windows, Text, & Graphics

Example: CharCheck. That s It??! What do you imagine happens after main() finishes?

Marcin Luckner Warsaw University of Technology Faculty of Mathematics and Information Science

Introduction to concurrency and GUIs

Virtualians.ning.pk. 2 - Java program code is compiled into form called 1. Machine code 2. native Code 3. Byte Code (From Lectuer # 2) 4.

CSE 331 Software Design & Implementation

CS 251 Intermediate Programming GUIs: Event Listeners

BM214E Object Oriented Programming Lecture 13

Lecture 3: Java Graphics & Events

UNIT-3 : MULTI THREADED PROGRAMMING, EVENT HANDLING. A Multithreaded program contains two or more parts that can run concurrently.

Programming Mobile Devices J2SE GUI

กล ม API ท ใช. Programming Graphical User Interface (GUI) Containers and Components 22/05/60

Graphical User Interface (GUI) components in Java Applets. With Abstract Window Toolkit (AWT) we can build an applet that has the basic GUI

Outline. Topic 9: Swing. GUIs Up to now: line-by-line programs: computer displays text user types text AWT. A. Basics

CS11 Java. Fall Lecture 3

CPS122 Lecture: Graphical User Interfaces and Event-Driven Programming

Introduction to GUIs. Principles of Software Construction: Objects, Design, and Concurrency. Jonathan Aldrich and Charlie Garrod Fall 2014

Event Driven Programming

CSE Lab 8 Assignment Note: This is the last lab for CSE 1341

GUI Event Handlers (Part I)

Essential Series. Springer-Verlag London Ltd.

Assignment No 2. Year: Dept.: ComputerTech. Sanjivani Rural Education Society s Sanjivani KBP Polytechnic, Kopargaon

Outline. More on the Swing API Graphics: double buffering and timers Model - View - Controller paradigm Applets

(listener)... MouseListener, ActionLister. (adapter)... MouseAdapter, ActionAdapter. java.awt AWT Abstract Window Toolkit GUI

Java Swing. based on slides by: Walter Milner. Java Swing Walter Milner 2005: Slide 1

CS11 Java. Fall Lecture 4

Lecture 19 GUI Events

To gain experience using GUI components and listeners.

Java. GUI building with the AWT

Java: Graphical User Interfaces (GUI)

Introduction to Graphical Interface Programming in Java. Introduction to AWT and Swing

Widgets. Overview. Widget. Widgets Widget toolkits Lightweight vs. heavyweight widgets Swing Widget Demo

IS311 Programming Concepts. GUI Building with Swing

Agenda. GUI Building with Swing ต องม พ นความร ต อไปน ก อน. Java Graphical User Interfaces. IS311 Programming Concepts

Swing from A to Z Using Focus in Swing, Part 2. Preface

Command-Line Applications. GUI Libraries GUI-related classes are defined primarily in the java.awt and the javax.swing packages.

EVENTS, EVENT SOURCES AND LISTENERS

Advanced Java Programming. Swing. Introduction to Swing. Swing libraries. Eran Werner, Tel-Aviv University Summer, 2005

COMP-202 Unit 10: Basics of GUI Programming (Non examinable) (Caveat: Dan is not an expert in GUI programming, so don't take this for gospel :) )

Graphical User Interface (GUI)

ASSIGNMENT NO 14. Objectives: To learn and demonstrated use of applet and swing components

MIT AITI Swing Event Model Lecture 17

Programming Languages and Techniques (CIS120e)

Transcription:

SD Module-1 Advanced JAVA Assignment No. 4 Title :- Transform the above system from command line system to GUI based application Problem Definition: Write a Java program with the help of GUI based Application Perform Various Operation on Student database like Add Student, Search Student, Deleted Student and Failed Student List etc. 1.1 Prerequisite: Basic concepts of AWT and Event in Java. Concepts of Swing in java. 1.2 Software Requirements: Eclipse SDK 1.3 Tools/Framework/Language Used: Concepts of Swing and AWT. 1.4 Hardware Requirement: PIV, 2GB RAM, 500 GB HDD, Lenovo A13-4089 Model 1.5 Learning Objectives: Understand the implementation of the GUI based Application using Swing, AWT Concept. 1.6 Outcomes: After completion of this assignment student are able to implement the concept of Swing and AWT in GUI based Application in easy way. 1.7 Theory Concepts: Java AWT (Abstract Window Toolkit) is an API to develop GUI or window-based applications in java. Java AWT components are platform-dependent i.e. components are displayed according to the view of operating system. AWT is heavyweight i.e. its components are using the resources of OS. The java.awt package provides classes for AWT api such as TextField, Label, TextArea, RadioButton, CheckBox, Choice, List etc. Java AWT Hierarchy The hierarchy of Java AWT classes are given below. Container Pune Vidyarthi Griha s COLLEGE OF ENGINEERING, NASHIK 4. 1

The Container is a component in AWT that can contain another components like buttons, textfields, labels etc. The classes that extends Container class are known as container such as Frame, Dialog and Panel. Window The window is the container that have no borders and menu bars. You must use frame, dialog or another window for creating a window. Panel The Panel is the container that doesn't contain title bar and menu bars. It can have other components like button, textfield etc. Frame The Frame is the container that contain title bar and can have menu bars. It can have other components like button, textfield etc. Useful Methods of Component class Method Description public void add(component c) inserts a component on this component. public void setsize(int width,int height) sets the size (width and height) of the component. public void setlayout(layoutmanager m) defines the layout manager for the component. public void setvisible(boolean status) changes the visibility of the component, by default false. To create simple awt example, you need a frame. There are two ways to create a frame in AWT. By extending Frame class (inheritance) By creating the object of Frame class (association) Pune Vidyarthi Griha s COLLEGE OF ENGINEERING, NASHIK 4. 2

Swing Java Swing tutorial 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 lightweight components. The javax.swing package provides classes for java swing API such as JButton, JTextField, JTextArea, JRadioButton, JCheckbox, JMenu, JColorChooser etc. Difference between AWT and Swing There are many differences between java awt and swing that are given below. No. Java AWT 1) AWT components are platform-dependent. 2) AWT components are heavyweight. 3) AWT doesn't support pluggable look and feel. 4) AWT provides less components than Swing. AWT doesn't follows MVC(Model View Controller) where 5) model represents data, view represents presentation and controller acts as an interface between model and view. Java Swing Java swing components are platformindependent. Swing components are lightweight. Swing supports pluggable look and feel. Swing provides more powerful components such as tables, lists, scrollpanes, colorchooser, tabbedpane etc. Swing follows MVC. The hierarchy of java swing API is given below. Pune Vidyarthi Griha s COLLEGE OF ENGINEERING, NASHIK 4. 3

Commonly used Methods of Component class The methods of Component class are widely used in java swing that are given below. Method public void add(component c) Description add a component on another component. sets size of the component. public void setsize(int width,int height) public void setlayout(layoutmanager m) sets the layout manager for the component. public void setvisible(boolean b) sets the visibility of the component. It is by default false. Java Swing Examples There are two ways to create a frame: By creating the object of Frame class (association) By extending Frame class (inheritance) We can write the code of swing inside the main(), constructor or any other method. Java ActionListener Interface The Java ActionListener is notified whenever you click on the button or menu item. It is notified against ActionEvent. The ActionListener interface is found in java.awt.event package. It has only one method: actionperformed(). The Java MouseListener is notified whenever you change the state of mouse. It is notified against MouseEvent. The MouseListener interface is found in java.awt.event package. It has five methods. The Java ItemListener is notified whenever you click on the checkbox. It is notified against ItemEvent. The ItemListener interface is found in java.awt.event package. It has only one method: itemstatechanged(). The Java KeyListener is notified whenever you change the state of key. It is notified against KeyEvent. The KeyListener interface is found in java.awt.event package. It has three methods. The Java WindowListener is notified whenever you change the state of window. It is notified against WindowEvent. The WindowListener interface is found in java.awt.event package. It has three methods. Java adapter classes provide the default implementation of listener interfaces. If you inherit the adapter class, you will not be forced to provide the implementation of all the methods of listener interfaces. So it saves code. The adapter classes are found in java.awt.event, java.awt.dnd and javax.swing.event packages. The Adapter classes with their corresponding listener interfaces are given below. java.awt.event Adapter classes Adapter class Listener interface WindowAdapter WindowListener KeyAdapter KeyListener MouseAdapter MouseListener MouseMotionAdapter MouseMotionListener Pune Vidyarthi Griha s COLLEGE OF ENGINEERING, NASHIK 4. 4

FocusAdapter FocusListener ComponentAdapter ComponentListener ContainerAdapter ContainerListener HierarchyBoundsAdapter HierarchyBoundsListener 1.8.1 Design and Program Flow: 1. Write Student.java program for Display the Student details like Roll no, name and marks. 2. Write Client.java program Perform Various Operation on Student database like Add Student, Search Student, Deleted Student and Failed Student List etc. 3. Write Operation.java program perform various Operations using ArrayList. 4. Write ServerDemo.java program for Connection establishment with Client. 5. Write Db.java program for Open and Close Connection using MySql. 6. Write ClientUI.java program for design GUI based application to perform all operation. 1.8.2 Conclusion: In this way now students are able to implement the GUI based application using Swing concept successfully. 1.9 Assignment Questions: 1. What is Event-Dispatcher-Thread (EDT) in Swing? 2. What are differences between Swing and AWT? 3. Why Swing components are called lightweight components? 4. What is Action Listener? 5. What is Event? 1. 9.1 Oral Questions: 1. What is JFC? 2. What is Layout Manager? 3. What is Spring Layout? 4. What is Box Layout? 5. What is Gridbag Layout? 1.9.2 References : 1. https://www.javatpoint.com/java-springlayout Pune Vidyarthi Griha s COLLEGE OF ENGINEERING, NASHIK 4. 5