Introduction to Java February 27, 2008 1 What is Alice? A - - PowerPoint PPT Presentation

introduction to java
SMART_READER_LITE
LIVE PREVIEW

Introduction to Java February 27, 2008 1 What is Alice? A - - PowerPoint PPT Presentation

Introduction to Java February 27, 2008 1 What is Alice? A programming environment 2 Tuesday, October 7, 2008 What is Alice? A programming language 3 What is Alice? A library of graphic objects 4 Tuesday, October 7, 2008 What is Alice?


slide-1
SLIDE 1

Introduction to Java

February 27, 2008

What is Alice?

A programming environment 1 2 Tuesday, October 7, 2008

slide-2
SLIDE 2

What is Alice?

A programming language

What is Alice?

A library of graphic objects 3 4 Tuesday, October 7, 2008

slide-3
SLIDE 3

What is Alice?

A tool that runs animations

What about Java?

A programming environment - BlueJ 5 6 Tuesday, October 7, 2008

slide-4
SLIDE 4

What about Java?

A programming language

What about Java?

A huge library (but less visual)

2D Graphical shapes - circles, lines, ... User interface elements - buttons, sliders, ... Networking Image manipulation... Many, many things

7 8 Tuesday, October 7, 2008

slide-5
SLIDE 5

What about Java?

A tool for running a wide range of applications

Objects

in Alice in Java 9 10 Tuesday, October 7, 2008

slide-6
SLIDE 6

Classes

in Alice in Java

Methods in Alice

11 12 Tuesday, October 7, 2008

slide-7
SLIDE 7

Methods in Java Types

in Alice in Java Number Boolean Object int double boolean Penguin Location Train ... 13 14 Tuesday, October 7, 2008

slide-8
SLIDE 8

Event Handling

in Alice in Java

Creating Objects

in Alice in Java 15 16 Tuesday, October 7, 2008

slide-9
SLIDE 9

Class Method

Anatomy of a Java Class

Parameter Instruction public class FallBreak extends FrameWindowController { public void onMousePress (Location point) { new Text ("Fall break is coming!", 40, 100, canvas); } public void onMouseRelease (Location point) { canvas.clear(); } }

Coordinate System

Coordinates measure pixels, the smallest dot

  • f color a display can make

Cartesian coordinates

(0,0) 100

  • 100
  • 100

100

Display coordinates

(0,0) 100 100

17 18 Tuesday, October 7, 2008

slide-10
SLIDE 10

Methods & Constructors

Method call Constructor call

public class FallBreak extends FrameWindowController { public void onMousePress (Location point) { new Text ("Fall break is coming!", 40, 100, canvas); } public void onMouseRelease (Location point) { canvas.clear(); } }

Event Handling in Alice

Need to tell Alice, which method to call when an event occurs An event can be for any mouse click or only when the mouse clicks on a specific object 19 20 Tuesday, October 7, 2008

slide-11
SLIDE 11

Event Handling

public class FallBreak extends FrameWindowController { public void onMousePress (Location point) { new Text ("Fall break is coming!", 40, 100, canvas); } public void onMouseRelease (Location point) { canvas.clear(); } }

Summary

Many similarities in programming concepts Alice - limited to creating animations Java - wide applicability Alice programming environment - menu, drag&drop eliminates syntax errors, but clumsy Java programming environment - less clumsy, but requires learning syntax

21 22 Tuesday, October 7, 2008