黑莓弹出没有黑色边框颜色的窗户

时间:2011-04-08 05:21:28

标签: blackberry popupwindow

大家好。以下是我的代码。我尝试从弹出窗口中删除黑色边框颜色。我试过这个,但我仍然得到小黑边框。 公共类S2SPopup扩展了PopupScreen {

public S2SPopup() 
{
    super(new VerticalFieldManager()
    {
        public void paint(Graphics g)
        {
            int a = g.getGlobalAlpha();
            int c = g.getColor();
            g.setColor(c);
            g.drawBitmap(0, 0, HomeScreen.popupimg.getWidth(),HomeScreen.popupimg.getHeight(),HomeScreen.popupimg, 0, 0);
            super.paint(g);
        }
        protected void sublayout(int maxWidth, int maxHeight) 
        {
            super.sublayout( HomeScreen.popupimg.getWidth(),HomeScreen.popupimg.getHeight());
            setExtent( HomeScreen.popupimg.getWidth(),HomeScreen.popupimg.getHeight());
        }

    });

    setBackground(BackgroundFactory.createSolidTransparentBackground(Color.WHITE, 0));



    VerticalFieldManager vfm_Label = new VerticalFieldManager(VerticalFieldManager.VERTICAL_SCROLL)
    {
        protected void sublayout(int maxWidth, int maxHeight) 
        {
            super.sublayout(maxWidth,150);
            setExtent(maxWidth, 150);
        }
    };
    vfm_Label.setMargin(80, 0, 0, 0);

    ButtonField btnclose = new ButtonField("",ButtonField.RIGHT)
    {
        public void paint(Graphics g)
        {
            //setBackground(BackgroundFactory.createSolidTransparentBackground(Color.WHITE, 0));
            int c = g.getGlobalAlpha();
            g.setBackgroundColor(c);
            super.paint(g);
        }
    };
    btnclose.setMargin(0, 0, 0, 250);
    btnclose.setChangeListener(new FieldChangeListener() {

        public void fieldChanged(Field field, int context) 
        {
            close();
        }
    });

    LabelField s2sLabelField = new LabelField()
    {
        public void paint(Graphics g)
        {
            g.setColor(Color.BLUE);
            super.paint(g);
        }
        protected void layout(int width, int height) 
        {
            super.layout(width, 150);
            setExtent(width, 150);
        }
    };
    s2sLabelField.setPadding(0, 50, 0, 30);
    s2sLabelField.setText("lasjdfljlsjlfj  ljsfdl jsflljfiowurnowncnvouern.zvovn ljlsfdjj jlj" +
            "jsljfdlj ljsfl sjfl jfjsljdfljslfu jsjf;ujerpljsfdjpn  sdflsajf ss23s mail jsldfjlfdju nsfjljljlfjmnn,nsf,n,nlojljlsndf,n,ljnsjfdljjufsn jj" +
            "sjfd;jjljlsduflja;sfj ljsldfujrqnfqperiujf.zvnpqrue 33333333333333333333333333333333333333 ");

    add(btnclose);
    vfm_Label.add(s2sLabelField);
    add(vfm_Label);



} //end of constructor

} //主屏幕结束

2 个答案:

答案 0 :(得分:1)

使用空实现覆盖applyTheme,黑色边框消失。你无法单独从构造函数中解决这个问题:

protected void applyTheme(){}

答案 1 :(得分:0)

我怀疑它会纠正这个问题,但是你可以尝试给你的代表经理一个0的余量,以确保其上没有一个,并且背景颜色正在从主题中悄悄进入。我过去实现的解决方案是创建自己的自定义屏幕

public class CustomPopup extends Screen {

public CustomPopup() {
    super(new VerticalFieldManager() {
        //your custom code or a custom manager class (which is what I did)
    );
    setBackground(BackgroundFactory.createSolidTransparentBackground(0x000000, 0));
}

protected void sublayout(int width, int height) {
    //make this screen take up the entire display
    setPosition(0, 0);
    setExtent(Display.getWidth(), Display.getHeight());

    //and layout the delegate
    setPositionDelegate(some_x, some_y);
    layoutDelegate(some_width, some_height);
}
}

您必须添加自己的按钮和其他图形,但这至少可以帮助您指明正确的方向。