401 |
menuBar.remove(menu); |
menuBar.remove(menu); |
402 |
} |
} |
403 |
|
|
|
/** |
|
|
* Notifies this frame that it should create its native peer. |
|
|
*/ |
|
|
private static void fireDummyEvent() |
|
|
{ |
|
|
EventQueue.invokeLater(new Runnable() |
|
|
{ |
|
|
public void run() |
|
|
{ |
|
|
// Do nothing here. |
|
|
} |
|
|
}); |
|
|
} |
|
|
|
|
404 |
public void |
public void |
405 |
addNotify() |
addNotify() |
406 |
{ |
{ |
409 |
if (peer == null) |
if (peer == null) |
410 |
peer = getToolkit ().createFrame (this); |
peer = getToolkit ().createFrame (this); |
411 |
|
|
|
// We now know there's a Frame (us) with a live peer, so we can start the |
|
|
// fundamental queue and dispatch thread, by inserting a dummy event. |
|
|
if (parent != null && parent.isDisplayable()) |
|
|
fireDummyEvent(); |
|
|
|
|
412 |
super.addNotify(); |
super.addNotify(); |
413 |
} |
} |
414 |
|
|
417 |
if (menuBar != null) |
if (menuBar != null) |
418 |
menuBar.removeNotify(); |
menuBar.removeNotify(); |
419 |
super.removeNotify(); |
super.removeNotify(); |
|
|
|
|
// By now we've been disconnected from the peer, and the peer set to |
|
|
// null. This is formally the same as saying "we just became |
|
|
// un-displayable", so we wake up the event queue with a dummy event to |
|
|
// see if it's time to shut down. |
|
|
fireDummyEvent(); |
|
420 |
} |
} |
421 |
|
|
422 |
/** |
/** |