Skip to main content

HTextButton

3 replies [Last post]
peez
Offline
Joined: 2007-04-10
Points: 0

I have just started coding bd-j and sticking at the first button.

Is it possible that bd-j has problems with HTextButtons? When trying my simple application with one button in xletview everything works fine. But when burning it to BD-RE nothing happens.

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
bjoern_minkmar
Offline
Joined: 2007-06-11
Points: 0

Hi peez,

Which authoring software do you use to mux the project? Sonic Scenarist or Sony bluprint?
Did you make sure that there is a video-loop running in the background?
Do you see this video-loop when you play the BD-RE?
Do you use a software player to check the BD-RE or do you use a hardware-player?

Your problems could be caused by the following:
- wrong settings in the bdjo-file
- no video-loop in the background
- wrong Font-color settings ( HTextButton.setForeground(Color.red) -> works; HTextButton.setForeground(Color.RED) -> does not work)

If all of that does not help, please post more information.

Cheers,
Björn

peez
Offline
Joined: 2007-04-10
Points: 0

Hi Bjoern,
btw it's me, Philipp.

Now I managed these HTextbuttons ;) It was because I didn't remember from my MHP time that objects created are ordered from front to back.

I added a background first, then defined the buttons. Therefore the buttons weren't visible ;)

But now what about the focus. I have a class derived from HContainer where the two buttons are positionned. They show but don't have focus. Have I forgotten anything again?

public class AMenu extends HContainer {

private HTextButton m_bt1, m_bt2;

HStaticText m_bg = new HStaticText("");

public AMenu() {
super();

m_bt1 = new HTextButton("button1", 50, 20, 100, 100);
m_bt1.setBackground(Color.green);
m_bt1.setBackgroundMode(HVisible.BACKGROUND_FILL);
m_bt1.setForeground(new DVBColor(255,255,255,255));

m_bt1.setVisible(true);
add(m_bt1);

m_bt2 = new HTextButton("button2", 500, 20, 100, 100);
m_bt2.setBackground(Color.green);
m_bt2.setBackgroundMode(HVisible.BACKGROUND_FILL);
m_bt2.setForeground(new DVBColor(255,255,255,255));

m_bt2.setVisible(true);
add(m_bt2);

m_bt1.setMove(KeyEvent.VK_RIGHT, m_bt2);
m_bt2.setMove(KeyEvent.VK_LEFT, m_bt1);

m_bg.setBounds(0, 0, this.getSize().width, this.getSize().height);
m_bg.setBackground(new DVBColor(40, 40, 200, 100));
m_bg.setBackgroundMode(HVisible.BACKGROUND_FILL);
m_bg.setBordersEnabled(false);
m_bg.setVisible(true);
this.add(m_bg);

m_bt1.requestFocus();

}
}

bjoern_minkmar
Offline
Joined: 2007-06-11
Points: 0

Hi Philipp,

you should add something like the following to your AMenu class:
----------------------------------------------------------------------------------------------

public void requestFocus() {
super.requestFocus();
if(getComponentCount() > 0){
getComponent(0).requestFocus(); // puts focus on the first component you have added. that would be button m_bt1 in your example.
}
}

In your Xlet-class you would add the following code snippet:
-------------------------------------------------------------------------------------

public class MyXlet implements Xlet {

public void startXlet() throws XletStateException{

.... // your code as before including player creation, AMenu creation etc.

myHScene.setVisible(true); // then you make the HScene visible
myAMenu.requestFocus(); // then you request the focus for the AMenu object.

} //eof startXlet()

.... (other mtethods here)

}//eof MyXlet

So when your Xlet is started and the HScene is made visible, the focus will be put on the AMenu object.
The AMenu itself will then put the focus on the first component that has been added to it ( for example button m_bt1 ).

Cheers,
Björn