Developing User Interfaces DUI - PowerPoint PPT Presentation

1 / 17
About This Presentation
Title:

Developing User Interfaces DUI

Description:

java hello. Java virtual machine, interpets/compiles (machine code) Packaging: jar ... hello.class. goodbye.class. blah.class. foo.class. bar.class ... – PowerPoint PPT presentation

Number of Views:163
Avg rating:3.0/5.0
Slides: 18
Provided by: chris78
Category:

less

Transcript and Presenter's Notes

Title: Developing User Interfaces DUI


1
Developing User Interfaces(DUI)
  • Chris North
  • cs3724 HCI

2
GUI Development Goals
  • Learn general GUI programming concepts
  • GUI components
  • Layout
  • Event-based programming
  • Graphics
  • Animation
  • Learn Java
  • Swing
  • Layout managers
  • Listerners
  • 2D graphics
  • Threads
  • Then can learn other languages quickly
  • VB, C, Xwin, Java 49

3
Intro to Java
4
Why Java?
5
Java materials
  • Java 2 sdk 1.2 or better
  • http//java.sun.com/j2se/
  • Documentation
  • http//java.sun.com/docs/
  • Tutorials, reference, API
  • Borland JBuilder 6
  • http//www.borland.com/jbuilder/personal/
  • Free! Cross between VB and VC

6
Java differences
  • Basic statements identical to C
  • Object-oriented only!
  • No .h files
  • main() is inside a class
  • No global variables
  • No pointers (object references only)
  • No delete automatic garbage collection
  • Single inheritance only, interfaces
  • Applet/application
  • GUI AWT, Swing
  • Packaging
  • Error Handling, exceptions (try, catch)
  • E.g. Array bounds checking
  • Security
  • Components beans

7
Java compiling
  • Code
  • hello.java (text file)
  • Compile
  • javac hello.java
  • Creates hello.class (byte code)
  • Run
  • java hello
  • Java virtual machine, interpets/compiles
    (machine code)
  • Packaging jar
  • Or use JBuilder, like VC

8
Java Applications
  • Run from command line
  • hello.java
  • class hello
  • public static void main(String args)
  • System.out.println(Hello World!)
  • javac hello.java
  • java hello
  • Hello World!

9
Typically create objects
  • hello.java
  • class hello
  • public static void main(String args)
  • // Create and use objects
  • hello h new hello()
  • public hello() // Constructor

10
Many Classes
  • Compile each separately
  • Can be main( ) in any/all classes
  • hello.java
  • class hello
  • goodbye g
  • public static void main(String args)
  • goodbye.java
  • class goodbye
  • public static void main(String args)

11
Hmmm
  • dir
  • hello.class
  • goodbye.class
  • blah.class
  • foo.class
  • bar.class
  • areyouawakein.class
  • Java ???
  • RunMe.bat
  • java hello

12
JBuilder
13
Java Applets
  • Run in a web browser
  • hello.java
  • import javax.swing.
  • class hello extends JApplet
  • public void init()
  • getContentPane().add(
  • new JLabel(Hello World!) )
  • javac hello.java
  • appletviewer hello

Hello World!
14
Java Applets in HTML
  • hello.html
  • height100 width200
  • Need java.
  • Put hello.html and hello.class on website
  • Java plug-in

hello.html
Hello World!
15
Applet Methods
  • init( ) - initialization
  • start( ) - resume processing (e.g. animations)
  • stop( ) - pause
  • destroy( ) - cleanup
  • paint( ) - redraw stuff (expose event)

16
Applet Security
  • No read/write on client machine
  • Cant execute programs on client machine
  • Communicate only with server
  • Java applet window Warning
  • Certificates

17
Upcoming Java Topics
  • GUIs Swing, AWT, MVC
  • Event handling, listeners
  • Graphics
  • Animation, threads
  • Components, JavaBeans
  • Databases, JDBC
Write a Comment
User Comments (0)
About PowerShow.com