Java FX.

Slides:



Advertisements
Similar presentations
Introduction to Java 2 Programming
Advertisements

Problem Solving 6 GUIs and Event Handling ICS-201 Introduction to Computing II Semester 071.
Lecture 15 Graphical User Interfaces (GUI’s). Objectives Provide a general set of concepts for GUI’s Layout manager GUI components GUI Design Guidelines.
Chapter Day 10. © 2007 Pearson Addison-Wesley. All rights reserved4-2 Agenda Day 10 Questions from last Class?? Problem set 2 posted  10 programs from.
Chapter Day 9. © 2007 Pearson Addison-Wesley. All rights reserved4-2 Agenda Day 8 Questions from last Class?? Problem set 2 posted  10 programs from.
10.1 AWT The AWT classes Users today expect a Graphical User Interface (GUI) Improves application usability Difficult to implement cross-platform.
A.k.a. GUI’s.  If you want to discuss your Lab 2 grade come see me this week. ◦ Office: 436 ERB. One hour prior to class ◦ Open to Appointments MWF 
Written by Liron Blecher
3461A Readings from the Swing Tutorial. 3461A Overview  The follow is the Table of Contents from the trail “Creating a GUI with JFC/Swing” in the “The.
Introduction to Swing Components Chapter 14.  Part of the Java Foundation Classes (JFC)  Provides a rich set of GUI components  Used to create a Java.
Java Programming: Advanced Topics 1 Common Elements of Graphical User Interfaces Chapter 6.
Session 27 Swing vs. AWT. AWT (Abstract Window ToolKit) It is a portable GUI library for stand-alone applications and/or applets. The Abstract Window.
Ch 3-4: GUI Basics Java Software Solutions Foundations of Program Design Sixth Edition by Lewis & Loftus Coming up: GUI Components.
 2002 Prentice Hall, Inc. All rights reserved Introduction Graphical User Interface (GUI) –Gives program distinctive “look” and “feel” –Provides.
– Advanced Programming P ROGRAMMING IN Lecture 21 Introduction to Swing.
Graphic User Interface. Graphic User Interface (GUI) Most of us interact with computers using GUIs. GUIs are visual representations of the actions you.
Graphics and Event-Driven Programming in Java John C. Ramirez Department of Computer Science University of Pittsburgh.
Timer class and inner classes. Processing timer events Timer is part of javax.swing helps manage activity over time Use it to set up a timer to generate.
The Abstract Window Toolkit (AWT) supports Graphical User Interface (GUI) programming. AWT features include: a rich set of user interface components; a.
CS1054: Lecture 21 - Graphical User Interface. Graphical User Interfaces vs. Text User Interface.
Copyright © 2007 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 6 – Graphical User Interfaces Java Foundations: Introduction to Programming.
GUIs Graphical User Interfaces. Everything coming together Known: – Inheritance – Interfaces – Abstract classes – Polymorphism – Exceptions New: – Events.
Review_6 AWT, Swing, ActionListener, and Graphics.
Ajmer Singh PGT(IP) JAVA IDE Programming - I. Ajmer Singh PGT(IP) GUI (Graphical User Interface) It is an interface that uses a graphic entities along.
Liang, Introduction to Java Programming, Tenth Edition, (c) 2015 Pearson Education, Inc. All rights reserved. 1 Chapter 14 JavaFX Basics.
Chapter 10 - Writing Graphical User Interfaces1 Chapter 10 Writing Graphical User Interfaces.
Liang, Introduction to Java Programming, Tenth Edition, (c) 2015 Pearson Education, Inc. All rights reserved. 1 Chapter 14 JavaFX Basics.
Lecture 7:Introduction to JavaFX Michael Hsu CSULA.
12-Jun-16 Event loops. 2 Programming in prehistoric times Earliest programs were all “batch” processing There was no interaction with the user Input Output.
Lecture 7:Introduction to JavaFX Michael Hsu CSULA.
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 7 Event-Driven Programming and Basic GUI Objects.
Java Swing What is swing? Swing is a ”Lightweight” GUI ToolKit for Java Different from AWT / SWT Toolkits for GUIs Few lines of code to produce GUI elements.
Chapter 14 JavaFX Basics.
Java FX: Scene Builder.
Chapter 9: Graphical User Interfaces
Provision for GUIs in Java
Lecture 7:Introduction to JavaFX
A First Look at GUI Applications
Chapter 8: Writing Graphical User Interfaces
Event loops 16-Jun-18.
Processing Timer Events
Review: Java GUI Programming
Provision for GUIs in Java
Graphical User Interface (pronounced "gooey")
Building beautiful and interactive apps with HTML5 & CSS3
Chap 7. Building Java Graphical User Interfaces
Graphical User Interfaces -- Introduction
EE 422C Java FX.
Chapter 14 JavaFX Basics Dr. Clincy - Lecture.
Chapter 14 JavaFX Basics Dr. Clincy - Lecture.
Chapter 15 Event-Driven Programming and Animations
Timer class and inner classes
Recall: Timeline Class
.NET and .NET Core 7. XAML Pan Wuming 2017.
Event loops.
Event loops 17-Jan-19.
Event loops 17-Jan-19.
Lecture 9 GUI and Event Driven CSE /16/2019.
Week 8 Swing NetBeans GUI Builder
Web Development Using ASP .NET
Event loops 8-Apr-19.
Polishing and Running a Presentation
Chapter 14 JavaFX Basics Part 1
11.1 Applets & graphics.
CMPE212 – Reminders Assignment 5, a JavaFX GUI, due next Friday.
Event loops.
Event loops 19-Aug-19.
Graphical User Interface
Adobe Flash CS3 Revealed
Presentation transcript:

Java FX

Graphical Applications Java apps having graphical components Called GUI components GUI component An object representing a screen element Some are containers used to hold other components

Java FX Java FX New framework for developing GUI-based apps Replaces AWT and Swing Enables the development of RIA (Rich Internet Applications) Web apps with features similar to those of desktop apps Provides a multi-touch support Has built-in Animation, video and audio playback support

Anatomy of a JavaFX Application Main building blocks Stage equivalent to “JFrame” Scene equivalent of “JPanel” Nodes equivalent to “GUI components of Swing and AWT” Event handlers Timelines and transitions for animation purposes

Panes, UI controls, and Shapes

Layout Management An object Several predefined managers That determines the way components Are arranged in a container Several predefined managers Are provided by Java FX Layout managers are called Panes in Java-FX

Layout Panes

Flow Pane Example:

Grid Pane Example:

Border Pane Example:

HBox Example:

VBox Example:

Event Handling Interfaces GUI revolves around Components Events Handlers Event Represents some activity to which we may want to respond May be generated by a graphical component Event handler Defines what happens when an event occurs

A corresponding listener Events and Handlers Event Component A component object may generate an event Handler A corresponding listener object is designed to respond to the event When the event occurs, the component calls the appropriate method of the listener, passing an object that describes the event

Event handlers in Java FX A handler in JavaFX Must satisfy the following requirements It must implement the EventHandler<T extends Event> interface It must be registered with the event source

Events and Event sources

Events Details

Case Study1: Push Counter Application Displays a push button Increments a counter each time the button is pushed

Case Study2: Control Circle Application Uses two buttons to Control the size of a circle

Font Font is defined by Name, weight (bold), posture (italic/regular), and size

Color Opacity Defines the transparency of a color With the range 0.0 (completely transparent) to 1.0 (opaque)

Drawing Text Text is created using the Text class The latter is derived from the Shape super-class In the “ScatteredText” Eclipse project Text objects with random colors and positions are scattered about a Scene area

Image and ImageView The Image class The ImageView is a node Example: Represents a graphical image and Use to load an image from a specified URL The ImageView is a node For displaying an image Example:

Property binding A new concept introduced in JAVAFX, whereby A target object is bound to a source object Target object is called “binding property” and Implements “Property” interface The source object is called “Observable object” and Implements “ObservableValue” interface Binding properties are defined for primitive data types and String double/…/boolean => DoubleProperty/…/BooleanProperty String => StringProperty

Common Properties and Methods for Nodes Nodes share Style and rotate properties The style properties are similar to CSS The style is defined with a prefix –fx- Multiple style properties can be set together Example: : circle.setStyle(“-fx-stroke:black; -fx-fill: red;”); The rotate property Specifies an angle in degrees for rotating the node Example: button.setRotate(80);