Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1058999
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T18:06:28+00:00 2026-05-16T18:06:28+00:00

I have designed a component for J2Me, and here is the paint method: import

  • 0

I have designed a component for J2Me, and here is the paint method:

import javax.microedition.lcdui.Graphics;  
import javax.microedition.lcdui.Image;  
class Component {
...
public void paint(Graphics g) {
    if (background != null)
        g.drawImage(image, bounds.getLocation().x, bounds.getLocation().y, 0);
}
...
}

I want to paint this component on a J2Se application, I tried to paint the component onto a J2Me Image and extracted the int[] into an InputStream, and create a new image on the J2Se platform, with this object:

public class ComponentStreamer {
    private Component component;
    private Image j2Me_Image;

    public void setComponent(Component component) {
        this.component = component;
    }

    public InputStream getInputStream() throws IOException {
        if(component==null)
            return null;
        //THIS LINE THROWS THE EXCEPTION
        j2Me_Image=Image.createImage(component.getSize().width, component.getSize().height); 
        component.paint(j2Me_Image.getGraphics());
            return getImageInputStream(j2Me_Image);
    }
}

I’ve tried the Object, but the commented line throws an exception:

Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: javax.microedition.lcdui.ImmutableImage.decodeImage([BII)V
    at javax.microedition.lcdui.ImmutableImage.decodeImage(Native Method)
    at javax.microedition.lcdui.ImmutableImage.getImageFromStream(Image.java:999)
    at javax.microedition.lcdui.ImmutableImage.<init>(Image.java:955)
    at javax.microedition.lcdui.Image.createImage(Image.java:554)

How can over come this error?

Thanks,
Adam.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T18:06:28+00:00Added an answer on May 16, 2026 at 6:06 pm

    Well,

    That was a very long process of diving into the sources of the J2Me MIDP and CLDC, and the use of a package called Microemulator, here is some code to get anyone else started:

    this starts an emulator, which then enables some of the J2Me features.

        private void setUpEmulator() {
        try {
            // overrideJ2MeImagePackageLock();
            Headless app = new Headless();
            DeviceEntry defaultDevice = new DeviceEntry("Default device", null, DeviceImpl.DEFAULT_LOCATION, true, false);
            Field field = app.getClass().getDeclaredField("emulator");
            field.setAccessible(true);
            Common emulator = (Common) field.get(app);
            emulator.initParams(new ArrayList<String>(), defaultDevice, J2SEDevice.class);
        } catch (Exception e) {
            e.printStackTrace();
            System.out.println("Un-handled Exception");
        }
    }
    

    Next we have few other nice objects to work with:

        public class J2MeImageLayer extends ScalableLayer {
        private static final long serialVersionUID = -4606125807092612043L;
    
        public J2MeImageLayer() {
            componentViewer.super();
        }
        @Override
        public void repaint() {
            J2SEMutableImage mutableImage = new J2SEMutableImage(page.getSize().width, page.getSize().height);
            page.paint(mutableImage.getGraphics());
            Graphics g = getImage().getGraphics();
            g.drawImage(mutableImage.getImage(), 0, 0, DCP_Simulator.this);
        }
        public void addComponent(Component component) {
            page.add(component);
        }
        public void setComponent(final Component component) {
            page.removeAllElements();
            final Container componentParent;
            if ((componentParent = component.getParent()) != null)
                component.setRemovedAction(new interfaces.Action() {
                    @Override
                    public void action() {
                        componentParent.add(component);
                    }
                });
            page.add(component);
        }
    }
    

    and this is the highlight on how to do that.

    Adam.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have the following shared component: public class OurServiceBase : System.ServiceProcess.ServiceBase This class has
I have a control that is created like so: public partial class MYControl :
I have created a non-visual component in C# which is designed as a placeholder
I have inserted a list in my j2ME project,designed using LWUIT. The code is
I am new to component development. I have designed a file manager using jQuery
Yesterday, i have installed the TPing component which are designed for Delphi 7 in
i've designed a custom class (or component?) that extends Sprite whose constructor has 15
Here is how the application is designed - I have a COM server raising
I have designed a site and my CSS is not loading in FF and
I have designed a menu that consists of a few buttons in several different

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.