Past Computing Environments Swing Ian Smith UI Toolkits
















- Slides: 16

Past Computing Environments: Swing Ian Smith

UI Toolkits (History Lesson) 4 Programming tools for building interfaces 4 Originally in Java you had AWT 4 AWT sucks 4 AWT is based on “peers” 4 JDK 1. 0 (and 0. 8, 0. 9) shipped with AWT Lots of cheers, lots of screams

UI Toolkits (History Continued) 4 Backing away from AWT event model 4 JDK 1. 1 shipped with new event model 4 Backing away from peers 4 Several efforts underway to avoid peers 4 Netscape offers IFC 4 Different JVMs differ significantly

Simplified Timeline 4 Early 1997, 100% Java UI work begins Netscape & Sun join forces 4 March 1997: Java One Demo & “Swing” 4 Summer 1997: Swing 0. 3 released 4 Fall 1997: Versions fast an furious 4 December 1997: API “Frozen”: Swing 0. 7 4 February 1998: Swing 1. 0 release

What’s Swing (JFC? ) 4 Set of UI Components & MVC 4 JDK 1. 1 Event Model & Beans 4 Pluggable Look & Feel 4 Java 2 D 4 Compatible with AWT but in JDK 1. 2 4 Accessibility 4 Drag And Drop

Questionable Graphic

Swing Components 4 Swing is 250 classes, 75 interfaces 4 The obvious (button, scrollbar, checkbox) 4 MS competitors (combo box, internal frame, split pane, tool bar, tool tip, etc) 4 The monsters (text & table) 4 A few choosers (file chooser, color chooser, previewers)

Swing & MVC 4 All components have an explicit model 4 View & Controller are fused 4 E. g. JAbstract. Button. Model for Button, Radio. Button, Check. Box, etc. 4 Linkage in both directions 4 Apps can listen to the model 4 Very sophisticated Document model 4 Supercool for database applications

Swing Event Model (Beans) 4 Everything is done with “listeners” 4 E. g. “add. Action. Listener()” to a JButton 4 E. g. “add. Change. Listener()” to a Button. Model 4 Simplifies linkage to application semantics but stiffens event model 4 All Swing objects are beans 4 People are already using them in builders

Pluggable Look & Feel 4 L&F is delegated to “separate” UI object 4 L&F is pluggable & dynamic 4 Organic, Windows, Motif (Mac? Mystery? ) 4 Windows only works on Windows 4 Windows is pixel-accurate copy

Examples Organic Motif Win 32

Java 2 D 4 2 D imaging model for Java (from adobe? ) 4 Seems very sophisticated 4 All drawing in JDK 1. 2 is done in terms of Java 2 D 4 JDK 1. 2 beta 2 is out, but Java 2 D is very slow and has broken font metrics

Compatible (? ) with AWT. . . 4 Generally, you can mix-n-match Swing with AWT 4 Some features work better in an all Swing world 4 When JDK 1. 2 ships, Swing comes with 4 JDK 1. 2 beta 2 shipped with Swing 0. 6 4 Don’t use Swing with JDK 1. 2 beta 2 if possible

Accessibility 4 Accessibility is part of JFC 4 Accessibility is a bunch of interfaces components can implement 4 “Roles” “Actions” “Accessible. Text” 4 All Swing components are accessible 4 Call your computer on a cell phone: you are now blind

Drag And Drop 4 JDK 1. 2 will have drag and drop 4 Interoperable with platform drag and drop 4 Version 0. 95 of D&D spec is out 4 Swing plans to support D&D in JDK 1. 2 (? ) 4 Spec is borderline impenetrable

Why To (Not) Use Swing 4 + AWT is so broken as to be useless 4 + It’s supported by Sun/Netscape; they care 4 + Lots of output side power & flexibility 4 + Source is available 4 + Browser support (Activator) 4 - Designed for “standard apps” 4 - Not very flexible input 4 - Still has AWT heritage