Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/blackberry/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/fortran/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Graphics 如何在BlackBerry上的位图/位图字段上进行自定义绘图?_Graphics_Blackberry - Fatal编程技术网

Graphics 如何在BlackBerry上的位图/位图字段上进行自定义绘图?

Graphics 如何在BlackBerry上的位图/位图字段上进行自定义绘图?,graphics,blackberry,Graphics,Blackberry,我想做一些相对简单的事情:我想完全用代码创建一个位图对象,在上面画线条、文本、椭圆、矩形、点等,然后在黑莓屏幕上的位图字段中显示它 谁能给我一个简单的代码示例来演示如何做到这一点,或者给我一个链接到一个好的示例项目 更新:我有这个代码示例,但它使用了一个不推荐使用的图形构造函数: 如果不使用获取位图的图形构造函数,如何执行相同的操作?覆盖绘制方法: Bitmap bmp = new Bitmap(100, 100) { public void paint(Graphics graphics

我想做一些相对简单的事情:我想完全用代码创建一个位图对象,在上面画线条、文本、椭圆、矩形、点等,然后在黑莓屏幕上的位图字段中显示它

谁能给我一个简单的代码示例来演示如何做到这一点,或者给我一个链接到一个好的示例项目

更新:我有这个代码示例,但它使用了一个不推荐使用的图形构造函数:


如果不使用获取位图的图形构造函数,如何执行相同的操作?

覆盖绘制方法:

Bitmap bmp = new Bitmap(100, 100) {
   public void paint(Graphics graphics) {
      graphics.clear();
      // write your code here
      super.paint(graphics);
   }   
};  

您可以在Graphics类上使用静态工厂方法:Graphics.createBitmap

我想您指的是位图字段而不是位图
Bitmap bmp = new Bitmap(100, 100) {
   public void paint(Graphics graphics) {
      graphics.clear();
      // write your code here
      super.paint(graphics);
   }   
};