Skip to main content

My program don't call the method repaint in javadtv

1 reply [Last post]
danieltavares1
Offline
Joined: 2010-06-16
Points: 0

I did tests with the code and i saw that it covered the right way. The method repaint() is in this way, but the program never call it. I don't know why the repaint don't call the paint because I rewrote this method. Please, if somebody knows what is going on, help me!! Thank you!

the code is:

package com.sun.demo.hellodtvworld;

import com.sun.dtv.lwuit.Form;
import com.sun.dtv.lwuit.Label;

import com.sun.dtv.lwuit.plaf.UIManager;
import com.sun.dtv.lwuit.util.Resources;

import com.sun.dtv.ui.DTVContainerPattern;
import com.sun.dtv.ui.DTVContainer;

import java.awt.Color;
import java.awt.Graphics;
import javax.tv.graphics.TVContainer;
import javax.tv.xlet.Xlet;
import javax.tv.xlet.XletContext;

public class Main implements Xlet {

DTVContainer dtvContainer;

protected void paint(Graphics g)
{
g.setColor(Color.white);
g.drawLine(60, 30, 10, 30);
System.out.println("teste");
}
public void initXlet(XletContext context) {
System.out.println("initXlet called");

java.awt.Container tvc = TVContainer.getRootContainer(context);
Form.init(tvc);

buildDTVContainer();

}
public void startXlet() {
System.out.println("startXlet called");

dtvContainer.setVisibility(true);
dtvContainer.repaint();

}

public void pauseXlet() {
System.out.println("pauseXlet called");
dtvContainer.setVisibility(false);
}

public void destroyXlet(boolean unconditional) {
System.out.println("destroyXlet called");
dtvContainer.dispose();
}

public void buildDTVContainer() {

try {
Resources r1 = Resources.open("/dtvTheme.res");
UIManager.getInstance().setThemeProps(r1.getTheme(r1.getThemeResourceNames()[0]));
} catch (Exception e) {
e.printStackTrace();
}

dtvContainer = DTVContainer.getBestDTVContainer(new DTVContainerPattern());

final Form form = new Form("Oi mundo!");

form.addComponent(new Label("Isto e um rotulo paola"));

dtvContainer.addToFront(form);

dtvContainer.setBackgroundMode(DTVContainer.BACKGROUND_FILL);

}

}

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
tamir
Offline
Joined: 2006-08-29
Points: 0

Hi Daniel,

You need to override the dtvContainer repaint method, or other inner container/component.
What you did was overriding the Xlet repaint, which is not existing in Xlet.

Regards,
Tamir
https://javatv-developers.dev.java.net