Moderator (MDR): MDR-andreaw
Guest Speaker (SPK): SPK-name
MDR-andreaw: Good morning and welcome to JDC's Java Live. My name is Andrea Warren and I am your moderator. Today we will continue our coverage of the new AWT and Swing. Our guest is Hans Muller, who is the Swing project lead. Please feel free to start sending in your questions, and we will try to get through as many as possible.
gdmccar: Has a pre-release version of Swing been made available?
MDR-andreaw: Yes! In fact, as of this morning it is available on the JDC web site.
Nannette: What is Swing?
SPK-hmuller: Swing is a new set of user interface components based on the JDKTM 1.1.2 AWT. The new components are written entirely in Java, and generally offer a superset of the features found in similar AWT components.
gdmccar: It is my understanding that Swing is a subset of the JFC. Is this true, or it is the other way around. What is the relationship? Is the JFC near any kind of pre-release?
SPK-hmuller: Swing is a subset of the JFC. As Andrea pointed out, you can download a pre-release of Swing today. We'd appreciate your feedback!
mj-perry: How easy is it to replace the AWT components with Swing components? Easy with quite a lot of changes, easy with few changes, or as simple as changing <compname> to j<compname>?
SPK-hmuller: The current pre-release of Swing contains pure Java versions of all of the AWT components. They're intended to be "sed-script" compatible, i.e. one can mechanically translate AWT applications to Swing. Some of the new components will need more work in this regard, e.g. JListBox (see java.AWT.List). We're not supplying any translations tools now, but we hope to provide some before the final version of Swing ships.
Penumbra: We are trying to create an off-screen buffer so we can dynamically create and change the screen. What would you suggest that we do? Think in terms of video games. Thank you.
SPK-hmuller: We've tested a "backing store" implementation along the lines of what you've described for JViewport. It's not difficult, however, it's more than I can extemporaneously reproduce here. If you'll send a message to the moderator we can forward some sample code.
pjmattal: I'm interested in the new GUI interface components/idioms that are being incorporated into Swing. Will Swing's components be as sophisticated as those in Marimba's Bongo, or other packages that already offer cross-platform Java widgets? Is there any place where this widget set is documented, where I might be able to get more specific information on which components I'll find in the new API? As a developer, I want to know more about Swing before deciding whether to use it over Bongo, or more precisely, before deciding whether it is worth the wait.
SPK-hmuller: Swing is intended to be as sophisticated as the other popular Java-only toolkits, for example Bongo or IFC. In fact, the IFC team has been has working with us on JFC for the last three months to help ensure that the best ideas and features from Netscape's IFC toolkit become part of Swing. We're also in touch with the Bongo team and have been discussing the Swing APIs with them. I'd suggest downloading Swing and judging for yourself. We'd appreciate any feedback you have.
lulu: Is the controller part of the MVC (Model View Controller) architecture found in JFC similar to the controllers found in SmallTalk (ParcPlace)?
SPK-hmuller: The controller idea is the same as in SmallTalk. However, in Swing we've merged the view and controller into a single delegate object.
gdmccar: Since Swing is a peer-less library, which look and feel is it emulating? Can it emulate more than one?
SPK-hmuller: Swing components support "pluggable look and feel," the look and feel of components can be changed dynamically. The Swing pre-release comes with an implementation of a look and feel that resembles Windows 95 and another one derived from the Netscape IFC look and feel.
aking: How would you say it compares with Microsoft's AFC, in terms of features?
SPK-hmuller: I think we're at least comparable in terms of features and components. I think our Win95 look and feel implementation is better than their current version, if I do say so myself.
Penumbra: Is there a way to create an .invisible button,. i.e. an unmarked, clickable region? Is there a way to create essentially a flat button-space over a picture or a specific pixel?
SPK-hmuller: Probably the easiest way to do this is to just subclass java.AWT.Component and add the mouse handling you want. Since JDK 1.1 subclasses of java.AWT.Component and Container are transparent by default.
chris: Since Swing components are written in native Java, what is the performance difference between AWT and Swing?
SPK-hmuller: In the long run we expect that Swing performance will be better than AWT because in Swing we don't cross the Java/C boundary nearly as much as in AWT. The current version of Swing hasn't been performance-tuned at all, it will get much better.
scapegoat: Are we going to see REAL alpha channels in the JFC; what I am referring to specifically is transparency. In AWT the alpha channel is either opaque, transparent, or if in between dithered, are we going to have transparency `a la' Photoshop anytime soon?
SPK-hmuller: This a question best answered by someone from the Java 2D group. I'd suggest that you look at the Java 2D spec for starters, see java.sun.com/jfc/index.html
gdmccar: Is there a springs and struts layout manager in the JFC?
SPK-hmuller: Yes
cliang: Is JFC an IFC-like framework, which requires me to rewrite my existing app by using JFC 's own top-level classes (like the NetscapeApplet and so forth in IFC), or it could also be used as a collection of GUI classes? How easy to fit JFC GUI components into AWT-based applications? I have already had a set of my own home-grown, peerless lightweight UI components (supporting transparency, background images, etc.) and don't want to throw them away immediately. Do you see the possibility of fitting them with JFC? (My components only subclass from Component and Container and there is no top-level heavy-duty proprietory classes to enforce a framework-type environment)
SPK-hmuller: Mixing your own lightweight components with Swing components should work fine. Swing does not redefine any of the "intrinsic" AWT types like Font, Graphics, Image, Component, etc. There's no requirement that applications be based on something like NetscapeApplet either.
wgillett2: Are you thinking about the possibility of some kind of application framework for JFC/Swing? MFC is architecturally weak, but it has a nifty framework that lets you create a simple text editor application with standard menus, tooltips, etc. with a few mouse clicks. Creating the functional equivalent of "Notepad" in Java is a lot of work. I realize that the Swing team is--correctly--concentrating on the basics right now. I'm wondering if this is something you'd contemplate later. It would make life easier for those of us contemplating a switch from MFC to Java, with a lot of existing functionality to retool.
SPK-hmuller: We're not working on an application framework however we are planning to build some independent parts called "application services." The specifications for "undo" the "target manager" are considered to be in the application services category. We don't have plans for an all- encompassing application framework.
scapegoat: Is it/will it be possible to have windowless `external windows' in an application? (ie. without a title bar) I'm guessing it isn't since this is pretty platform independent.
SPK-hmuller: The java.AWT.Window class provides this for applications. Presently, when an applet creates a java.AWT.Window you get the scary title bar for security reasons.
glen_s: Why does Swing require JDK 1.1.2? Why won't it work with 1.1.1?
SPK-hmuller: There was one bug with lightweights in JDK 1.1.1 that causes the event handler to throw exceptions after a component was removed from the tree. It wasn't possible to work around this, and it's fixed in JDK 1.1.2. You can run Swing against 1.1.1; some applications will not run into the bug at all.
mj-perry: Will there eventually be a peerless frame component, if this is even possible?
SPK-hmuller: In today's Swing pre-release, there's a new component called JInternalFrame that's a "peerless" Frame in terms of look and feel. It's not a top-level window, so it's not equivalent to java.AWT.Frame.
steelman: Will Swing/JFC have an equivalent to Netscape's IFC Constructor?
SPK-hmuller: We don't have any plans to build something equivalent to Constructor at the moment.
julio: What interfaces are you planning to provide in the final version of JFC? Mac, Openlook, Motif?
SPK-hmuller: We haven't finalized the list of look and feel implementations we'll provide. I don't expect that we'll do OpenLook, we haven't had a request for Motif.
cliang: What's the migration path of existing AWT-based app to JFC-based app?
SPK-hmuller: Replace the AWT components (buttons, menus, lists, labels, etc.) with the equivalent Swing components. For custom components that subclass java.AWT.Panel or Canvas, subclass Swing JPanel (or a lightweight base class like java.AWT.Container) instead.
zoltar: I played with Swing 0.2 today and it looks very promising. Is speed something that will be worked on before the official release? It's pretty pokey.
SPK-hmuller: Yes, we're very concerned about performance. We conciously decided to not make it a priority for Swing 0.2; we hope to make significant improvements in our next release.
MDR-andreaw: We've run out of time. I'd like to thank Hans, for taking the time to be our guest, and everyone who joined us for making this a lively discussion. For more information check out http://java.sun.com/products/jfc/index.html And as we mentioned earlier, the JFC is available for downloading on the JDC web site. Due to lots of questions, which is good, and not enough time, which is always a limiting factor, we were left with several unanswered questions. So Hans and the rest of the Swing team are going to answer those for us, and we'll add both the questions and responses to the end of this transcript. in the next few days.
Discussion Forum
Java Live-AWT/Swing Continued
July 11, 1997
MDR-andreaw: The following questions were left in the queue on Tuesday, July 8th. Hans has answered them here for us.
cliang: When JFC is fully available, what would be left to do for those toolkit vendors like Microline? What's the space being left to do some value-added component based on JFC?
SPK-hmuller: JFC will be released in increments, until the release of JDK 1.2. As far as toolkit vendors are concerned, there will still be a market for things like elaborate tables.
cliang: How is the the 2D API being used to support true-type/typeOne font rendering?
SPK-hmuller: Presently, we don't depend on 2D. However, a future implementation will be based on Java 2D.
steelman: Will the Swing final release work with 1.1.2? In other words, will the final release be pluggable into 1.1 like JDBC was for 1.0?
SPK-hmuller: Yes.
julio: The Swing class names will remain prefixed with J, or will you change them when merging with AWT in the final release?
SPK-hmuller: We are still considering the best method.
jjustus: How easy is it to mix the use of native (peer-based) widgets with the new JFC widgets? Will they get along with each other nicely on the same window?
SPK-hmuller: The two are mutually compatible, they should get along fine.
cliang: Does the Swing set support graphics layering (like IFC 's four-layer structure)? This would be necessary for writing, for example, a window-manager-like applet running in a web browser.
SPK-hmuller: The next release will include something like IFC's layering.
mtnygard: What set of looks and feels do you intend to provide in the final release?
SPK-hmuller: There will be a Windows 95 look and feel, the others have not been decided.
glen_s: Will it be possible to have a window without the little coffee cup (on the Windows 95 system menu)? Sometimes it's fine to hint the "programmed in Java," but other times it's not.
SPK-hmuller: Applications can create java.awt.Window, which doesn't have a frame.
steelman: Do you expect the migration path to JFC lightweight components to be smoother from IFC or original AWT?
SPK-hmuller: I expect the transition from AWT to JFC will be the smoother of the two.
luok: What is the plan for the HTML component similar to IFC TextView? Can you give a list of planned features? What level of HTML support will it have?
SPK-hmuller: We are still deciding on HTML support.
steelman: Do you know if TIFF graphics file-format support is coming? This is expecially important for FAX images and various other black and white images on a limited bandwidth connection. Thanks.
SPK-hmuller: Support for TIFF is not within the purview of AWT. I don't think it will be available in the short term.
cliang: Will the JFC source code be made publicly available, like JDK?
SPK-hmuller: Yes.
cimarron: I'm planning on using the Java-Tcl interface the sunscript group is working on when it becomes available and will probably use whatever set of user interface classes that works best with it. What are the JFC developers doing to ensure JFC will work well with Sunscript ?
SPK-hmuller: We haven't looked at Sunscript yet.
mj-perry: Regarding the tabbed folder/panel component. Is it possible to hide/show individual tabs to make it appear as if they are not present, and then make them reappear as if they are? This, of course, being preferable to having to remove and add a tab every time this is desired.
SPK-hmuller: This request has been passed along to the tabbed component implementor.
cimarron: Is it possible to use a subset of JFC work on JDK 1.0.2 ?
SPK-hmuller: We don't plan to support 1.0.2 applications.
Alexia: What do you anticipate to be some of the strongest end uses of Swing?
SPK-hmuller: Swing works as the basis of commercial-grade applications of all kinds.