Community
Participate
Working Groups
Launching the event wizard on a Swing Document bean shows the document event type on the tree, but no event methods under it. There should be event methods under the DocumentListener for changedUpdate, insertUpdate and removeUpdate. Note that the undoableEdit event type is shown properly on the same bean. To recreate this problem: Drop a JTextField. Use the bean reference property editor on the document property to drop a new PlainDocument object. Select the PlainDocument object on the free form, MB2->Events->Add Events... The document event type shown on the wizard does not have any event methods listed.
This actually looks like a Swing bug. The problem is that the introspector just doesn't see the 3 methods on javax.swing.text.DocumentListener as being valid callback methods. The reason is because their argument does not extend java.util.EventObject. If you look at javax.swing.event.UndoableEditEvent this extends java.util.EventObject, however javax.swing.event.Document event doesn't (it couldn't anyway because it is an interface) The Introspector method that does the filtering check it: private boolean isEventHandler(Method m) throws IntrospectionException { // We assume that a method is an event handler if it has a single // argument, whose type inherit from java.util.Event We need to log with this Sun, so I've sent Mark Davidson (the Sun BeanInfo developer) to see what he thinks