Moderator (MDR): MDR-lisa
Guest Speaker (SPK): SPK-name
MDR-lisa: Hi, my name is Lisa Stapleton, editorial director
of the JDC, and our scheduled guest couldn't make it today, but another great
expert on applets and the AWT, Kathy Walrath, is here with us to discuss the
new AWT and applets. She is the author of these portions of "The Java
Tutorial," and she's here to answer your questions today. Welcome, Kathy,
and all of our participants.
SPK-walrath: Thanks very much, Lisa. Hi, everyone!
irsan: Hi, Lisa and Kathy. Could you elaborate on the
usage of validate() and repaint(). I (and a lot of guys I know) are not very
sure on when to call these methods (esp. with lightweight components), and thus
are calling the methods "all the time." Thanks.
SPK-walrath: We need to come up with better guidelines for
validate and repaint. Theoretically, you never need to call validate if you're
adding a component to an already-visible container. However, it does seem to
help sometimes. As for repaint, I'd have to know how you're using it. As far as
lightweight components go -- all I can say is download JDK 1.1.2 and
then try again. A lot of lightweight component bugs were fixed in
1.1.2, in preparation for the release of Swing components.
whitteng: Hello, I would like to know how to wait for
"drawImage" to finish, NOT just return. I am drawing a scaled image
into an offscreen buffer, and if the image hasn't drawn completely into the
buffer before it is rendered onto the screen, a blank or incomplete image is
rendered. This is a real problem in 1.0.2 especially.
SPK-walrath: Is the image completely loaded before you do the
drawImage? If not, you can use a MediaTracker object to wait for the image data
to be loaded.
archers: I have a question about painting from native
methods in AWT canvases. I have heard that there is a method of getting a
handle to the drawing area, sun.awt.{X11,Win32}DrawingSurfaceInfo, but of
course it doesn't actually appear to be documented. Is there really a way of
getting at this information? Thanks.
SPK-walrath: We really don't want you to do that from
the existing AWT. Have you checked out Java 2D? Look at
http://java.sun.com/products/java-media/2D.
irsan: [back to the subject of validate()]: It occurs
to me that I have to do a validate() whenever I remove a lightweight component
(even in JDK1.1.2). Is this a bug or a feature ;-)
SPK-walrath: I'll check on that.
whitteng: -(waiting for image drawing) Yes, the image
is loaded, but it seems that drawImage still iterates for something like scaled
drawing, and there appears to be no way to tell when the image drawing
has finished. MediaTracker is not documented to track drawing, just loading.
Can it be used for monitoring image drawing?
SPK-walrath: Not that I know of. This sounds like another job
for Java2D.
irsan: OK, thanks!
irsan: Could you tell us a little bit more about
these "Swing components"? What do they do, why do we need them, and
when will they be out?
SPK-walrath: The Swing components are pre-fab lightweight
components that you can just plug into a program. They're completely
implemented in Java, so we're going to be able to release them in preliminary
form (to get developer feedback) before the next JDK release. Besides Swing
components, the Swing project also includes infrastructure for having a
pluggable look and feel, and various classes to make it easy to develop and use
lightweight components. Swing is part of the JFC.
werpu: My greatest fear about the swing components
is performance. How well will they perform compared to peer components?
SPK-walrath: Good news: They seem to perform really well!
irsan: So, if I get your message right: Swing
components are lightweight replacements for the well-known and existing widgets
(Button, Radio, List etc)?
SPK-walrath: Yes, Swing will include lightweight versions of
existing components. However, it'll also include a huge number of new
components. If you went to JavaOne, you saw a lot of them demoed -- full-featured
text, color chooser, tables, tabbed panes, etc.
sellhorn: How difficult is it going to be to
"upgrade" our JDK1.1-based UI to the new JFC stuff? We kind of need
all the new widgets now, but it seems like we might have a to use a third
party initially.
SPK-walrath: In theory, it should be pretty easy. Of course, I
haven't tried to do it yet. One of the goals of the lightweight versions of
existing components is to maintain API compatibility whenever possible.
whitteng: Will Swing components be used instead of
peer components so that there will only be one common look and feel?
SPK-walrath: The great thing about Swing components is that
they'll all have a pluggable look and feel. So there'll be a common look and
feel that you can use across all platforms, or you can choose to have a Windows
or Mac (e.g.) look and feel. JavaSoft won't supply every look and feel -- but
it'll make it possible for users and developers to plug them in.
sellhorn: When do we get all this cool stuff!?!?!
(Please don't say Q3 '97 or some other obscure date)
SPK-walrath: At JavaOne, we promised a release in 60 days,
which is right about now. (I suspect this is why Hans couldn't make it here
today!) This 60-day release is going to a limited set of customers. We plan
another release in early July, and (as far as I know), just about anyone should
be able to get a copy of that release.
whitteng: Thanks - what is JFC? I don't recall that
particular acronym.
SPK-walrath: JFC stands for Java Foundation Classes. We
announced the JFC at JavaOne, in collaboration with Netscape. Besides
everything I described above, the JFC will include technology from Netscape's
IFC. JFC also includes the existing AWT, Java2D, and other API for creating
visual applications. I think of it as the AWT growing up.
sellhorn: How much of Netscape's IFC will be in the
JFC? I tried IFC before and it was a memory HOG! (plus some of the widgets
were a little too fancy)
SPK-walrath: Well, we're not shoehorning IFC into the JFC.
The Netscape developers are right here at JavaSoft, and the AWT team is working
with them to figure out how to take the best features of the IFC while
remaining true to the Swing vision.
const: It was possible to distribute JDBC with 1.0.2
applets by renaming package from java.sql to something like tempjava.sql (IBM
DB2 driver). Will it be possible to distribute EA Swing components with applets
like this?
SPK-walrath: Yes, it'll be possible to distribute Swing with
1.1.2. The Swing package is currently named (deep breath) com.sun.java.swing.
const: How will Swing components relate to new
additions in the "Glasgow" JavaBeans spec?
SPK-walrath: Maybe we'll have a forum about it later.
MDR-lisa: Yes, I think we're having a rep from the 2D team in
about 3 weeks. As for Glasgow, I think that's the Enterprise Beans effort,
right? If so, We're working on getting one of its creators to be on a forum
soon.
littel: I am not sure if you received my question but
here it is again anyway. I am using a TextArea and I want to insert text into
different places. I am using the insert() funtion and the getCaretPosition
method to acomplish this. The only problem is that it doesn't put the text
where the Caret Position is? Can you explain why and how can a fix this
problem. Thanks
panrakhi: How do I get the Focus lost event from the
textField Ctrl? It does not behave uniformly on different platforms.
SPK-walrath: That, frankly, is why we're doing Swing. The
existing peer infrastructure requires lots of platform-specific, non-Java code,
and it's practically impossible to get everything working consistently.
panrakhi: How do I set the Tab order of the different components in the container?
SPK-walrath: There's no API for doing this right now, as you probably know. I know that saying "it'll be fixed in Swing" is not going to help you right now, but that's really what's going to solve problems like this. It'll be much easier for us to provide features and fix bugs once we have everything written in Java, rather than having to worry about platform dependencies and native code. I guess you could say we've finally seen the advantage of Java for our own development!
MDR-lisa: That's about all our time for today. This has been a very popular forum, and I'd like to invite everyone back next week, when Georges Saab will be doing Part 2 of our AWT forum series. Thanks to everyone for participating in this forum, and we'll try to pick up where we left off, next week, same bat time, same bat channel!