Advertisement
alishaik786

SetImage.java

Mar 9th, 2012
43
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. public class SamplePopupScreen extends PopupScreen
  2. {
  3. BitmapField bitmapField[];
  4. Bitmap bitmap=Bitmap.getBitmapResource("box-s6A.png");
  5. public SamplePopupScreen()
  6. {
  7. super(new VerticalFieldManager(),PopupScreen.DEFAULT_CLOSE);
  8. createGUI();
  9. }
  10.  
  11. private void createGUI()
  12. {
  13. bitmapField=new BitmapField[3];
  14. add(new LabelField("Popup Screen",Field.FIELD_HCENTER));
  15. for(int i=0;i<3;i++)
  16. {
  17. VerticalFieldManager vr=new VerticalFieldManager(Field.FIELD_HCENTER|VERTICAL_SCROLL|VERTICAL_SCROLLBAR);
  18.  
  19. bitmapField[i]=new BitmapField(null,Field.FOCUSABLE|Field.FIELD_HCENTER)
  20. {
  21. protected void paint(Graphics g)
  22. {
  23. g.clear();
  24. g.drawText("LabelNunber", 0, 0);
  25. if(isFocus())
  26. {
  27. g.drawBitmap(0, 0, bitmap.getWidth(), bitmap.getHeight(), bitmap, 0, 0);
  28. g.drawText("LabelNunber",0,0);
  29. }
  30. }
  31. protected void layout(int width, int height)
  32. {
  33. super.layout(250, 50);
  34. setExtent(250, 50);
  35. }
  36. };
  37. bitmapField[i].setBackground(BackgroundFactory.createSolidBackground(Color.RED));
  38. vr.add(bitmapField[i]);
  39. add(vr);
  40. }
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement