-
Enhancement
-
Resolution: Unresolved
-
P4
-
1.1.7, 1.3.1, 1.3.1_06, 1.4.0, 1.4.1, 1.4.1_02, 1.4.2, 6, 6u12
-
x86, sparc
-
solaris_2.5.1, windows_nt, windows_2000, windows_xp
It seems like one problem with the current
Swing M/(VC) model is that there is no ordering
distinction among the listeners added to Swing
components. This makes it very difficult to
ensure that operations are ordered properly.
For instance, with the JComboBox, it is easily
possible to have one's actionPerformed() method
called before the JComboBox has completed its
rendering cycle and put the popup menu down. In
our application, we put up a modal dialog in response
to a change in a particular JComboBox. Because
our actionPerformed() method is called before the
V/C has finished with its rendering, we get the
display stuck in the middle. There is no practical
way of preventing this outcome, as even if we use
threads, there's no guarantee that we can invoke
the display of our dialog after the JComboBox has
finished putting down the popup menu. The
SwingUtilities.invokeLater() method might help
here, but it seems very iffy at best. If we
could add a listener with the qualification that
it was to be called after the primary gui control
had finished with its update cycle, this wouldn't
be an issue.
Similarly, there are times when one seeks to do
event filtering, such as with popup's over JLists,
or with keystrokes in a text field. It would be
great if there was a way to get notified of an
event before the model was, so that some code
could make a go/no-go decision before the gui
did its update. We do this with text fields
now by subclassing the text field and overriding
processKeyEvent(), but this seems very reminiscent
of the pre-JDK 1.1 model, where you had to subclass
everything to provide any sort of custom behavior.
If it were possible to interpose an event listener
before the model was changed that had the ability
to prevent further processing of the event,
it would be possible to easily impose event
filtering without having to be always subclassing
GUI components and/or models.
My briefly-thought-out idea is to have three temporal
categories for listeners, so you could add listeners
to be called before, during, and after the gui
rendering cycle. I know this is a horrifically
big change to the code, and may thus not be feasible,
but as it stands, it is very difficult to reliably
use Swing in some circumstances because of the
loose-binding brought about by the MVC model.
(Review ID: 39994)
======================================================================
- duplicates
-
JDK-4730055 getSelectedRows return non-existing rows in JTable
-
- Closed
-
-
JDK-4816818 JList.getSelectedValue() does not handle items removed from the model
-
- Closed
-
-
JDK-6809490 Removing a Table Column causes wrong selected column
-
- Closed
-
-
JDK-4675786 getPreferredSize() in BasicListUI reporting stale size
-
- Closed
-
-
JDK-4871932 MouseMotionListener on JTable disappears when Look And Feel (LAF) changes
-
- Closed
-
-
JDK-6508168 NullPointerException while updateUI() in MouseListener of JTable header.
-
- Closed
-
-
JDK-5032759 Please add ability to know when JTree.getRowCount() has changed
-
- Closed
-
- relates to
-
JDK-6294075 JList double highlights entries when selection pops up a modal dialog
-
- Closed
-
-
JDK-6877806 JComboBox: Problem after clicking to open dropdown list
-
- Closed
-
-
JDK-4809657 RFE: Support for dependant properties in JavaBeans
-
- Open
-
-
JDK-4688560 1.4.0 REGRESSION: DefaultCaret calls back into View hierachy du
-
- Resolved
-