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 6063347
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T09:09:20+00:00 2026-05-23T09:09:20+00:00

I created a java class which extends CustomItem : package view; import com.sun.lwuit.Dialog; import

  • 0

I created a java class which extends CustomItem :

package view;

import com.sun.lwuit.Dialog;
import javax.microedition.lcdui.CustomItem;
import javax.microedition.lcdui.Graphics;
import javax.microedition.lcdui.Image;

public class Thumb extends CustomItem {
    private Image theImage;
    public Thumb(Image photo)
    {
        super("");
        theImage = photo;
    }
    private Image createThumbnail(Image image) {
        int sourceWidth = image.getWidth();
        int sourceHeight = image.getHeight();
        int thumbWidth = 64;
        int thumbHeight = -1;

        if (thumbHeight == -1) {
            thumbHeight = thumbWidth * sourceHeight / sourceWidth;
        }

        Image thumb = Image.createImage(thumbWidth, thumbHeight);
        Graphics g = thumb.getGraphics();

        for (int y = 0; y < thumbHeight; y++) {
            for (int x = 0; x < thumbWidth; x++) {
                g.setClip(x, y, 1, 1);
                int dx = x * sourceWidth / thumbWidth;
                int dy = y * sourceHeight / thumbHeight;
                g.drawImage(image, x - dx, y - dy, Graphics.LEFT | Graphics.TOP);
            }
        }
        Image immutableThumb = Image.createImage(thumb);
        return immutableThumb;
    }
    protected int getMinContentHeight() {
        return 64 * theImage.getHeight() / theImage.getWidth();
    }

    protected int getMinContentWidth() {
        return 64;
    }

    protected int getPrefContentHeight(int width) {
        return 64 * theImage.getHeight() / theImage.getWidth();
    }

    protected int getPrefContentWidth(int height) {
        return 64;
    }

    protected void paint(Graphics g, int w, int h) {
        Image transformImage = createThumbnail(theImage);
        g.drawImage(transformImage, 0, 0, Graphics.TOP|Graphics.LEFT);
    }
    protected void pointerPressed(int x, int y)
    {
        Dialog.show("Info", "I clicked the screen !", "ok", null);
    }
}

And in a Form I append some items created from this CustomItem :

fcDir = (FileConnection) Connector.open("file:///"+pRoot+photoDirectory+"/");
            if (fcDir.exists()) {
                filelist = fcDir.list("*", false);
                while (filelist.hasMoreElements()) {
                    fileName = (String) filelist.nextElement();
                    vPhotoNames.addElement(new String(fileName));
                    FileConnection fcFile = (FileConnection) Connector.open("file:///"+pRoot+photoDirectory+"/"+fileName);
                    // creation customitem
                    this.append(new Thumb(Image.createImage(fcFile.openInputStream())));
                    fcFile.close();
                }
            }
            fcDir.close();

When I launch the application , then :
1) the cursor cannot be moved by means of the arrow keys ( the device is Alcatel OT-806D ) , nor by means of touching the screen.
2) when I try to click on an image then nothing happens , although the Dialog should appear !

So why do these problems arise ?

  • 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-23T09:09:20+00:00Added an answer on May 23, 2026 at 9:09 am

    You are trying to show a LWUIT dialog from a MIDP CustomItem, that is not officially supported and is bound to fail in many creative ways. You need to either use LWUIT or use LCDUI at any given moment.

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

Sidebar

Related Questions

I have created a class called SimpleCanvas which extends the JPanel class, and I
This is my .java file in src: package com.wao.texttime; import android.app.Activity; import android.os.Bundle; import
In Java Swing I have created a JTable which uses a table model class
I've created a Java class that connects to an IIS website requiring NTLM authentication.
I have developed a Java Swing application, which uses the SwingWorker class to perform
I have created customized combobox which extends JCombobox. It is having checkboxes in popup
I'm using a child class which extends from main to setup some buttons. I
CustomDialogExample.java public class CustomDialogExample extends Activity { /** Called when the activity is first
Here I create a class in JAVA in which I have function (callback) which
I can not access public method of my class MyPanel which extends JPanel .

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.