Moderator (MDR): SPK-jaz
SPK-jaz: Hello, and welcome to the first set of office hours for Part I of the online Swing course. My name is John Zukowski, with MageLang Institute (http://www.magelang.com), and I'll be available for the next hour to answer any questions you may have about Part I of the Short Course, or Swing in general.
bouzi: About MenuShortcuts
, I am using JMenuItem
and setting setKeyAccelerator
. This works when displaying the shortcut (underlined), but no Ctrl or Alt sequence actually gets to it.
SPK-jaz: The key accelerator is not the same as the 1.1 MenuShortcut
. A key accelerator highlights a particular letter of the menu item, to signify that the user can select it with the appropriate shortcut key and the accelerator key. I'm trying to create an example to demonstrate the shortcut vs. accelerator thing for you.
bouzi: So am I not supposed to use key accelerators for menus, or should I use them differently? Or is it possible to use normal MenuShortcuts
with JMenuItems
?
SPK-jaz: You can use key accelerators with menus, but they underline the accelerator key, vs. show something like CTRL-V. For instance, ALT-E, ALT-P is paste, vs. just CTRL-V in most Windows apps. It looks like the way the Swing team set up the MenuItem
UI, the key accelerator and the shortcut are equivalent. I'll have to send them a message about this as that isn't the way it should be.
So, paragshah, have you tried out the online Swing course yet?
paragshah: I haven't tried the online Swing course yet. Actually I'm working on a tree interface that is still not a part of the course.
SPK-jaz: JTree
is covered in Part II of the class. Do you have a particular question about JTree
?
paragshah: I have made an applet that uses the JTree
class. The applet shows erratic behaviour with different browsers.
SPK-jaz: Applet support isn't really there yet in Swing. Stick with applications. It's gotten better...
paragshah: Do you have any idea when there will be applet support? Because I am developing something that needs browser support. I would like to use JFC for that, if the applets become stable in some time.
SPK-jaz: When it is released, there will be applet support for sure. Before then, I don't know when. I would at least hope when it hits beta it will be there. Because untrusted applets can't touch the system event queue, the JComponent
internal event handling needs to be done a little differently. Apparently, the Swing team doesn't have all the kinks out of this yet.
paragshah: Another problem I faced with Swing was when I tried to make one of my components, which extended from JPanel
into a bean. I understand that JPanel
is by itself a bean. But if I extend anything from JPanel
and try to drop it into the beanbox it gives exceptions while loading it.
SPK-jaz: What kind of exceptions?
paragshah: The classloader gives an exception. Some kind of securiry exception while loading resources. SecurityException: No access through getResource() to .class in 1.1
SPK-jaz: I wasn't aware of this problem. However, if you create a test case and send it off to the Swing team, I'm sure they would take a look at it. Or just submit a bug report. Creating a simple testcase helps in getting a response, otherwise if the tester can't recreate the problem, they'll think it's a user error.
mzimmerm: John, let me say first that the Swing Short Course is great! I have been using code from it a lot to help me. One thing I could not do was to access some links, I get following message:
This page is restricted to authorized JDC members. If you are supposed to have access to this area, please send us an email. If you've just been granted access, but got this message before, try pressing the Reload or Refresh button on your browser.
As well, I tried to save pizza.jar on my PC (Win95) and run: