23
Java Intro Chris North cs3724: HCI

Java Intro Chris North cs3724: HCI. Presentations john randal, tom shultz Vote: UI Hall of Fame/Shame?

Embed Size (px)

Citation preview

Java Intro

Chris North

cs3724: HCI

Presentations

• john randal, • tom shultz

• Vote: UI Hall of Fame/Shame?

Quiz

• Visualization design principles:• show me the data

• Increase info density

• Overview first, zoom&filter, details on demand

• …

• How to map data to graphics?• 1. Data items become marks

• 2. Data values map to mark attributes

More Quiz

• Multi-dimensional data?• multiple attributes

• Types of scale in multi-dim data?• # points

• # attributes

• ranges of data values

• 3 multi-dim visualizations?• par coords

• Spotfire: mapping, brush&link, DQ

• Tablelens: graphical table

Data Scale

• # of attributes (dimensionality)

• # of items

• # of possible values (e.g. bits/value)

Spotfire

• Multiple views: brushing and linking

• Dynamic Queries

• Details window

TableLens (Eureka by Inxight)

• Visual encoding of cell values, sorting

• Details expand within context

Parallel Coordinates (XmdvTool)

• Par coords: 10-100 attrs, <1000 points

• Tablelens: 10-100 attrs, 1000, more by grouping

• Spotfire: 10 attrs, more w/ DQ, 100,000 pts

Homework #2: Info. Vis. Tools

• Get some data:• Tabular, >=5 attributes (columns), >=500 items (rows)

• Use 2 visualization tools + Excel:• Spotfire, TableLens, Parallel Coordinates

• Mcbryde 104c

• 2 page report:• Discoveries in data

• Comparison of tools

• Due:• Feb 19: A-K

• Feb 21: L-Z

Technologies

• VisualBasic• Fast prototyping• Help stinks• Lack of control, multi-threading, POWER!• Code tends to be ugly, variation, arbitrary

• Java• Power• Lots to learn• Slow development, except jbuilder?• Complexity• Tons of code• Help is good

Java materials

• Java 2 = sdk 1.2 or better• http://java.sun.com/j2se/

• Documentation:• http://java.sun.com/docs/

• Tutorials, reference, API

• Sams “Teach yourself Java2 in 21 days”

• Borland JBuilder 6• http://www.borland.com/jbuilder/personal/

• Free! Cross between VB and VC++

Java differences• Basic statements identical to C++• Object-oriented only!• No .h files• Garbage collection: no delete• No pointers (object references only)• GUI: AWT, Swing• Applet/application• Single inheritance, interfaces• Packaging• No global vars• Error Handling, exceptions (try, catch)

• E.g. Array bounds checking

• Security• Objects, components

Java compiling

• Code: • myclass.java (text file)

• Compile: •javac myclass.java• Creates: myclass.class (byte code)

• Run: •java myclass• Java virtual machine, interpets/compiles (machine code)

• Packaging: jar

• Or use JBuilder, like VC++

Java Applications

• Run from command line, like .exe

• HelloWorldApp.java:Class helloWorld {

public static void main(String[] args){

system.out.println(“Hello World!”);

}

}

• javac HelloWorldApp.java• Java HelloWorldAppHello World!

• Can be main( ) in any/all classes

Java Applets• Run in a web browser, like .ocx control• HelloWorldApplet.java:Import java.awt.*

public Class helloWorld extends javax.swing.JApplet {

public void init(){

setBackground(Color.white);

}

public void paint(Graphics g){

g.setColor(Color.black);

g.drawString(“Hello World!”, 10,10);

}

}

• javac HelloWorldApplet.java• appletviewer HelloWorldApplet

Hello World!

Java Applets

• HelloWorldApplet.html:<html><body>

<applet code=“HelloWorldApplet.class” height=100 width=200>

Need java.

</applet>

</body></html>

• Put .html and .class on website• Java plug-in

Hello World!

Applet Methods

• init( ) - initialization

• start( ) - resume processing (e.g. animations)

• stop( ) - pause

• destroy( ) - cleanup

• paint( ) - redraw stuff (‘expose’ event)

Applet Security

• No read/write on client machine

• Can’t execute programs on client machine

• Communicate only with server

• “Java applet window” Warning

• Certificates

JBuilder

Upcoming Java Topics

• GUIs: Swing, AWT, MVC

• Event handling, listeners

• Graphics

• Animation, threads

• Components, JavaBeans

• Databases, JDBC

Next

• Midterm: feb 26, tues

Presentations: proj1 design or UI critique

• Next Tues: mohamed hassoun, aaron dalton

• Next Thurs: nadine edwards, steve terhar

Project 2: Java

• Teams due today

• Get started on design

• 0: form teams of 3 (feb 14)

• 1: design (feb 28)

• 2: initial implementation (mid march)

• 3: final implementation (early April)