Java Reference
In-Depth Information
public HelloXlet() {
}
public void initXlet(final XletContext xletContext)
throws XletStateChangeException {
context = xletContext;
if(rootContainer == null) {
try {
rootContainer = context.getContainer();
rootContainer.add(this);
} catch (UnavailableContainerException e) {
System.out.println("Could not get our container!");
throw new XletStateChangeException( "No container. "
+ e.getMessage() );
}
}
}
public void startXlet() throws XletStateChangeException {
rootContainer.setVisible(true);
}
public void paint(Graphics g) {
g.drawString("Hello Xlet", 0, 100);
}
public void pauseXlet() {
System.out.println("HelloXet.pauseXlet()");
}
public void destroyXlet(boolean b) throws XletStateChangeException {
System.out.println("HelloXet.destroyXlet() - goodbye");
}
}
Figure 9-2 shows the Xlet's output when run in the Java ME emulator.
 
Search WWH ::




Custom Search