Glasspane Demo - PowerPoint PPT Presentation

1 / 6
About This Presentation
Title:

Glasspane Demo

Description:

How to Use Root Panes Glasspane Demo javax.swing.SwingUtilities invokeLater The method should be used when the thread needs to updated the GUI javax.swing ... – PowerPoint PPT presentation

Number of Views:72
Avg rating:3.0/5.0
Slides: 7
Provided by: Jing79
Category:
Tags: demo | glasspane | java

less

Transcript and Presenter's Notes

Title: Glasspane Demo


1
Glasspane Demo
  • How to Use Root Panes

2
http//java.sun.com/j2se/1.4.2/docs/api/javax/swin
g/JRootPane.html
3
http//java.sun.com/docs/books/tutorial/uiswing/co
mponents/rootpane.html
4
javax.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

5
javax.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
6
GlassPane Demo
  • ??
  • GlassPane visible ?, ??????Form ?event
  • ???? SwingUtilities.convertPoint method ?
    glasspane ??????? Form ??????????????????????
  • ?????? component.dispatchEvent ??? Event ???????
Write a Comment
User Comments (0)
About PowerShow.com