2011-04-08 77 views
0

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

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 

} //主屏幕的结束

回答

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); 
} 
} 

你将不得不自己的按钮和其他图形添加到它,但这应该至少可以帮助你指明正确的方向。

1

用空实现覆盖applyTheme,并且黑色边框消失。你不能修复这个从构造函数单独:

protected void applyTheme(){} 
+0

这也将吹出你的按钮等在ui组件内的主题,所以要做好准备:) – Dan 2011-04-09 16:26:27

+0

thanx。迈克尔我用这个做了这个。 – dev 2011-04-11 07:27:54