This discussion is archived
2 Replies Latest reply: Nov 12, 2008 7:48 AM by 843851 RSS

HText not moving or showing

843851 Newbie
Currently Being Moderated
Hello everyone!

I have a rectangle and I have a HText.
I want the rectangle to show up behind the HText (z-order).
I have tried both the popToFront(), and pushBehind() methods.
I have also tried to add the rectange after I add the HText, but for some reason nothing will work.
The function of the rectange is just to be a nice background.

I'm using Xletview.

I'm also having issues with setting the bounds of my HText. Should I not use setBounds() ?

Any help will be greatly appreciated.

Thanks in advance!
  • 1. Re: HText not moving or showing
    843851 Newbie
    Currently Being Moderated
    Hi,

    ¿Which is the reason of drawing a text in front of a rectangle? If you want to paint a button you can use HTextButton class.
                 btnAcept.setTextContent("ACEPT", HState.NORMAL_STATE);
    
              btnAcept.setLocation(pxBtnAcept, pyBtnAcept);
    
              btnAcept.setSize(wBtnAcept, hBtnAcept);
    
              btnAcept.setActionCommand("OK");
    
              
    
              btnAcept.setBackgroundMode(HVisible.BACKGROUND_FILL);//without this the backgroud won´t be painted
    
              btnAcept.setBackground(backColorBtnAcept);
    
              btnAcept.setForeground(foreColorBtnAcept);
    And be aware that Xletview has limitations and some Java TV & MHP features are not supported. A better way of testing application is having a decoder conected to your computer (using a video capture card) and to uploading applications directly through a serial cable.


    I hope it will help,

    Aitor

    Edited by: apenz on Nov 6, 2008 7:20 AM
  • 2. Re: HText not moving or showing
    843851 Newbie
    Currently Being Moderated
    Be carefully as XletView is not completly developed, some parts of the HScene object are not implemented (I don't know about push and pop methods) you can see which parts are working or partially working http://www.xletview.org/status/status-0.3.6.html

    And if what you want is some color behind your text, using those two elements maybe unnecessary if you want plain colors. The HText object has some methods to change the background as .setBackgroundColor(java.awt.Color c) and .setBackgroundMode(HText.BACKGROUND_FILL) with these methods you can change the background color of the text.

    And if you want an image other option is using a HGraphicButton as apenz says. Or maybe you want to integrate a more complex background in the background layer and put things over there.