Swing Application Framework
Download
Report
Transcript Swing Application Framework
Technical Thursdays
January, 2011
Piotr Dziewonski
Agenda
Introduction
AWT and Java 2D
Swing Application Framework
Swing enhancements:
Substance
Flamingo
Oxbow
MiGLayout
SwingLabs
Aerith
Swing in future
Abstract Window Toolkit (AWT)
The first graphical user interface (GUI) toolkit that shipped with Java
(JRE 1.0)
AWT was the only core library for user interface programming in Java
AWT provides this capability by calling upon the native libraries on the
user’s system to create and display these GUI components
Events that occur in the native window system are received by the AWT
implementation and are then forwarded to Java applications as AWT
events
AWT lives on and can be used now exactly as it was in the beginning
Java 2D
Java 2D, introduced in the JDK 1.2 release, is the graphics library of Java.
Whereas AWT included basic drawing APIs in JDK 1.0, Java 2D goes much
further and covers a broad set of operations, including basic and
advanced drawing operations, image manipulation, text, and printing.
Java 2D handles Swing’s rendering operations. So, for example, when a
Swing button wants to look like a Swing button, it makes calls into Java
2D to draw the background, the border, and the text for that button.
Swing – Introduction
Swing is the primary Java GUI widget toolkit released in July 1997. It is
part of Sun Microsystems' Java Foundation Classes (JFC) — an API for
providing a graphical user interface (GUI) for Java programs.
Swing was developed to provide a more sophisticated set of
GUI components than the earlier Abstract Window Toolkit (AWT). Swing
provides a native look and feel that emulates the look and feel of several
platforms, and also supports a pluggable look and feel that allows
applications to have a look and feel unrelated to the underlying platform.
Source: http://en.wikipedia.org/wiki/Swing_(Java)
Swing – Overview
Swing, like Java 2D, was also introduced in JDK 1.2.
Swing is a lightweight toolkit, which means that the Swing components
you see in your application, such as buttons, checkboxes, and scrollbars,
do not correspond to native components as they do in AWT.
Swing’s components are drawn using Java 2D, and they can have their
drawing customized, which leads to applications that look and behave
in much more interesting ways.
The application may call Swing methods directly, but the functionality
of these methods is handled through combinations of AWT and Java
2D calls underneath
Swing – Overview
Java Application
Swing
Java 2D
AWT
Java Runtime Environment
Swing – Competitors
JavaFX
Adobe Flex
Adobe Air
Microsoft Silverlight
HTML/CSS/JavaScript
…
Swing Application Framework
The Swing Application Framework (JSR 296) is a Java specification for
providing a simple application framework for Swing applications. It will
define infrastructure common to most desktop applications, making
Swing applications easier to create.
The JSR 296 specification will define the basic structure of a Swing
application. It will define a Framework as a small set of extensible classes
that define infrastructure common to most desktop applications:
Management of application life-cycle, startup and shutdown,
Support for loading localized resources,
Persistent session state,
Support for loosely coupling Actions to their presentation
Sources: http://en.wikipedia.org/wiki/Swing_Application_Framework
http://www.artima.com/lejava/articles/swingframework.html
But…
It was originally expected that this implementation would be the means
for integrating JSR 296 into the upcoming Java SE 7 (Dolphin) version of
the Java programming language, and the project was scheduled to be
included in milestone 5 of the JDK7 development. However, in August
2009, it was announced that the project would not be included due to an
inability to reconcile design flaws and achieve consensus among the JSR
296 team before the milestone 5 deadline.
Source: http://weblogs.java.net/blog/archive/2009/08/19/saf-and-jdk7
BSAF – overview
Project name: Better Swing Application Framework
Author: Alexander Potochkin
Web page: http://kenai.com/projects/bsaf/pages/Home
License: LGPL
Description: A fork of the Swing Application Framework.
The Better Swing Application Framework is a fork of the original Swing
Application Framework reference implementation of JSR 296. Since August
2009, the original Swing Application Framework project has been on hold, and
therefore this fork was created to carry on the work until the original project
resumes.
The last public release of the original SAF project was version 1.03. The BSAF
project currently aims at producing a new release, version 1.9, with the primary
goals of improving stability, keeping backward compatibility with SAF 1.03,
fixing bugs, updating documentation, and creating more unit tests and
examples.
Substance – overview
Project name: substance
Author: Kirill Grouchnikov
Web page: https://substance.dev.java.net/
License: BSD License
Description: Substance Java look & feel.
The goal of this project is to provide a rock solid, fast and extensible library for
creating visually appealing and consistent Swing applications.
Say something about trident…
Substance – in Action…
Substance – in Action…
Flamingo – overview
Project name: flamingo
Author: Kirill Grouchnikov
Web page: https://flamingo.dev.java.net/
License: BSD License
Description: Flamingo Swing component suite.
The goal of this project is to provide a Swing implementation of the Office
2007 ribbon container and related components. The components have
consistent visuals under the existing core and third-party look-and-feels,
respect the DPI settings of the user desktop and follow the core Swing
guidelines in the external APIs and the internal implementation details.
Ribbon component is described here:
http://msdn.microsoft.com/en-us/library/cc872782.aspx
Flamingo – inspiration
Flamingo – in Action…
Flamingo – the small things
More information on Kirill’s blog:
http://www.pushing-pixels.org
Oxbow – overview
Project name: oxbow
Author: Eugene Ryzhikov
Web page: http://code.google.com/p/oxbow/
License: New BSD License
Description: A collection of projects for Swing UI enhancements.
The goals are:
create trivial Task Dialog API as described at Microsoft page:
http://msdn.microsoft.com/en-us/library/aa511268.aspx
provide Look and Feel independent UI
conform as much as possible to local OS standards when using system LAF
Oxbow – inspiration
Oxbow – in Action…
MiGLayout – overview
Project name: MiGLayout
Author: Mikael Grev
Web page: http://www.miglayout.com/
License: BSD License
Description: A collection of projects for Swing UI enhancements.
MiG Layout Philosophy:
Fast, Small and Memory Efficient
Simple to Use + High End = Large Range
GUI Toolkit Independent – Easy to Port
Resolution Independence – Automatically
Simple to Read – Close Constraint Proximity
MiGLayout – in Action…
SwingLabs – overview
Project name: SwingLabs
Author: Sun Microsystems, Inc.
Web page: http://www.swinglabs.org/
License: LGPL
Description: Sun open source project proposing extensions to
the Java Swing GUI toolkit.
Available components include:
Sorting, filtering, highlighting for tables, trees, and lists
Find/search
Auto-completion
Login/authentication framework
TreeTable component
Collapsible panel component
Date picker component
Tip-of-the-Day component
Source: http://en.wikipedia.org/wiki/SwingLabs
SwingLabs – overview
A Successful project components are eventually incorporated into the
core Swing toolkit for future Java versions, although API compatibility
is not guaranteed. Examples of these are:
the GroupLayout manager in Java SE 6
incorporation of the SystemTray in Java SE 6
the new Desktop class in Java SE 6, which allows to launch easily
associated applications registered on the native desktop, as for
example : launching the user-default browser, launching the userdefault mail client, launching a registered application to open, edit
or print a specified file.
Source: http://en.wikipedia.org/wiki/SwingLabs
SwingLabs – inspiration
SwingLabs – in Action…
Aerith – overview
Project name: Aerith
Author: Richard Bair, Romain Guy, and Joshua Marinacci
Web page: https://aerith.dev.java.net/
License: BSD License
Description: Aerith is a Swing Mashup.
It's a roadtrip slideshow builder that combines Google Maps, Flickr, and Yahoo
Geocode to let you make your own slideshow of photos you took on your trip.
Once you are doing setting up the slideshow you can share the trip with your
friends as an applet.
Aerith really shows off the power of Swing, Java2D, and JOGL when you
combine it with webservices and applets. With Desktop Java you can do things
you couldn't ever do in AJAX. And most importantly, it looks great!
Resources
Books:
Filthy Rich Clients: Developing Animated and Graphical Effects for Desktop Java
Applications – Chet Haase, Romain Guy
The Definitive Guide to Java Swing (3rd Edition) – John Zukowski
Web:
Jonathan Giles – www.jonathangiles.net
Kirill Grouchnikov – www.pushing-pixels.org
Other:
Check „TechnicalThursdays” directory on the storage
Q&A