Chapter 14 JavaFX Basics Part 2

Slides:



Advertisements
Similar presentations
Chapter 13 Graphics.
Advertisements

CHAPTER 20 CREATING SVG GRAPHICS. LEARNING OBJECTIVES How to embed a graphic stored within a.SVG file in an HTML page How to use the and tag pair to specify.
Graphics You draw on a Graphics object The Graphics object cannot directly be created by your code, instead one is generated when the method paintComponent.
GUI and Swing, part 2 The illustrated edition. Scroll bars As we have previously seen, a JTextArea has a fixed size, but the amount of text that can be.
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved Chapter 14 Graphics.
Liang, Introduction to Java Programming, Fifth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 13 Graphics.
©The McGraw-Hill Companies, Inc. Permission required for reproduction or display. 4 th Ed Chapter Java Applets What is an Applet? How do you create.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved L01 (Chapter 13) Graphics.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved L02 (Chapter 13) Graphics.
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved COS240 Object-Oriented Languages.
General Purpose Packages GRAPHICS Chapter 5. General Purpose Packages Features of Graphics Packages Entering text Entering text Common tools Common tools.
Chapter 7 Vocab Review. 1. Write the generic formula (proportion) for geometric mean (x) of two positive numbers a & b.
Agenda Java Coordinate Systems. Graphics Class. Drawing on Panels. Drawing Shapes.
Graphics basic 1. 2 Objectives Understand Java coordinate systems. Draw things using the methods in the Graphics class. Override the paintComponent method.
Liang, Introduction to Java Programming, Seventh Edition, (c) 2009 Pearson Education, Inc. All rights reserved COS240 O-O Languages AUBG,
Graphics and Java2D Chapter Java Coordinate System Origin is in _____________ corner –Behind title bar of window X values increase to the ________.
Introductory Graphics Chapter Three. Computer Graphics §Full motion pictures (“Star Wars”) l animated films §Virtual reality §Games §Simulators (air craft.
Liang, Introduction to Java Programming, Tenth Edition, (c) 2015 Pearson Education, Inc. All rights reserved. 1 Chapter 15 Event-Driven Programming and.
Clearly Visual Basic: Programming with Visual Basic 2008 Chapter 16 I’m on the Inside; You’re on the Outside.
Liang, Introduction to Java Programming, Tenth Edition, (c) 2015 Pearson Education, Inc. All rights reserved. 1 Chapter 14 JavaFX Basics.
Liang, Introduction to Java Programming, Tenth Edition, (c) 2015 Pearson Education, Inc. All rights reserved. 1 Chapter 15 Event-Driven Programming and.
Processing Variables. Variables Processing gives us several variables to play with These variables are always being updated and you can assume they have.
Parts of the Clock Click on the minute hand. Click on the clock’s face.
Telling Time can be Fun!. First Goal Learn the unique parts of a clock!
Getting Started with GUI Programming Chapter 10 CSCI 1302.
Section §14.1 Introduction  Graphical User Interface (GUI) applications, as opposed to console UI applications, rely heavily on objects  JavaFX.
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.
Java Visual Applications CSIS 3701: Advanced Object Oriented Programming.
Jeopardy Terminology Quiz Geometry All points on a circle are the same distance from this point. (100)
Lecture 7:Introduction to JavaFX Michael Hsu CSULA.
Constructions Bisect – To divide something into two equal parts Perpendicular – Lines that intersect to form right angles. Today’s constructions: –Bisect.
JavaFX Introduction Silveira Neto Sun Campus Ambassador
 AutoCAD Ellipse Command AutoCAD Ellipse Command  AutoCAD Arc Command AutoCAD Arc Command  AutoCAD Polygon Command AutoCAD Polygon Command  AutoCAD.
Week 6 Drafting 1309: Basic CAD Andrew Amini Professor Drafting and Design Engineering Technology, HCC.
Surface area of a cylinder Imagine a cylinder opened out Rectangle Circle.
Chapter 14 JavaFX Basics.
Do Now 1.) Explain the difference between a chord and a secant.
Drawing Geometric Objects
Chapter 15 Event-Driven Programming and Animations
Java Programming Java FX.
Lecture 7:Introduction to JavaFX
Equations of Circles.
Basic Graphics Chapter 5 3/19/15 Thursday Section Only
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
Construct an Octagon Inside of a Circle
CMPE212 – Stuff… Assignment 4 due March 23 – this Friday.
Equations of Circles.
Chapter 5, Conditionals Brief Notes
Chapter 2 Graphics Programming with C++ and the Dark GDK Library
Extend Text Editor to Draw shapes
Just Basic Lesson 18 Mr. Kalmes.
4.1 Equations of circles Arcs, Inscribed Angles, Central Angles
Inheritance in Graphics
Chapter 13 Graphics.
Chapter 14 JavaFX Basics Part 1
Chapter 15 Event-Driven Programming and Animations Part 1
Final Review Dr. Xiaolin Hu.
mathematics: Word of the DAy!
Rectangle, x = 100, y = 200 Ellipse, x = 200, y = 300 #1.
Using JavaFX Applications
Introduction to Java FX
Chapter 13 Graphics.
Chapter 14 JavaFX Basics.
Chapter Equations of Circles.
Presenting Data Ways to organize and present data: *Data Tables
Presentation transcript:

Chapter 14 JavaFX Basics Part 2

Shapes JavaFX provides many shape classes for drawing text, lines, rectangles, circles, ellipses, arcs, polygons, and polylines

Text ShowText Run

Line ShowLine Run

Rectangle ShowRectangle Run

Circle

Ellipse ShowEllipse Run

Arc ShowArc Run

Polygon & Polyline ShowPolygon Run

Case Study: The ClockPane Class ClockPane displays the time on a static analog clock DisplayClock Run

What info about ClockPane is needed to write DisplayClock? // import statements public class DisplayClock extends Application { public void start(Stage primaryStage) { ClockPane clock = new ClockPane(); String timeString = clock.getHour() + ":" + clock.getMinute() + ":" + clock.getSecond(); Label lblTime = new Label(timeString); BorderPane pane = new BorderPane(); pane.setCenter(clock); pane.setBottom(lblCurrentTime); BorderPane.setAlignment(lblTime, Pos.TOP_CENTER); Scene scene = new Scene(pane, 250, 250); primaryStage.setTitle("DisplayClock"); primaryStage.setScene(scene); primaryStage.show(); } What info about ClockPane is needed to write DisplayClock? All needed info is available on the previous slide. We don’t need to see the code for ClockPane to write the DisplayClock class. This means that ClockPane is a well designed class

ClockPane: The Details ClockPane displays a clock for the current time or for a time specified in terms of hour, minute and second The current hour, minute & second is obtained using the get(Calendar.HOUR), get(Calendar.MINUTE) and get(Calendar.SECOND) methods of GregorianCalendar The w & h properties represent the width & height of the Pane paintClock() places eight items in the Pane using addAll(): Circle at the center of the pane with a radius proportional to w & h Text shapes for the hours 12, 3, 6, 9 Line shapes for second, minute and hour hands paintClock() is invoked whenever a new property (w, h, hour, minute, second) is set. The old contents of the Pane are removed using clear() before any update ClockPane