Package

Source Code of PlayMenuMain

/*
* Main class
*
*
*/

import bdjunit.framework.TestSuite;
import java.awt.Color;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Rectangle;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import javax.tv.xlet.Xlet;
import javax.tv.xlet.XletContext;
import javax.tv.xlet.XletStateChangeException;
import org.davic.resources.ResourceClient;
import org.davic.resources.ResourceProxy;
import org.dvb.ui.DVBAlphaComposite;
import org.dvb.ui.DVBGraphics;
import org.havi.ui.HScene;
import org.havi.ui.HSceneFactory;

/**
* This is xlet application main class.
*
*/
public class PlayMenuMain implements Xlet, ResourceClient, KeyListener {
   
    private XletContext xletContext;
    private HScene hscene;
    private Graphics graphics;
    private String helloString = "Hello BD-J!";
      
    public void initXlet(XletContext xletContext) throws XletStateChangeException {       
        this.xletContext = xletContext;
        //setRes();
    }

    public void startXlet() throws XletStateChangeException {
               
        hscene = HSceneFactory.getInstance().getDefaultHScene();
        hscene.setBackgroundMode(HScene.BACKGROUND_FILL);
        hscene.setVisible(true);
        hscene.requestFocus();
        hscene.setBounds(new Rectangle(0,0, 1920,1080));
        hscene.setVisible(true);
       
        graphics = hscene.getGraphics();
        try {
            DVBAlphaComposite.getInstance(DVBAlphaComposite.SRC);
            ((DVBGraphics)graphics).setDVBComposite(DVBAlphaComposite.getInstance(DVBAlphaComposite.SRC));
        }
        catch (Exception e) {
                //System.out.println(e);
        }       
       
        hscene.addKeyListener(this);                  
       
        // Tests
        try {
        TestSuite suite = new TestSuite();
        suite.addTest(bdjunit.examples.TestCase1.suite());
        //bdjunit.textui.DVBLogTestRunner.run(suite, scene);
        //bdjunit.haviui.TestRunner.run(suite, container);
        bdjunit.haviui.TestRunner.run(suite, hscene);
        } catch (Exception ex) {
            graphics.drawString(ex.toString(),500,500);
        }
    }

    public void pauseXlet() {
        // Do nothing
    }

    public void destroyXlet(boolean arg0) throws XletStateChangeException {
        // Do nothing
    }

    public boolean requestRelease(ResourceProxy arg0, Object arg1) {
        // Do nothing
        return true;
    }

    public void release(ResourceProxy arg0) {
        // Do nothing
    }

    public void notifyRelease(ResourceProxy arg0) {
        // Do nothing
    }

    public void keyTyped(KeyEvent arg0) {
        // Do nothing
    }

    public void keyPressed(KeyEvent arg0) {
        // TEST Code for show some thing
        //graphics.setFont(new Font("Tireasias",Font.PLAIN,56));
        //graphics.setFont(new Font(null, Font.PLAIN, 56));
        //graphics.setColor(Color.blue);
        //graphics.drawString(helloString,100,100);
        //graphics.setColor(Color.white);
        //graphics.drawString(helloString,500,500);       
    }

    public void keyReleased(KeyEvent arg0) {
        // Do nothing
    }
   
}
TOP

Related Classes of PlayMenuMain

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.