Moderator (MDR): MDR-Andrea
Guest-Speaker (SPK): SPK-mca and SPK-SteveW
MDR-Andrea: Hello everyone and welcome to Java Live. Today's topic
is the Java Look and Feel (which has some new names and directions that will be
explained). I'd like to welcome our guests, Michael Albers (mca), a
JavaSoftTM UI designer, and UI engineer Steve Wilson. Please go ahead and
send in your questions.
wongkw: Is there any plan to provide mechanism for
dynamic loading of L&F in general, and dynamic query and listing of themes
in each L&F?
SPK-SteveW: We're discussing a mechanism for runtime query of
installed L&Fs. Also the theme mechanism is still expanding. Right now
only JLF (now Organic L&F) supports Themes. We're going to be looking into
how (and if) Themes should be expanded into a general feature for all L&Fs.
MaryJaneSoft: What can expect in the future of Swing
and L&F?
SPK-SteveW: After Organic, we are working on a new L&F
codenamed "Metal." It is a more "evolutionary" design,
where JLF/Organic was "revolutionary." People familar with today's
popular GUI toolkits will feel at home with Metal. BTW, Metal looks cool.
steeg: How does Swing differ from the AWT?
SPK-SteveW: Swing uses lightweight components (no peers). It also
provides more components (i.e. trees and tables). It provides a mechanism that
allows you to plug in custom "Look & Feels," which is what were
concentrating on today.
SPK-mca: There's more info about Swing/JFC at
http://java.sun.com/products/jfc/.
wongkw:
Currently, the default behaviour of double clicking on the title pane of a
JInternalFrame is maximizing the JInternalFrame. How
do I override this behavior to something different, like say minimizing
JInternalFrame instead?
SPK-SteveW: Are you talking about doing this in an application,
or by writing your own L&F?
wongkw: I'm writing my own L&F.
SPK-SteveW: You'll want to look at the
BasicInternalFrameTitlePane class. It is where the "title
bar" of the window is created (you'll also need to look at
createNorthPane() in BasicInternalFrameUI). These
behaviors are provided by listeners that are created in these classes. Note
that currently BasicInternalFrameTitlePane is not a public class
(which means you might have to copy some code), but we're considering whether
to make it public for easier subclassing.
aywong: Hi. I'm a student at Harvard University. I've
just completed a project called RaptorJava using JDKTM 1.1.5 and Swing 0.7.
It's a Java standalone app that's part of a client/server course information
system. I have to saw that I was really impressed by the quality and
design of Swing, even at 0.7. You guys (and gals) are the bomb!!! Anyhow, I'm
wondering if there will be any futher 0.x releases before 1.0 comes out. Also,
is "Metal" the cool new interface that is mentioned on the Swing
Connection?
SPK-mca: There are no releases currently planned between now and
the final release of JFC 1.1 (effectively Swing 1.0). Yes, Metal is the new
L&F that is mentioned on The Swing Connection. (Glad to see that people
are using this treasure trove of Swing information). Keep watching The Swing
Connection for more info about Metal.
aywong: Have the Windows on Mac and Mac on Windows
L&F issues been resolved? I seem to remember reading something to the
effect of, "We don't care, let them (MS) sue us and look silly."
What is Apple's stance regarding the Mac L&F running on Win32? And will
there be any L&F locks installed once JFC1.1 comes out?
SPK-mca: Well, I'd rather avoid these legal issues, but nothing
regarding this issue has changed since Swing 0.7 was released.
wongkw: Is Metal == Rose? If not, will Rose be back?
SPK-SteveW: No, Metal is not the same as Rose, but we think that
people who were fond of Rose will like Metal. We hope to have some screenshots
up on the Swing Connection soon.
MaryJaneSoft: Can the use of Swing affect the
performance of an application (maybe speed)?
SPK-SteveW: Performance tuning for Swing is now becoming a
priority. Now that the APIs are freezing, and the bug count is dropping, the
Swing team is going to be looking into performance issues. Already components
like Table are much improved.
rankin: I want our users to be able to customize
their own Look & Feel off of our base L&F. I assume that I can use the
UIDefaults class to store anything I want customized (e.g. a
different font for labels than for JTextComponents), allow users
to edit that data, and then reinitialize the L&F. Is this correct?
SPK-SteveW: Yes. This is absolutely correct. You can store any
object in the defaults area; and, yes, you can have differernt fonts for
different components.
aywong: I have a question about writing custom
components that fit with the current L&F. I've written a custom component
and want the background color to match whatever color is being used by the
current L&F to paint buttons. Here is my code:
g.setColor(UIManager.getColor("control");
This works just fine, but is this the best way of grabbing this color?
SPK-SteveW: This is really close, but a better line of code would
look like this:
g.setColor(UIManager.getColor(
"Button.background"));
In most L&Fs the "control" color and the button background are
the same, but it isn't always. Be as specific as possible when pulling values
out of the defaults table.
wongkw: Another question on themes: Will you be
providing mechanism for runtime editing/creation/storing of current/new themes?
SPK-mca: Currently themes are only provided in JLF/Organic. There
is some discussion about making them a more generic part of JFC/Swing. These
discussions will most likely involve some talk of a mecahnism like the one
you've asked for.
aywong: I have a question about propagating L&F
updates to components that are not part of any containment hierarchy. My
application has JPopupMenus. They are never added to any
containers, however, since I only want them to display when the user
right-clicks. Currently, my L&F update method calls
updateComponentTreeUI not only on the root component of my
application, but also makes separate calls to specifically update all the
popup menus that I have. I'm assuming there's no way around this, right? I
suppose that I could add all my popups to a single JPanel that is
never displayed, but then I would still need to call
updateComponentTreeUI on that JPanel, right?
SPK-SteveW: The current L&F is a Beans-style bound property in
the UIManager class. You can listen for changes in the the current
L&F, which are broadcast as PropertyChangeEvents. The next
version of Swing will ship with a sample called "Showcase," which
shows how to listen for UI switches to update components not in the main
hierarchy.
aywong: The Swing Connection is not totally clear on
the issue of the chooser dialogs (Color and File). They are going into the
preview package. Does that mean they will not be frozen until after 1.0 release?
SPK-SteveW: Yes, this means that the API for
ColorChooser and FileChooser will not be frozen until
after the 1.0 release. We felt that we haven't had enough time to flesh them
out and get feedback. Instead of freezing something substandard, we thought it
would be better to wait and get more feedback.
wongkw: Will there be a PrinterChooser
similar to ColorChooser and FileChooser?
SPK-SteveW: There aren't currently plans for one, but is sounds
like a cool idea at first look.
rankin: There is also some mention of a
FontDialog. Will that appear in Swing 1.0?
SPK-SteveW: This is still planed, but not as part of 1.0. There
are a few other choosers planned for later down the road.
aywong: I have a JScrollPane that
contains a single custom component I've written. The size of visible scrollpane
area is typically larger than the component itself, and I want all the areas
not "covered up" by my component to be a specific color (like white).
I was not able to get the scrollpane to change this color from the default
using setBackground. What I did to work around this was to add a
line to the component's paint method that just draws a huge white rectangle
(larger than the scrollpane could ever get), and then draws the component
proper over it. Is there a better way to do this?
SPK-SteveW: There have been lots of problems with colors in
ScrollPanes. We've done lots of work on these types of issues
(especially opaque vs. transparent components). I think your
setBackground call will work properly in the next release.
wongkw: I am surprised there is no plan for a
printerChooser. Imagine a Swing application with printing
capability: the user will be switched to a native-looking printer setup dialog
instead of their favorite Orangic L&F. Users may complain of inconsistency
in L&F.
SPK-SteveW: Everything is a matter of time and priorities. If
you'd really like to see a printer chooser, then get all your friends to send
mail to swing-feedback@eng.sun.com and ask for one! Everyone on the Swing
team reads those messages.
aywong: Has there been any consideration of slider
controls that have two sliders that would let you select a range of values?
SPK-SteveW: We haven't really talked about this, but it is an
interesting concept. The Sliders have gotten a lot of attention lately, and
now have nice APIs for labels and ticks. Send your idea to
swing-feedback@eng.sun.com.
aywong: [Somewhat in reply to wongkw] My Swing
application has printing capability and switches to a native print dialog upon
printing like you described. Yeah, it's a little jarring, but hey, none of my
users are complaining so far...they're all overwhelmed by the quality of the
Swing components and the utter and absolute coolness of dynamic L&F
morphing!
MDR-Andrea: We've run out of time. Thanks to everyone for joining,
especially our guestsMike and Steve. If you have any additional feedback
or questions send them to
swing-feedback@eng.sun.com.
Be sure to join us next week when Java Live features a forum on the
Java Activator. See you
next week!
|