JDK-4223738 : Need way to truly veto loss of focus (vs. simply regain it in focusLost method)
  • Type: Enhancement
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 1.1,1.2.1
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: generic,windows_95
  • CPU: generic,x86
  • Submitted: 1999-03-24
  • Updated: 2000-10-04
  • Resolved: 2000-10-04
Related Reports
Duplicate :  
Duplicate :  
Description

Name: krT82822			Date: 03/24/99


orig synopsis:  "Focus Management and event dispatching dependencies"

This is a MUCH needed enhancement for the AWT focus management.

There really needs to be a way of Vetoing a loseFocus event on
a GUI control. A veto would result in gainFocus, tab key events,
and clicked events to NEVER make it to another GUI control.

Here is an outline that describes the problem:

A gui control is placed on a panel, inside a window. Lets say
this control is a text field. The text value of this field needs
to be validated that it is a string representation of a Date.

If the value entered by the user is "ABC" and they then click on
a button. We want to display an error message that indicates they
have not typed a valid date and keep focus on that control WITHOUT
triggering the clicked event of the button. So if validation does
not pass on the control and a lose focus event occurs AND that
event gets vetoed, the clicked needs to either be pulled off the
event queue or never placed on the event queue until the lose focus
has been processed successfully.
(Review ID: 56026)
======================================================================

Comments
WORK AROUND Name: krT82822 Date: 03/24/99 Since a losefocus event causes both a losefocus and a gainfocus to be placed on the queue. It is possible to peek at the queue everytime a losefocus is encountered and then pull the next event off the queue. The next event is ALWAYS a gainFocus only because of the way the two events are added to queue. In the case of a clicked event however, this becomes increasingly more difficult. ======================================================================
11-06-2004

EVALUATION Currently planning to implement this functionality, or equivalent functionality, in the merlin focus enhancements. david.mendenhall@eng 1999-12-14
14-12-1999