2 Replies Latest reply: Jan 29, 2009 7:52 AM by 843851 RSS

    Help!  Can't display!

    843851
      It seems like there's a ton of information about the conceptual structure of Java TV on the internet, and great documentation for all the functions, but there's no intermediary material that discusses which classes/functions relate to which concepts. For example, there's no direct mapping between an object structure and the three-layer model, at least as far as I know. As a result, I've been trying for days to get a simple Xlet working that simply displays a white screen, with no luck.

      Here's the code that I'm working on. Basically, when it runs I want it to create a white screen, but it instead does absolutely nothing. I have a feeling that I'm missing a graphics handler or that I am grabbing the wrong container, but I can't seem to locate any source that tells me how to do either correctly.
      import java.awt.Color;
      import java.awt.Container;
      import javax.tv.xlet.Xlet;
      import javax.tv.xlet.XletContext;
      import javax.tv.xlet.XletStateChangeException;
      import org.havi.ui.HGraphicsDevice;
      import org.havi.ui.HScene;
      import org.havi.ui.HSceneFactory;
      import org.havi.ui.HScreen;
      
      public class XletEASMain implements Xlet
      {
           final public static boolean STARTED = true, PAUSED = false;
           
           private HScene hScene;
           private XletContext context;
           private boolean state;
           
           public XletEASMain()
           {
           }
           
           public void initXlet(XletContext context)
               throws XletStateChangeException
          {          
                this.context = context;
                this.state = PAUSED;
                
                {
                     HGraphicsDevice device = HScreen.getDefaultHScreen().getDefaultHGraphicsDevice();
                     HSceneFactory factory = HSceneFactory.getInstance();
      
                     this.hScene = factory.getFullScreenScene( device );
      
                     if ( this.hScene == null )
                          this.hScene = factory.getDefaultHScene();
                     
                     this.hScene.setBackground( Color.white );
                     this.hScene.setForeground( Color.white );
                }
          }
      
           public void startXlet()
                throws XletStateChangeException
          {
                this.state = STARTED;
                
                this.hScene.validate();
                this.hScene.setVisible( true );
                this.hScene.show();
                this.hScene.repaint(); // just trying stuff at this point; nothing works
          }
      
           public void pauseXlet()
           {
                this.state = PAUSED;
                
                this.hScene.setVisible( false );
           }
           
           public void destroyXlet(boolean unconditional)
                throws XletStateChangeException
           {
                if( unconditional )
                     return;
                
                else
                     throw new XletStateChangeException();
           }
      }