Java IDE Programming-I

Similar documents
Introduction p. 1 JFC Architecture p. 5 Introduction to JFC p. 7 The JFC 1.2 Extension p. 8 Swing p. 9 Drag and Drop p. 16 Accessibility p.

Swing. By Iqtidar Ali

Swing UI. Powered by Pentalog. by Vlad Costel Ungureanu for Learn Stuff

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

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

Introduction to the JAVA UI classes Advanced HCI IAT351

Graphical User Interfaces. Comp 152

Graphical User Interface (GUI)

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

Tool Kits, Swing. Overview. SMD158 Interactive Systems Spring Tool Kits in the Abstract. An overview of Swing/AWT

Contents Introduction 1

CS 251 Intermediate Programming GUIs: Components and Layout

Part 3: Graphical User Interface (GUI) & Java Applets

Chapter 12 GUI Basics

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

Chapter 6: Graphical User Interfaces

Is image everything?

Visit for more.

GUI Programming. Chapter. A Fresh Graduate s Guide to Software Development Tools and Technologies

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

Graphical User Interfaces (GUIs)

Graphical User Interface (GUI)

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

JTcl and Swank. Bruce A. Johnson, Tom Poindexter, & Dan Bodoh. What s new with Tcl and Tk on the JVM. Wednesday, October 26, 11

Lecture 18 Java Graphics and GUIs

The Abstract Windowing Toolkit. Java Foundation Classes. Swing. In April 1997, JavaSoft announced the Java Foundation Classes (JFC).

Rizvi College of Arts, Science & Commerce Bandra (W), Mumbai Teaching Plan Academic Year

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

CS111: PROGRAMMING LANGUAGE II

Graphics. Lecture 18 COP 3252 Summer June 6, 2017

2010 가을학기부산대학교정보컴퓨터공학부 OVERVIEW OF GUI PROGRAMMING

Java: Graphical User Interfaces (GUI)

Chapter 13 GUI Basics. Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved.

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

Graphical User Interfaces. Swing. Jose Jesus García Rueda

Parts of a Contract. Contract Example. Interface as a Contract. Wednesday, January 30, 13. Postcondition. Preconditions.

Systems Programming Graphical User Interfaces

CSE 331 Software Design & Implementation

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

Chapter 12 GUI Basics. Motivations. The design of the API for Java GUI programming

Topic 9: Swing. Swing is a BIG library Goal: cover basics give you concepts & tools for learning more

Topic 9: Swing. Why are we studying Swing? GUIs Up to now: line-by-line programs: computer displays text user types text. Outline. 1. Useful & fun!

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

CS 209 Spring, 2006 Lab 8: GUI Development Instructor: J.G. Neal

Chapter 12 Advanced GUIs and Graphics

Graphical User Interface (GUI)

Graphic User Interfaces. - GUI concepts - Swing - AWT

PROGRAMMING DESIGN USING JAVA (ITT 303) Unit 7

Week Chapter Assignment SD Technology Standards. 1,2, Review Knowledge Check JP3.1. Program 5.1. Program 5.1. Program 5.2. Program 5.2. Program 5.

Packages: Putting Classes Together

Window Interfaces Using Swing Objects

Lab 4. D0010E Object-Oriented Programming and Design. Today s lecture. GUI programming in

CS 251 Intermediate Programming GUIs: Event Listeners

Chapter 17 Creating User Interfaces

Java Swing. Lists Trees Tables Styled Text Components Progress Indicators Component Organizers

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

CSE 1325 Project Description

Window Interfaces Using Swing. Chapter 12

Agenda. Container and Component

Graphical User Interfaces

CPS122 Lecture: Graphical User Interfaces and Event-Driven Programming

BASICS OF GRAPHICAL APPS

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

DEMYSTIFYING PROGRAMMING: CHAPTER FOUR

Chapter 8: GUI Dialog & Table. Informatics Practices Class XII. By- Rajesh Kumar Mishra. KV No.1, AFS, Suratgarh

Lecture 9. Lecture

Jonathan Aldrich Charlie Garrod

Introduction to Graphical User Interfaces (GUIs) Lecture 10 CS2110 Fall 2008

Graphical interfaces & event-driven programming

Page 1 of 7. public class EmployeeAryAppletEx extends JApplet

WIMP Elements. GUI goo. What is WIMP?

TTTK Program Design and Problem Solving Tutorial 3 (GUI & Event Handlings)

Class 16: The Swing Event Model

Window Interfaces Using Swing Objects

Learn Java Programming, Dr.Hashamdar. Getting Started with GUI Programming

Event Driven Programming

John Zukowski's Definitive Guide to Swing for Java 2

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

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

JBuilder 8.0 JFC and Swing Programming

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

Frames, GUI and events. Introduction to Swing Structure of Frame based applications Graphical User Interface (GUI) Events and event handling

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

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

News and info. Array. Feedback. Lab 4 is due this week. It should be easy to change the size of the game grid.

Unit 6: Graphical User Interface

Summary Chapter 25 GUI Components: Part 2

Index SELF-STUDY. Symbols

Today. cisc3120-fall2012-parsons-lectiii.3 2

Computer Science 210: Data Structures. Intro to Java Graphics

Java 1.9 Swing Index

Java Graphical User Interfaces

Announcements. Introduction. Lecture 18 Java Graphics and GUIs. Announcements. CSE 331 Software Design and Implementation

Part I: Learn Common Graphics Components

2110: GUIS: Graphical User Interfaces

CSEN401 Computer Programming Lab. Topics: Graphical User Interface Window Interfaces using Swing

Java 1.8 Swing with Eclipse Oxygen Index

Java 1.8 Swing with Eclipse Mars Index

Java 1.8 Swing with Eclipse Neon Index

To gain experience using GUI components and listeners.

Transcription:

Java IDE Programming-I

Graphical User Interface : is an interface that uses pictures and other graphic entities along with text, to interact with user. User can interact with GUI using mouse click/ or keypress on keyboard.

GUI programming is done using Swing API. Swing is a set of customizable graphical component whose look and feel can be dictated at run time. Swing API is part of JFC.

Types of Swing Controls: Component self contained entity, customizable e.g JLabel, JTextField, JButton etc. Container- can hold other control e.g. JPanel, JFrame, JApplet, JDialog, and JInternalFrame etc. Child controls

Various Controls of Swing API: 1. Basic Controls: Simple controls for input or show simple state. e.g. JButton, JCheckBox, JComboBox, Jlist, JRadioButton,JSlider, JSpinner,JTextField, JPasswordField etc. 2. Interactive Displays: Display info. Highly formatted in nature and can be modified by user. e.g. JColorChooser, JEditorPane, JTextPane, JFileChooser, Jtable, JTextArea, Jtree. 3. Uneditable Infor. Display: Display info. That cant be edited. e.g. JLabel, JProgressBar, JSeparator, JToolTip. 4. Top Level Container: Atleast one of them is always present in any swing application. e.g. JApplet, JDialog,JFrame. 5. General Purpose: JPanel,JScrollPane, JSplitPane. 6. Specific Purpose: JInternalFrame, JlayeredFrame.

Starting GUI Application, Steps for Creation. We had already learnt this in previous Chapters. Handling Events: An event in Java is occurrence of an activity when something changes within a graphical user interface. If a user clicks on a button, clicks on a combo box, or types characters into a text field, etc., then an event triggers/ Activated. In order to react to occurrence of event, we need to create and implement a event handling mechanism in our application. Event Handling is the mechanism that controls the event and decides what should happen if an event occurs.

How Events Work? Event handling in Java is comprised of three key elements: (i) Event Source: GUI component that generates the event e.g a button. (ii) Event handler of Event Listener: a code that react to the event and compute. (iii) Event Object : whenever event occurs, event source creates a object and passes it to event listener, it contains all the necessary information about the event.

Types of Events Here are some of the most common types of events in Java:

Defining Event handlers and giving different names. Define event handler using contextual Menu

Java being OOP language, implements swing components as it implements classes. Object: is an identifiable entity with some characteristics (values/attributes associated with object) and behaviour (functions gen. called methods). Class: A class represent a set of objects that have a common structure and behaviour. It is blueprint that represent a set of similar objects. Objects are the instances of a class.

Working with Containers Every Swing application must have at least one top-level container (JFrame, JDialog, and JApplet) Each top level container has two commonly used intermediate containers: (i) A menu bar menus (ii) And content pane - components If no menu bar then content pane expands to fill that area.

Customizing Frame Appearance 1. Appearance is governed by its layout and property setting. 2. By default BorderLayout Properties: title cursor- Crosshair, East resize, West resize etc. Iconimage icon appears on title bar Resizable- resizing at runtime is possible Default CloseOperation do_nothing, hide, dispose, exit_on_close

Working with Panel A panel is a type of container that s designed to hold a group of components so they can be displayed on a frame. Adding panel to JFrame. Adding components to Panels. Adding Look to Panel setting layout, properties like boarder, background, tooltip etc.

Using HTML in swing components: We can use HTML for formatting text such as Multiple lines, Use <html> tag at the beginning of the text.

A function or Method in Java A method is a set of code which is referred to by name and can be called (invoked) at any point in a program simply by utilizing the method's name. Think of a method as a subprogram that acts on data and often returns a value.

When that name is encountered in a program, the execution of the program branches to the body of that method. When the method is finished, execution returns to the area of the program code from which it was called, and the program continues on to the next line of code.

There are two basic types of methods: Built-in: Build-in methods are part of the compiler package, such as System.out.println( ) and System.exit(0). User-defined: User-defined methods are created by you, the programmer. These methods take-on names that you assign to them and perform tasks that you create.

Syntax: modifier returntype nameofmethod (Parameter List) { // method body } public static int methodname(int a, int b) { } // body Here, public static modifier int return type methodname name of the method a, b formal parameters int a, int b list of parameters

Working with push buttons and their properties: covered in previous chapter

Assigning access key: TO assign access key to command button use mnemonic property (Appindix A)

Working with push buttons and their properties: covered in previous chapter

Using Action Command in Button: The Action Command Property of a button is a string that can identify the button that has fired an action event. We can use getactioncommand method to obtain value of actioncommand property. For this we will use parameter of actionperformed() event handler. In case of Calculator -multiple buttons can be assigned the same event handler.

CHECK BOX

CHECK BOX