473,472 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

uploading immutable image in a canvas from files in j2me

1 New Member
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 1440

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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.