362 public final void dispatchEvent(AWTEvent e) {
363 dispatchEventImpl(e);
364 }
365
366 void dispatchEventImpl(AWTEvent e) {
367 EventQueue.setCurrentEventAndMostRecentTime(e);
368
369 Toolkit.getDefaultToolkit().notifyAWTEventListeners(e);
370
371 if (newEventsOnly ||
372 (parent != null && parent instanceof MenuComponent &&
373 ((MenuComponent)parent).newEventsOnly)) {
374 if (eventEnabled(e)) {
375 processEvent(e);
376 } else if (e instanceof ActionEvent && parent != null) {
377 e.setSource(parent);
378 ((MenuComponent)parent).dispatchEvent(e);
379 }
380
381 } else { // backward compatibility
382 Event olde = e.convertToOld();
383 if (olde != null) {
384 postEvent(olde);
385 }
386 }
387 }
388
389 // REMIND: remove when filtering is done at lower level
390 boolean eventEnabled(AWTEvent e) {
391 return false;
392 }
393 /**
394 * Processes events occurring on this menu component.
395 * <p>Note that if the event parameter is {@code null}
396 * the behavior is unspecified and may result in an
397 * exception.
398 *
399 * @param e the event
400 * @since 1.1
401 */
|
362 public final void dispatchEvent(AWTEvent e) {
363 dispatchEventImpl(e);
364 }
365
366 void dispatchEventImpl(AWTEvent e) {
367 EventQueue.setCurrentEventAndMostRecentTime(e);
368
369 Toolkit.getDefaultToolkit().notifyAWTEventListeners(e);
370
371 if (newEventsOnly ||
372 (parent != null && parent instanceof MenuComponent &&
373 ((MenuComponent)parent).newEventsOnly)) {
374 if (eventEnabled(e)) {
375 processEvent(e);
376 } else if (e instanceof ActionEvent && parent != null) {
377 e.setSource(parent);
378 ((MenuComponent)parent).dispatchEvent(e);
379 }
380
381 } else { // backward compatibility
382 @SuppressWarnings("deprecation")
383 Event olde = e.convertToOld();
384 if (olde != null) {
385 postEvent(olde);
386 }
387 }
388 }
389
390 // REMIND: remove when filtering is done at lower level
391 boolean eventEnabled(AWTEvent e) {
392 return false;
393 }
394 /**
395 * Processes events occurring on this menu component.
396 * <p>Note that if the event parameter is {@code null}
397 * the behavior is unspecified and may result in an
398 * exception.
399 *
400 * @param e the event
401 * @since 1.1
402 */
|