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

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

Chapter 12 GUI Basics

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

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

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

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.

Java IDE Programming-I

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

Top-Level Containers

Swing. By Iqtidar Ali

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

Java 1.9 Swing Index

Java 11 Swing with Eclipse Index

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

Java 11 Swing Index. Section Title Page

Java 1.8 Swing with Eclipse Oxygen Index

Java 1.8 Swing with Eclipse Mars Index

Java 1.8 Swing with Eclipse Neon Index

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

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

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

Java Graphical User Interfaces

user-friendly and easy to use.

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

2110: GUIS: Graphical User Interfaces

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

INTRODUCTION TO (GUIS)

Chapter 6: Graphical User Interfaces

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

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

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

Introduction to the JAVA UI classes Advanced HCI IAT351

Packages: Putting Classes Together

1.1 GUI. JFrame. import java.awt.*; import javax.swing.*; public class XXX extends JFrame { public XXX() { // XXX. init() main() public static

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

Certified Eclipse Bundle

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

Summary Chapter 25 GUI Components: Part 2

CSE 1325 Project Description

Is image everything?

Lecture 18 Java Graphics and GUIs

Certified Eclipse Bundle

Graphical User Interface (GUI)

Introduction. Introduction

CSE 331 Software Design & Implementation

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

Graphical User Interfaces. Comp 152

China Jiliang University Java. Programming in Java. Java Swing Programming. Java Web Applications, Helmut Dispert

JBuilder 8.0 JFC and Swing Programming

Graphic User Interfaces. - GUI concepts - Swing - AWT

Window Interfaces Using Swing Objects

Object-Oriented Programming Design. Topic : User Interface Components with Swing GUI Part III

Datenbank-Praktikum. Universität zu Lübeck Sommersemester 2006 Lecture: Swing. Ho Ngoc Duc 1

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

Java: Graphical User Interfaces (GUI)

Java. GUI building with the AWT

John Zukowski's Definitive Guide to Swing for Java 2

DM550 / DM857 Introduction to Programming. Peter Schneider-Kamp

JComponent. JPanel. JFrame. JFrame JDialog, JOptionPane. JPanel. JPanel

Systems Programming Graphical User Interfaces

Graphics programming. COM6516 Object Oriented Programming and Design Adam Funk (originally Kirill Bogdanov & Mark Stevenson)

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

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

Dr. Hikmat A. M. AbdelJaber

CS 251 Intermediate Programming GUIs: Components and Layout

Goals. Lecture 7 More GUI programming. The application. The application D&D 12. CompSci 230: Semester JFrame subclass: ListOWords

core 2 Basic Swing GUI Controls in Java 2

core programming Basic Swing GUI Controls in Java Marty Hall, Larry Brown

PROGRAMMING DESIGN USING JAVA (ITT 303) Unit 7

Window Interfaces Using Swing Objects

Basicsof. JavaGUI and SWING

CPS122 Lecture: Graphical User Interfaces and Event-Driven Programming

Java Swing. Recitation 11/(20,21)/2008. CS 180 Department of Computer Science, Purdue University

encompass a group of features for building Graphical User Interfaces (GUI).

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

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

Swing. Component overview. Java UI, summer semester 2017/2018 1

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

Contents Introduction 1

Graphical User Interfaces in Java - SWING

Chapter 12 Advanced GUIs and Graphics

Containers and Components

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

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

1. Swing Note: Most of the stuff stolen from or from the jdk documentation. Most programs are modified or written by me. This section explains the

11/6/15. Objec&ves. RouleQe. Assign 8: Understanding Code. Assign 8: Bug. Assignment 8 Ques&ons? PROGRAMMING PARADIGMS

Part I: Learn Common Graphics Components

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

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

Agenda. Container and Component

Object Oriented Programming

Event Driven Programming

Programming graphics

CSE 331 Software Design & Implementation

Window Interfaces Using Swing. Chapter 12

Better GUI Controls Originals of Slides and Source Code for Examples:

Index SELF-STUDY. Symbols

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!

Transcription:

Swing UI by Vlad Costel Ungureanu for Learn Stuff

User Interface Command Line Graphical User Interface (GUI) Tactile User Interface (TUI) Multimedia (voice) Intelligent (gesture recognition) 2

Making the User Interface Design Designing containment surface Creating and placing visual components Functionality Defining actions Binding actions to components Listening and managing events 3

Making the User Interface 4

Swing A simple JFrame class MyFrame extends JFrame { public MyFrame (String title) { super(title);... // in a main class MyFrame myframe = new MyFrame ( A new window!"); myframe.setvisible(true); 5

Swing Adding components // create and add a new Button myframe.add(new Button("Hello")); // create a panel Panel mypanel = new Panel(); // add components to the panel mypanel.add(new Label("Name:")); mypanel.add(new TextField()); // add panel to frame myframe.add(panel); 6

Swing Event Driven Programming Atomic JLabel, JButton, JCheckBox, JRadioButton, JToggleButton, JScrollBar, JSlider, JProgressBar, JSeparator Complex JTable, JTree, JComboBox, JSpinner, JList, JFileChooser, JColorChooser, JOptionPane Content Editing JTextField, JFormattedTextField, JPasswordField, JTextArea, JEditorPane, JTextPane Menus JMenuBar, JMenu, JPopupMenu, JMenuItem, JCheckboxMenuItem, JRadioButtonMenuItem Containers JPanel, JScrollPane, JSplitPane, JTabbedPane, JDesktopPane, JToolBar High Level JFrame, JDialog, JWindow, JInternalFrame, JApplet 7

Swing Layout Manager A layout manager is an object that: Controls dimension and positioning of elements Each container has associated a layout manager. Container may have different layout managers as default: Frames: BorderLayout Panes: FlowLayout 8

Swing Border Layout import java.awt.*; public class TestBorderLayout { public static void main ( String args []) { Frame f = new Frame (" Border Layout "); f.setlayout (new BorderLayout()); f.add(new Button(" Nord "), BorderLayout.NORTH ); f.add(new Button(" South"), BorderLayout.SOUTH ); f.add(new Button(" Est"), BorderLayout.EAST ); f.add(new Button(" West"), BorderLayout.WEST ); f.add(new Button(" Center"), BorderLayout.CENTER ); f.pack (); f.setvisible(true); 9

Swing BridBag Layout GridBagLayout gridbag = new GridBagLayout(); container.setlayout(gridbag); GridBagConstraints c = new GridBagConstraints(); //restrictions c.fill = GridBagConstraints.HORIZONTAL; c.gridx = 0; c.gridy = 0; gridbag.setconstraints(componenta, c); container.add(componenta); 10

Swing Event Driven Programming Event: Pressing a button Selection or focus change Value change Property Change Source: The component generating the event Listener: Intercepts events Consumes events. 11

Swing Events 12

Swing Event Listeners class MyFrame extends Frame { public MyFrame ( String title) { super (title); setlayout (new FlowLayout ()); setsize (200, 100) ; Button b1 = new Button ("OK"); Button b2 = new Button ("Cancel"); add(b1); add(b2); listener = new MyButtonListener (this); b1.addactionlistener ( listener ); b2.addactionlistener ( listener ); 13

Swing Event Driven Programming class MyButtonListener implements ActionListener { private MyFrame frame; public MyButtonListener (MyFrame frame) { this.frame = frame; // Metoda interfetei ActionListener public void actionperformed (ActionEvent e) { frame.settitle ( You pressed" + e. getactioncommand ()); 14

Assignments Create a small Swing application that offers the following functionalities: Login Window Login functionality Main Window Two tabs: event form and event list Event form functionality Event form list Persist events serialized in a file 15

THANK YOU! Vlad Costel Ungureanu ungureanu_vlad_costel@yahoo.com This is a free course from LearnStuff.ro not for commercial use 16