473,326 Members | 2,136 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,326 software developers and data experts.

uploading immutable image in a canvas from files in j2me

hi,
i am trying to upload a image in canvas bt it is not responding. only black screen of canvas is shown, suggest me solution..

Expand|Select|Wrap|Line Numbers
  1. /*
  2.  * To change this template, choose Tools | Templates
  3.  * and open the template in the editor.
  4.  */
  5.  
  6. import java.io.IOException;
  7. import javax.microedition.midlet.*;
  8. import javax.microedition.lcdui.*;
  9. import java.util.*;
  10. public class fb_Midlet extends MIDlet {
  11.  
  12.  Display dis;
  13.  fb_login canvas;
  14.  Form form;
  15.  Image image;
  16.  ImageItem imageitem;
  17.  
  18.     public fb_Midlet()
  19.      {
  20.      dis= Display.getDisplay(this);
  21.      canvas = new fb_login(this);
  22.      form = new Form("image for splash");
  23.         try {
  24.             image = Image.createImage("FB.png");
  25.         } catch (IOException ex) {
  26.             ex.printStackTrace();
  27.         }
  28.      imageitem = new ImageItem(null, image, 
  29.              ImageItem.LAYOUT_LEFT , "My Image");
  30.      form.append(imageitem);
  31.      }
  32.     public void startApp() {
  33.     Timer obj = new Timer();
  34.     TimerTest obj1= new TimerTest();
  35.     obj.schedule(obj1,1000);
  36.     dis.setCurrent(form);
  37.     }
  38.  
  39.  
  40.     public void pauseApp() {
  41.     }
  42.  
  43.     public void destroyApp(boolean unconditional) {
  44.     }
  45.  
  46.     public void exitMidlet()
  47.     {
  48.         destroyApp(true);
  49.         notifyDestroyed();
  50.  
  51.    }
  52.  
  53. class TimerTest extends TimerTask
  54. {
  55.     public void run()
  56.     {
  57.         dis.setCurrent(canvas);
  58.     }
  59. }
  60.  
  61. }
  62.  
  63.  
  64.  
  65. import java.io.IOException;
  66. import javax.microedition.lcdui.*;
  67.  
  68.  
  69. /*
  70.  * To change this template, choose Tools | Templates
  71.  * and open the template in the editor.
  72.  */
  73.  
  74. /**
  75.  *
  76.  * @author Balram
  77.  */
  78. public class fb_login extends Canvas implements CommandListener{
  79.           fb_Midlet fb_midlet;
  80.           Command exit;
  81.           Image image;
  82.           Image TmpImp;
  83.  
  84.  
  85.         public fb_login(fb_Midlet fb_midlet)
  86.         {
  87.             exit = new Command("exit",Command.EXIT,1);
  88.             this.fb_midlet= fb_midlet;
  89.  
  90.         try {
  91.             image = Image.createImage("images.jpg");
  92.         } catch (IOException ex) {
  93.             ex.printStackTrace();
  94.         }
  95.  
  96.  
  97.             addCommand(exit);
  98.             setCommandListener(this);
  99.         }
  100.  
  101.     protected void paint(Graphics g) {
  102.  
  103.  
  104.        if(image != null)
  105.        {
  106.  
  107.            g.drawImage(image, 0, 0,Graphics.VCENTER);
  108.        }
  109.  
  110.     }
  111.  
  112.     public void commandAction(Command c, Displayable d) {
  113.         if(c==exit)
  114.         {
  115.             fb_midlet.exitMidlet();
  116.         }
  117.  
  118.     }
  119.  
  120. }


Thanks:
Balram Singh
+919453037228
Jul 11 '11 #1
0 1433

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Stijn Goris | last post by:
hi all, A user can upload maximum 10 image files at once. When the user only uploads 6 images, 4 fileboxes are left blank. I use function checkImage() //check the the extension. Must be a jpeg...
1
by: Shufen | last post by:
Hi all, I have a form where users can use it to upload images into a file and save it into a directory. I have installed PIL and Image module and do a fair bit of reading on these module. But...
2
by: Paul Gorman | last post by:
I am using the control type = file to perform a file upload. When I click on the browse button to go select the image I want to upload it places in the text box a local path (C:\images\image.jpg...
1
by: JP | last post by:
Hi; What I would like to do is, let the user browse to an image and when they click the submit button it needs to insert all the information on the page including the image to the SQL server. Now...
3
by: mra | last post by:
Hi I Need Help For Uploading And Down Loading Files Using Internet Tansfer Control. When Assign The Name Of File In A Variable, It Does Not Execute The State Change Event. When I Give The File Name...
2
by: prakharv | last post by:
Hi All, Below is the code which I am using to upload a jpeg file to the server. But the problem I am facing is that it is not copying the entire contents of the image file to the webserver and it...
4
by: muthu | last post by:
Hi, User will upload only picture and pdf files. I have return a asp.net application for that,But thing is I need to restrict the user uploading corrupted or damaged files. Can anyone have any...
1
by: finalyearproject | last post by:
hello. i m a final year B.E. Comupter Engineering mumbai university sutdent . i am doing my final year project on "PROCESSING BAR CODES MOBILE PHONES".... Since the project is to be developed on...
5
by: hsegoy1979 | last post by:
Dear All I have to create an application to do virus check before uploading an image. Any Help Yogesh
0
karthik baskar
by: karthik baskar | last post by:
Hello, I'm able to set a background color for a form using Canvas Class. But how to create a String item or button over the background and how to set background image for a form ?
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.