Download
Swing Swing JavaDoc APIs JDK 1.1.3 Documentation
JDK 1.1.3 Download JFC
Web Site README


 Welcome to the second edition of FAQ
Forum, where the Swing design team answers the questions that developers
have asked most frequently in the thousands of e-mail messages that we have
received on our feedback
hotline.
With this release, our experts answer questions on topics ranging
from Swing's overall performance to why we're so interested in pluggable
look-and-feel to how JFrame performs background-clearing operations.
FAQ Forum is now a regular feature in this document set, and we want
to present a brand-new set of questions and answers with every new pre-release.
So stay tuned and keep that feedback coming.
Solving Class-Naming Problems
Why do almost all class names start with the letter "J"?
Why is it that some do and some don't?
With the advent of Swing, many applications have to import both the old
java.awt package and the new java.swing package:
import java.awt.*;
import java.swing.*;
We first tried naming components without the intial "J" --
which stands for Java, if you like -- but we ran into name clashes when
importing both the old and new packages. Worse, the name clash caused the
javac compiler to spew out some really
confusing messages that completely obscured that fact that just a simple
name clash was all that was occurring.
With this release of Swing, we are introducing a new proposed method
for fixing this problem. You can read all about it in the spec sheet titled
"Swing Packaging (A Naming Dilemma and a Proposed
Solution)."
The Need for Speed
. . . . Speed is the one major flaw that stands in the way of JFC's
being commercial-quality. I hope this can be fixed. Screen updates are simply
too slow, and the time between a mouse or keyboard click and its effect
is too great.
It might help you to understand our design philosophy for this first
public release. Currently, our primary goal is to get the API out to the
public for review, with an implementation that's good enough to use for
writing experimental programs. (We warn everyone over and over in these
pages that Swing is not nearly stable enough yet to be used for developing
finished commercial products.
In getting this early developer release out the door so you could get
an early look at it, we faced two big tradeoffs: There are many bugs in
the code, and the performance isn't yet close to what we want (and expect)
it to be.
An all-out effort to improve performance is now under way, and has now
become our top priority -- and our early findings are looking good. For
example, when just one engineer worked on this project for one day recently,
he improved the Swing set's performance by 2.7 times.
We really want to make this a world-class toolkit, and we want you to
continue sending us feedback us how we can improve Swing, not only in terms
of performance, but in other ways as well. We also want to know if we're
meeting your requirements for features in a toolkit -- particularly features
that are related to ease-of-programming issues and toolkit architecture.
In a nutshell, we want to know how easily and efficiently you can create
new UI components that meet your needs using Swing's atomic classes and
its infrastructure.
If you want us to create the best Swing set we possibly can, it's vital
that you keep that feedback
coming!
The JFrame Flickers
If I use a JFrame with a menu bar, toolbar and an editor (similar
to the Notepad example), the menu bar and the toolbar aren't repainted properly.
If I wrap everything in a JPanel and add this to the JFrame (as in the Notepad
example) everything works fine. From this I get the impression that repaints
of JComponents only work when used within a JPanel. If this conclusion is
correct, I suggest that this be documented, and that JFrame use a JPanel
by default.
The problem is that has background-clearing turned off during JFrame
updates. This is just a temporary workaround that we resorted to to solve
flickering problems. The problem will be fixed in a future release.
Internationalization: It's Coming
Swing is very impressive, But I can't input Korean characters (hangul)!
You can't input Chinese, Japanese, or Russian characters either, to name
just a few kinds, because we haven't yet added internationalization support.
That is planned for 0.5, or some time shortly thereafter..
Old News: This Is Fixed Already!
When I went to File|Open and opened a seven-line foo.java
file, I got this on the console:
> Exception occurred during event dispatching:
> java.lang.NullPointerException:
> at
> java.awt.LightweightDispatcher.retargetMouseEvent
> (Container.java:1416)
> at
> java.awt.LightweightDispatcher.processMouseEvent
> (Container.java:1329)
>
> at
This Problem is fixed in JDK 1.1.4. Unfortunately, it didn't make the
1.1.3 train. This happens with native dialogs.
Popup Problems
. . . Sometimes the pulldown menus (regular menu) froze open and
wouldn't repaint until I went back to the menu bar. . .
Because AWT does not currently provide a way to "grab" mouse
events that occur outside your window, unless you are dragging. So we have
had to fudge menu pop-down operations until we can add this functionality
to AWT. (It requires some native code additions).
Currently, clicking twice on a pulldown menu again pops down the menu,
as will moving the window. Selecting from the menu bar will, of course,
pop down the window. If you are seeing something else, please let us know!
These operations will work much better in the release version of Swing
-- in fact, they will improve with the next version of the JDK. But until
then, we can't do much more than fudge!
Look at the Big Picture
I have downloaded 0.2 of the JFC. It would be very helpful
if you could make the source code available, because the documentation doesn't
seem to contain enough details to give me a good understanding of how everything
works.
The source is available as of 0.4. It can be found in the src.zip file.
A Bogus Exception
When I started up Swing, I got this exception:
5. SwingApplet has a AppletSecurityException:
checkread on startup.
This is a false warning. Note that SwingApplet is in fact alive and well,
despite the exception.
Dialogs? They're in the Wings
Swing looks real nice and useful, but I see one thing missing: dialog
boxes. Many GUIs come with standard boxes for at least a few common operations,
such as Abort/Retry, Yes/No, OK/Cancel, and the like. It would be very useful
for Swing to have classes for all these kinds of dialog boxes.
You'll be happy to know that we already have a set of standard dialog
boxes waiting in the wings -- they were just not quite ready to go out this
release. In the next release of Swing, we hope to have all the kinds of
dialog boxes you mention, along with several others, including several kinds
of choosers (file, date, font, and color choosers, to name a few).
The Latest News on JFC and JDK
Will the Java Foundation Classes be released in final form this year?
And will the JFC, if released with Java Developer's Kit 1.2 (or later),
be compatible with JDK 1.1?
JFC will be available in its final form in the fourth quarter of this
year. The JFC components in that release will be fully compatible with JDK
1.1. Some special features and services -- such as Java2D, accessibility
support, and a few others -- will require the next version of the JDK since
the implementation of these services will require native code.
Swing's Debut
Is a commercial-quality release of Swing planned in the next nine
months?
Yes, although we don't have an exact date yet. As mentioned in the preceding
answer, JFC will be available in its final form in the fourth quarter of
this year, but some special features and services will take longer to develop
and release.
Swinging Along with Swing
Would you regard the API as being stable enough for development?
I realize lots will change, but is the core reasonably stable? What my company
is thinking is that if we start UI development in a month or so, we can
work with Swing as it matures (perhaps quite a bit) during our development
cycle. As long as Swing is be released before our product is, it may be
a good fit. If it would be useful to you, we could provide feedback from
the perspective of a medium-size application development with heavy day-to-day
usage. (We will use Swing in-house during development.)
First, things will definitely change. We aren't looking to radically
rewrite everything, but names will change, features will improve, and some
fairly major organizational changes will take place (moving files into subdirectories,
for instance)
And there are a definitely places in Swing where we will perform
major surgery. We hope that it won't be hard to track these changes won't
be too hard, but we can't promise anything.
Direct feedback from you would be quite useful as development of Swing
continues, but we can't promise direct engineering support for your project
in return (too many customers, too few Swing engineers).
Thanks for your interest and support.
Putting Fonts on the Menu
I've been wondering why Swing doesn't pick up an use operating-system
fonts aren't picked up and used. Will there be any functionality in JDK
1.2 to obtain System fonts so that developers can reproduce the true look
and feel of a particular operating system?
Many things are planned to make defaults easier to work with at all levels,
but without adding too much complexity for users or developers. Fonts will
be getting a lot of attention once Java 2D is available -- but for the moment,
I'm punting on making OS fonts available in menus. (That shouldn't prevent
you from giving us feedback on the APIs though).
L&F: Many Do Care
Why are you spending so much time and energy on this "pluggable
look and feel" thing, which nobody really cares about?
We are constantly being asked questions like:
How will you make Java GUIs accessible? How do I make my Java App
run on PDAs? How do I let my users have the option of a consistent UI on
all platforms?
Pluggable L&F is the answer to these questions, and more. It is merely
one facet of the Swing's overall architecture -- something that you, as
a developer ,can choose to take advantage of or not, as you choose
Where Has All the (IFC) Technology
Gone?
Looking at Swing, it is hard to see where the IFC technology is. How
does Swing make use of the Internet Foundation Classes technology which
Netscape pioneered and which JavaSoft and Netscape have reportedly worked
together on as IFC has been incorporated into Swing?
IFC technology is used in the following areas:
- JInternalFrame
- Keyboard selection
- Repaint batching
- Autoscrolling
- Icons
- DebugGraphics
- JSpringLayout
- Timer
- Rose L&F
- Target Manager (soon)
- EventQueue (soon).
Version 0.4. Last modified 09/04/97.
Copyright © 1995-97 Sun
Microsystems, Inc. All Rights Reserved.
 |