Chris Johnson, Index
Interface Development in Java
- The Abstract Window Toolkit (AWT)
- Swing
- VRML, Java3D and beyond...
User Interface Design Using Java
Chris Johnson, Index
The Abstract Window Toolkit (AWT)
User Interface Design Using Java
Chris Johnson, Index
Swing
- Builds on AWT, doesnt replace AWT.
- Dont borrow native code.
- Platform independent look and feel.
- Consistent across-platforms.
User Interface Design Using Java
Chris Johnson, Index
Swing
- Inconsistent within a platform.
User Interface Design Using Java
Chris Johnson, Index
Virtual Reality Markup Language
- HTML in three dimensions...
- Cones, Spheres and cubes.
User Interface Design Using Java
Chris Johnson, Index
Virtual Reality Markup Language
User Interface Design Using Java
Chris Johnson, Index
Virtual Reality Markup Language
Shape {
appearance Appearance {
material Material {}
texture ImageTexture {url "earth.gif"}
}
geometry Sphere {}
}
PointLight {
location -1.5 0 0
color 1 1 0
intensity 1
}
User Interface Design Using Java
Chris Johnson, Index
Virtual Reality Markup Language
- Can embed hypertext links to URLs.
- Includes sounds & proximity sensors.
- Texture mapping reduces polygons.
User Interface Design Using Java
Chris Johnson, Index
Virtual Reality Markup Language
- VRML = model viewers and builders.
- Not a full programming language.
- Cant animate scenes or move objects.
- Needs link between viewer and Java.
User Interface Design Using Java
Chris Johnson, Index
Java3D
- Uses OpenGL graphics library.
- OpenGL for NT/SunOS etc.
- So again provides portability.
- If OpenGL is on your machine.
User Interface Design Using Java
Chris Johnson, Index
Java3D
- Library of 3D calls in Java.
- Load VRML files into scene graphs.
- Good area for student projects...
User Interface Design Using Java
Chris Johnson, Index
Interface Development in Java
- Heterogeneity reduces portability
- Macs vs PCs vs UNIX (Motif etc)
- Then came the Java virtual machine.
User Interface Design Using Java
Chris Johnson, Index
Summary
- The Abstract Window Toolkit (AWT)
- Swing
- VRML, Java3D and beyond...
User Interface Design Using Java
Chris Johnson, Index
Consistency: A CRITICAL problem...
- Write once, run anywhere.
- Look & feel differs between machines.
- We expect Macs to look like Macs etc.
User Interface Design Using Java
Chris Johnson, Index
Consistency: A CRITICAL problem...
- Same buttons on 3 different machines.
User Interface Design Using Java
Chris Johnson, Index
The Abstract Window Toolkit (AWT)
- Part of Java Development Kit (JDK).
- Two versions (1.0 and 1.1).
- We'll focus on 1.0 and upgrade later 8)
User Interface Design Using Java
Chris Johnson, Index
The Abstract Window Toolkit (AWT)
User Interface Design Using Java
Chris Johnson, Index
The Abstract Window Toolkit (AWT)
- Platform specific window managers.
- Your code <-> AWT <-> managers.
- Dont have to write for each manager!
User Interface Design Using Java
Chris Johnson, Index
The Abstract Window Toolkit (AWT)
Hurray!
User Interface Design Using Java
Chris Johnson, Index
The Abstract Window Toolkit (AWT)
/*
* Copyright (c) 1995-1997 Sun Microsystems, Inc. All Rights Reserved.
*
* Permission to use, copy, modify, and distribute this software
* and its documentation for NON-COMMERCIAL purposes and without
* fee is hereby granted provided that this copyright notice
* appears in all copies. Please refer to the file "copyright.html"
* for further important copyright and licensing information.
*
* SUN MAKES NO REPRESENTATIONS OR WARRANTIES ABOUT THE SUITABILITY OF
* THE SOFTWARE, EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
* TO THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
* PARTICULAR PURPOSE, OR NON-INFRINGEMENT. SUN SHALL NOT BE LIABLE FOR
* ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
* DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES.
*/
/*
* 1.0 version.
*/
import java.awt.*; /* Notice - this links to AWT classes */
import java.applet.Applet;
public class ButtonDemo extends Applet {
Button b1, b2, b3; /* AWT provides a Button class */
public void init() {
b1 = new Button();
b1.setLabel("Disable middle button");
b2 = new Button("Middle button");
b3 = new Button("Enable middle button");
b3.disable();
//Add Components to the Applet, using the default FlowLayout.
add(b1);
add(b2);
add(b3);
//Necessary when adding buttons to an already visible container:
validate();
}
public boolean action(Event e, Object arg) {
Object target = e.target;
if (target == b1) { //They clicked "Disable middle button"
b2.disable();
b1.disable();
b3.enable();
return true;
}
if (target == b3) { //They clicked "Enable middle button"
b2.enable();
b1.enable();
b3.disable();
return true;
}
return false;
}
}
User Interface Design Using Java
Chris Johnson, Index
The Abstract Window Toolkit (AWT)
User Interface Design Using Java
Chris Johnson, Index
Swing
- Builds on AWT, doesnt replace AWT.
- Dont borrow native code.
- Platform independent look and feel.
- Consistent across-platforms.
User Interface Design Using Java
Chris Johnson, Index
Swing
- Inconsistent within a platform.
User Interface Design Using Java
Chris Johnson, Index
Virtual Reality Markup Language
- HTML in three dimensions...
- Cones, Spheres and cubes.
User Interface Design Using Java
Chris Johnson, Index
Virtual Reality Markup Language
User Interface Design Using Java
Chris Johnson, Index
Virtual Reality Markup Language
Shape {
appearance Appearance {
material Material {}
texture ImageTexture {url "earth.gif"}
}
geometry Sphere {}
}
PointLight {
location -1.5 0 0
color 1 1 0
intensity 1
}
User Interface Design Using Java
Chris Johnson, Index
Virtual Reality Markup Language
- Can embed hypertext links to URLs.
- Includes sounds & proximity sensors.
- Texture mapping reduces polygons.
User Interface Design Using Java
Chris Johnson, Index
Virtual Reality Markup Language
- VRML = model viewers and builders.
- Not a full programming language.
- Cant animate scenes or move objects.
- Needs link between viewer and Java.
User Interface Design Using Java
Chris Johnson, Index
Java3D
- Uses OpenGL graphics library.
- OpenGL for NT/SunOS etc.
- So again provides portability.
- If OpenGL is on your machine.
User Interface Design Using Java
Chris Johnson, Index
Java3D
- Library of 3D calls in Java.
- Load VRML files into scene graphs.
- Good area for student projects...
User Interface Design Using Java
Chris Johnson, Index
Summary
- The Abstract Window Toolkit (AWT)
- Swing
- VRML, Java3D and beyond...