Lab 7: BoxCar Class. Drawing a BoxCar Step 1:Create classes for Circle & Rectangle (done!) Step 2:Create a BoxCarPart class that can draw this part at.

Slides:



Advertisements
Similar presentations
LearnZillion Notes: --This is your hook. Start with a question to draw the student in. We want that student saying, “huh, how do you do X?” Try to be specific.
Advertisements

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.
Chapter 5 Programming Graphics. Chapter Goals To be able to write simple applications To display graphical shapes such as lines and ellipses To use colors.
Chapter 5 Programming Graphics. Chapter Goals To be able to write applications with simple graphical user interfaces To display graphical shapes such.
Exploring Word Grauer and Barber 1 Committed to Shaping the Next Generation of IT Experts. Chapter 4: Advanced Features: Tables, Styles, and Sections.
Chapter 5 Creating an Image Map.
Creating a Chartres Labyrinth 11 Steps to reproducing your own Chartres Labyrinth.
Ms. Blain’s 4 th grade!. -Round - Never Ending -Any point on the circle is the same distance from the center. Diameter = A line segment drawn from any.
Fundamentals of Engineering – Honors – ENGR H191 Lecture 4 - AutoCAD1 Question of the Day What show is this theme song from? ANSWER: MacGyver What is.
JVM-1 Java Virtual Machine Reading Assignment: Chapter 1: All Chapter 3: Sections.
Slides prepared by Rose Williams, Binghamton University Chapter 19 Swing II.
©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.
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 7 Pictorials Topics Exercises.
Java Review Structure of a graphics program. Computer Graphics and User Interfaces Java is Object-Oriented A program uses objects to model the solution.
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.
Java Concepts Chapter 2 – Graphical Applications Mr. Smith AP Computer Science A.
Multi-View Drawing (Text Chapter 8)
© 2008 Pearson Addison-Wesley. All rights reserved Chapter 1 Section 9-3 Perimeter, Area, and Circumference.
UML Basics & Access Modifier
Section aFind the area of a rectangle and a square. bFind the area of a parallelogram, a triangle, and a trapezoid. cSolve applied problems involving.
Lab 5: drawing and output User Interface Lab: GUI Lab Sep. 25 th, 2013.
Lecture 3 Drawing Basic Shapes Professor: Dr. Miguel Alonso Jr.
Lab 6: Shapes & Picture Extended Ellipse & Rectangle Classes Stand-Alone GUI Applications.
Engineering H191 - Drafting / CAD Gateway Engineering Education Coalition Lect 4P. 1Autumn Quarter Design Review, Isometric Drawings and Introduction.
Chapter 8. About the Midterm Exam.. Exam on March 12 Monday (Tentatively) Review on March 7 Wednesday Cover from Chapter 6 Grades will be out before spring.
Representing Data Sets MCC9–12.S.ID.1. Data can be represented graphically using a__________. Graphs provide a visual representation of data; just by.
Object Oriented Programming Lecture 5: BallWorld.
Big Java by Cay Horstmann Copyright © 2009 by John Wiley & Sons. All rights reserved. In order to display a drawing in a frame, define a class that extends.
MSc Workshop - © S. Kamin, U. ReddyLect 3 - GUI -1 Lecture 3 - Graphical User Interfaces r GUI toolkits in Java API r JFrame r GUI components.
DO NOW!!! (1 st ) 1.A rectangular prism has length 4 cm, width 5 cm, and height 9 cm. a) Find the area of the cross section parallel to the base. b) Find.
Creating HUD Rings. Step 1 Open a new document in Illustrator. You can set it to the size you prefer to work in. In my case I have it set at 500px by.
POS 407 Assignments Emilio Yanine. Workshop 3 Programming Assignment Implement FHiLo as an Applet, call it JHiLo2.java Modify applet to use multiple JPanels.
1.To begin click: File, New, then select Design 2.Draw a circle, then use the dimension tool to set it’s size to 84 diameter or 42 radius. 3. Next draw.
Lab 7: Tree & Forest. Drawing a Forest Created by Emily Hill & Jerry Alan Fails.
Drawing rectangles and ovals in the Applet window Displaying Text in the Java Console Window Demo of the HelloAgain program Arithmetic expressions Examples.
Design Studies 20 ‘Show Off’ Project How to make a computer monitor In Google Sketchup By: Liam Jack.
Graphics Concepts CS 2302, Fall /17/20142 Drawing in Android.
Introduction to Java Chapter 8 - Introduction to Java Graphics1 Chapter 8 Introduction to Java Graphics.
Geometric Construction
Review_6 AWT, Swing, ActionListener, and Graphics.
Graphics Primitives in Processing 1/14/2010. size(x, y) ; Sets the initial size of the screen Units are in pixels –Pixel == picture element –Small dots.
Introduction to Engineering Introduction to 2-D CAD Reference – CADKEY Project Book Chapter 3 – Creating Basic 2-D Geometry.
Week 7 Legends and Schedules. Objective This chapter discusses legends and schedules: what they are, the components they are used for, and how to draw.
Area of Composite Figures
Area of Composite Figures
Getting Started with GUI Programming Chapter 10 CSCI 1302.
CREATE A POWERPOINT MUST CONTAIN AT LEAST 8SLIDES INCLUDE ALL KEY CONCEPTS /lo_ _CH10_ pdf.
Microsoft Expression Web 3 Chapter 6 Adding Interactivity.
THERE ARE MANY INTERESTING & EASY WAYS FOR MULTIPLICATION OF NUMBERS. LET’S SEE ONE OF THE INTERESTING METHOD………..
How many …?. What shape can you see? I can see some _____. Q1 Q1 stars.
Basic Graphics 03/03/16 & 03/07/16 Imagine! Java: Programming Concepts in Context by Frank M. Carrano, (c) Pearson Education - Prentice Hall, 2010.
20) 108° 21) 80° 22) 70° 23) 123° 24) 38° 25) 167° 26) 10° 27) 154° 28) 105 = 2x – 11; x = 58 29) 6x x = 180; x = 23.
CompSci 4 Java 4 Apr 14, 2009 Prof. Susan Rodger.
CPCS 391 Computer Graphics Lab One. Computer Graphics Using Java What is Computer Graphics: Computer graphics are graphics created using computers and,
Opening Activity 1. What is the area of a rectangle with a length of 5 inches and a width of 12 inches? (Remember: A=lw) A=lw A=(5)(12) 2. What is the.
Area of Composite Figures
Name the shape below. rectangle rhombus square triangle A B C D
Chapter 1 Section 1.7 Area and Perimeter.
Chapter 1 Section 1.7 Area and Perimeter.
Objects First with Java
Chapter 14 JavaFX Basics Dr. Clincy - Lecture.
Area of a Parallelogram
CS 302 Week 10 Jim Williams.
CSc 110, Autumn 2017 Lecture 9: Graphics and Nested Loops
Extend Text Editor to Draw shapes
Volumes Of Solids. 8m 5m 7cm 5 cm 14cm 6cm 4cm 4cm 3cm 10cm.
CS 200 More Classes Jim Williams, PhD.
Outline Character Strings Variables and Assignment
~ Chapter 7 Section 3 Polygons are similar if: (Similar Polygons)
Presentation transcript:

Lab 7: BoxCar Class

Drawing a BoxCar

Step 1:Create classes for Circle & Rectangle (done!) Step 2:Create a BoxCarPart class that can draw this part at any x, y position and any width, height Step 3:Create a BoxCar class with at least 3 BoxCarParts

BoxCar = Multiple box car parts

BoxCarPart = Rectangle + Circle

Step 2: BoxCarPart class Create a new BoxCarPart class Has 2 fields: a circle for the wheel & a rectangle for the car Has a public method setBounds that takes: x, y, width, height –Car should start at x, y and extend to width & height –Wheel should be relative to the car: Wheel diameter should be about half the width Wheel should be drawn centered in the middle of the car, with half its diameter hanging below the car Has a constructor with 4 parameters: x, y, width, & height Has a paintComponent method that has a Graphics parameter and calls the corresponding paintComponent methods for the 2 fields Test: replace the circle & rectangle fields in PictureApp with a BoxCarPart and run/test Change the size of the BoxCarPart in the constructor and test that it works

Step 3: BoxCar class Create a new BoxCar class Has at least 3 BoxCarPart fields Has a constructor that takes 4 parameters: x, y, width, height Has a paintComponent method that has a Graphics parameter and calls the corresponding paintComponent methods for the 3 fields Test: replace BoxCarPart field in Picture with a BoxCar Modify position/sizes in the Picture constructor Look at how easy it is to aggregate components!

Homework Finish lab exercise (due after exam) –In addition to the BoxCar & BoxCarPart classes, make sure your Circle, Square, Rectangle, & Ellipse classes contain the following: 2 constructors (one default, one with parameters) getArea & getPerimeter methods A main method that tests (i.e., calls) getArea & getPerimeter –The Eclipse archive file you submit for this lab assignment should include the following: 4 shape classes: Circle, Square, Rectangle, & Ellipse BoxCarPart & BoxCar A Picture class that displays a 3-part box car – this should be a GUI Application (JPanel), not an Applet Prepare for the exam

General Review Lecture notes Class exercises Labs MyProgrammingLab Chapters 1-4 –Where Chapter 1 Chapter 2 Chapter 3 (except , ) Chapter 4 (except ) –What: Key concepts Concept summary Section headings For extra help look at the exercises