CS 241 – Computer Programming II Lab Kalpa Gunaratna –

Slides:



Advertisements
Similar presentations
2D Graphics Drawing Things. Graphics In your GUI, you might want to draw graphics E.g. draw lines, circles, shapes, draw strings etc The Graphics class.
Advertisements

Mouse Listeners We continue our examination of GUIs by looking at how to interact with the mouse –Just as Java creates Events when the user interacts with.
Unit 3 Graphical User Interface (GUI) Dr. Magdi AMER.
Things to mention public static void main(String [] args) –The starting point for a free-standing Java application (i.e. one not run from the DrJava interactions.
Fall 2007CS 225 Graphical User Interfaces Event Handling Appendix C.
Chapter 6 Graphical User Interface (GUI) and Object-Oriented Design (OOD)
Chapter 41 Defining Classes and Methods Chapter 4.
Event Handling Events and Listeners Timers and Animation.
CSE 115 Week 5 February , Monday Announcements Exam 3 today Exam 3 today Lab 3 due this week Lab 3 due this week Exam 4 Monday 2/18 Exam.
Chapter 71 Inheritance Chapter 7. 2 Reminders Project 4 was due last night Project 5 released: due Oct 10:30 pm Project 2 regrades due by midnight.
CS 112 GUI 06 May 2008 Bilkent. Java GUI API Containers: ◦ contain other GUI components. E.g, Window, Panel, Applet, Frame Dialog. Components: ◦ Buttons,
Chapter 13: Advanced GUIs and Graphics J ava P rogramming: From Problem Analysis to Program Design, From Problem Analysis to Program Design, Second Edition.
This document is for informational purposes only. MICROSOFT MAKES NO WARRANTIES, EXPRESS OR IMPLIED, IN THIS DOCUMENT. © 2007 Microsoft Corporation. All.
University of British Columbia CPSC 111, Intro to Computation 2009W2: Jan-Apr 2010 Tamara Munzner 1 More Class Design Lecture 13, Wed Feb
CS 240 – Computer Programming I Lab Kalpa Gunaratna –
CS0007: Introduction to Computer Programming Introduction to Arrays.
Using Microsoft Outlook: Basics. Objectives Guided Tour of Outlook –Identification –Views Basics –Contacts –Folders –Web Access Q&A.
Chapter 6: Graphical User Interface (GUI) and Object-Oriented Design (OOD) J ava P rogramming: Program Design Including Data Structures Program Design.
Chapter 9 Introduction to ActionScript 3.0. Chapter 9 Lessons 1.Understand ActionScript Work with instances of movie clip symbols 3.Use code snippets.
CS 241 – Computer Programming II Lab Kalpa Gunaratna –
CS 240 – Computer Programming I Lab Kalpa Gunaratna –
CS 241 – Computer Programming II Lab Kalpa Gunaratna –
Chapter 13 Advanced GUIs and Graphics. Chapter Objectives Learn about applets Explore the class Graphics Learn about the class Font Explore the class.
Java Programming: From Problem Analysis to Program Design, 4e Chapter 12 Advanced GUIs and Graphics.
CS 241 – Computer Programming II Lab Kalpa Gunaratna –
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 343 Davis Hall
עקרונות תכנות מונחה עצמים תרגול 4 - GUI. Outline  Introduction to GUI  Swing  Basic components  Event handling.
CS 241 – Computer Programming II Lab Kalpa Gunaratna –
(c) University of Washington08-1 CSC 143 Models and Views Reading: Ch. 18.
Microsoft Word 2003 Welcome Shawano Students to the Introduction to the Word Program.
Lab 6: event & input intro User Interface Lab: GUI Lab Oct. 2 nd, 2013.
CSE115: Introduction to Computer Science I Dr. Carl Alphonce 343 Davis Hall
Ch 3-4: GUI Basics Java Software Solutions Foundations of Program Design Sixth Edition by Lewis & Loftus Coming up: GUI Components.
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.
Concurrent Programming and Threads Threads Blocking a User Interface.
Object Oriented Programming Engr. M. Fahad Khan Lecturer, Software Engineering Department University of Engineering & Technology, Taxila.
Fall 2004CS-321 Dr. Mark L. Hornick 1 Final Exam Monday Nov 13, 2-4pm CC-43 Bring Calculator – no laptops Note sheet Complete FAST entries before exam.
Creating Windows. How can we use Java to create programs that use windows (GUI applications)? How can we use Java to create programs that use windows.
CS 240 – Computer Programming I Lab Kalpa Gunaratna –
Lec.10 (Chapter 8 & 9) GUI Jiang (Jen) ZHENG June 27 th, 2005.
© Copyright by Deitel & Associates, Inc. and Pearson Education Inc. All Rights Reserved. 1 Outline 21.1 Test-Driving the Painter Application.
Swing / Session1 / 1 of 30 Module Introduction Distributed Computing in Java.
1 Project 5: Printing Address Labels. 2 Assignment Write a Windows forms program to display and print a set of address labels. Input from a csv file.
Java Programming: From Problem Analysis to Program Design, 3e Chapter 6 Graphical User Interface (GUI) and Object-Oriented Design (OOD)
Classes and Objects CS177 Rec 10. Announcements Project 4 is posted ◦ Milestone due on Nov. 12. ◦ Final submission due on Nov. 19. Exam 2 on Nov. 4 ◦
Java Programming: From Problem Analysis to Program Design, Second Edition1 Lecture 5 Objectives  Learn about basic GUI components.  Explore how the GUI.
Microsoft Visual Basic 2010 CHAPTER TWO Program and Graphical User Interface Design.
CS 240 – Computer Programming I Lab Kalpa Gunaratna –
Chapter 11 Enhancing an Online Form and Using Macros Microsoft Word 2013.
MSOffice PowerPoint 1 Part 2 ® Microsoft® Office 2010: Illustrated Introductory.
Computer Science [3] Java Programming II - Laboratory Course Lab 4 -1 : Introduction to Graphical user interface GUI Components Faculty of Engineering.
1 Android Development Lean and mean introduction Based on a presentation by Mihail L. Sichitiu.
CS 5JA Introduction to Java Graphics One of the powerful things about Java is that there is.
CS 240 – Computer Programming I Lab Kalpa Gunaratna –
Graphical User Interface (GUI)
Introduction to GUI Programming in Java: Frames, Simple Components, and Layouts.
Integrating Components and Dynamic Text Boxes with the Animated Map– Lesson 101 Integrating Components and Dynamic Text Boxes with the Animated Map Lesson.
CIS 270—Application Development II Chapter 11—GUI Components: Part I.
Graphical User Interfaces
CS 241 – Computer Programming II Lab
CS 241 – Computer Programming II Lab
CS 240 – Computer Programming I Lab
University of Central Florida COP 3330 Object Oriented Programming
CS 240 – Computer Programming I Lab
Program and Graphical User Interface Design
GUI AND GRAPHICS.
Creating Graphical User Interfaces
Model, View, Controller design pattern
Using Microsoft Outlook: Outlook Support Number
Presentation transcript:

CS 241 – Computer Programming II Lab Kalpa Gunaratna –

Contact  Contact by   Office hours  376 Joshi  Mondays & Wednesday 3:00 pm – 4:00 pm

Container  Each GUI component should be a part of the Containment Hierarchy.  JFrame & JPanel are two types of containers.  Containers are used to hold components.  Normally JPanel is placed inside a JFrame and in this way, JPanels could be arranged in any desired way and place components.  JFrame has a content pane and menu bar.  JPanel is a general purpose container.

Simple Graphics  For drawing, Graphics g object reference is used.  Each Container has Graphics g object & that reference could be used to draw any shape inside that specific Container.  Ex: to draw inside a JPanel, the relevant Graphics g object should be used. It could be parsed to a different class and used outside of the JPanel to draw shapes in JPanle for example.  paintComponent method has Graphics reference for drawing in JPanel.

In lab  Make "Ball" specific information and details into a separate class called Ball.  draw() and move() methods should be implemented in Ball class (you may keep the declaration of these methods in BallPanel and call Ball's methods inside these methods for better coding practices).  Values for variables in Ball class should be done in the Ball Constructor (random numbers in ranges mentioned in the assignment).  Use Math.random() to generate random number x in the range 0 <= x < 1.

Post lab  Make ArraList of Ball objects.  Handle each ball object in the list accordingly. paint() & draw() methods for each ball should be invoked accordingly.  Get the prefered number of balls from user in the BallPanel constructor using a dialog box. You can use a JoptionPane for this.

Reminders  Do not put JavaDocs in multiple line comments.  JavaDoc - /** */  Multiple line - /* */  Write test cases for the given format. Ex: input should also be printed.  == is checking whether its the same reference. Use compareTo or equalTo.  Marks will be deducted if net beans projects are not submitedto WebCT.