|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--menu.Page | +--appmain.URLPage
A URLPage is used to display the content of a single URL. This is a dynamic Page, since it may take a while for the URL to load and we must return quickly from the constructor and doCommandAction.
Field Summary |
Fields inherited from class menu.Page |
run, theThread |
Constructor Summary | |
URLPage(java.lang.String label,
java.lang.String url)
Initialize a new URLPage object using the supplied parameters and default values where needed. |
|
URLPage(java.lang.String label,
java.lang.String title,
javax.microedition.lcdui.Image icon,
java.lang.String url)
Initialize a new URLPage object using the supplied parameters. |
Method Summary | |
int |
doCommandAction(javax.microedition.lcdui.Command c,
javax.microedition.lcdui.Displayable d)
Process the user command and return an integer value telling the PageMgr what to do next. |
javax.microedition.lcdui.Displayable |
getDisplayable()
Return the Displayable object for this URLPage, partially filled in and ready to display. |
void |
run()
Do all the exciting connecting to the network and reading the contents from the URL. |
Methods inherited from class menu.Page |
getIcon, getLabel, getLinkedPage, getPrevious, getTitle, setPrevious, start |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public URLPage(java.lang.String label, java.lang.String title, javax.microedition.lcdui.Image icon, java.lang.String url)
label
- short label for this page (as might be used in
a menu)title
- longer label for this page (as might be used in
a screen title)icon
- small icon for this page (as might be used in
a toolbar or menu)url
- the String describing the url to readpublic URLPage(java.lang.String label, java.lang.String url)
label
- short label for this page (as might be used in
a menu)url
- the String describing the url to readMethod Detail |
public int doCommandAction(javax.microedition.lcdui.Command c, javax.microedition.lcdui.Displayable d)
doCommandAction
in class Page
c
- a Command object identifying the command.d
- the Displayable on which this event has occurred
public javax.microedition.lcdui.Displayable getDisplayable()
getDisplayable
in class Page
public void run()
Any action that affects objects that other threads may access or change must be done within a synchronized block.
Any action that does not affect shared objects should not be done within a synchronized block so that the user command thread can dive in and out of this object concurrently with this thread.
Each little sychronized block is a unit that gets done atomically. Before starting the next one there's a chance that the user command thread will cancel this thread altogether by setting run to false.
Note that local variables in the run() method are allocated each time a new thread starts execution in run(). Instance variables are shared between all threads running in an object's run() method.
run
in interface java.lang.Runnable
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |