Title: Glasspane Demo
1Glasspane Demo
2http//java.sun.com/j2se/1.4.2/docs/api/javax/swin
g/JRootPane.html
3http//java.sun.com/docs/books/tutorial/uiswing/co
mponents/rootpane.html
4javax.swing.SwingUtilities
invokeLater
public static void invokeLater(Runnable doRun)
after all pending AWT events have been processed
class XXX implements Runnable public void
run() CreateAndShowGUI()
- The method should be used when the thread needs
to updated the GUI
5javax.swing.SwingUtilities
invokeLater
Examle code
Runnable doHelloWorld new Runnable()
public void run() System.out.println("H
ello World on " Thread.currentThread())
SwingUtilities.invokeLater(doHelloWorld)
System.out.println("This might well be displayed
before the other message.")
- If invokeLater is called from the event
dispatching thread
- The run method will be deferred until all pending
events have been processed
Such as JButtons ActionListener
6GlassPane Demo
- ??
- GlassPane visible ?, ??????Form ?event
- ???? SwingUtilities.convertPoint method ?
glasspane ??????? Form ?????????????????????? - ?????? component.dispatchEvent ??? Event ???????