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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:08:03+00:00 2026-06-05T20:08:03+00:00

I am making an application using LWUIT. There is a form There is a

  • 0

I am making an application using LWUIT.

  1. There is a form

  2. There is a list embedded on the form.

  3. The list has 5 elements.

  4. Initially, when I first load the app, if I choose the 1st element, 2nd gets chosen; when I choose the second the 3rd gets chose and and so on (Weird!)

  5. I am not able to click any button on the screen either

  6. next what I do is, shift to a different from using arrow keys (of the keyboard… I am running the app on a simulator btw)

  7. Then I come back to the first form and now everything works as expected(no weird behaviour).

  8. What could be the issue?

  9. I am using Sun Java Micro Edition SDK 3.0 (default touch screen for testing)

My code is:

List dummy = new List();
        dummy.addItem("wewerwer");
        dummy.addItem("wewerdswer");
        dummy.addItem("wewqweerwer");
        dummy.addItem("dscxwewerwer");
        dummy.addItem("jhgwewerwer");
        mainListForm.setLayout(new BorderLayout());
        mainListForm.addComponent(BorderLayout.CENTER,dummy);
   mainListForm.show();

What could possible be going wrong here?

UPDATE 1

I think there is a bug here. I have attached the complete code below along with the screen shot

import javax.microedition.midlet.*;

import com.sun.lwuit.*;
import com.sun.lwuit.events.*;
import com.sun.lwuit.plaf.UIManager;
import com.sun.lwuit.util.Resources;

public class Demo extends MIDlet implements ActionListener {

  private Form mForm;
List abc;
  public void startApp() {

      Display.init(this);

      try {
Resources r = Resources.open("/Test.res");
UIManager.getInstance().setThemeProps(r.getTheme(
r.getThemeResourceNames()[0])
);
} catch (Exception e){
System.out.println(e.toString());
}

    if (mForm == null) {
      Button click = new Button("Press me!");

      click.addActionListener(new ActionListener() {

                public void actionPerformed(ActionEvent ae) {
                   System.out.println("I have been pressed");
                }
            });
       abc = new List();
      abc.addItem("Str1");
      abc.addItem("Str2");
      abc.addItem("Str3");
      abc.addItem("Str4");
      abc.addItem("Str5");
      abc.addItem("Str6");



      Form f = new Form("Hello, LWUIT!");
      abc.addActionListener(this);
       f.addComponent(abc);
      Command exitCommand = new Command("Exit");
      f.addCommand(exitCommand);
      f.addCommandListener(this);
      f.addComponent(click);
      f.show();
    }
  }

  public void pauseApp() {
  }

  public void destroyApp(boolean unconditional) {
  }

  public void actionPerformed(ActionEvent ae) {
      System.out.println(abc.getSelectedIndex());

  }
}

enter image description here

So now when I click on ‘Str1’ of the list Str2 gets selected and so on.

IDE: Netbeans
Emulator: Default Touch screen phone

  • 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-06-05T20:08:04+00:00Added an answer on June 5, 2026 at 8:08 pm

    OK….so this is how you resolve it.

    After the form is displayed remove the list from the form and again add it to the form and then repaint the form.

    Earlier Code

    1) form.addComponenet(BorderLayout.center,list);
    2) form.show();

    Word Around for the problem

    1)form.addComponenet(BorderLayout.center,list);
    2)form.show();
    3)form.setScrollable(false);

    I know its kind of strange, but this way the list index selection works smooth for touch screen phones.

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

Sidebar

Related Questions

I am making an application using jQuery. In my app, the user enters some
I'm making a web application using PHP in where I have a form that
I am making an application using MVC 3.0 Razor and Code First Entity Framework.
I am making a web application using google app engine. I was not using
I am making a RIA application using Silverlight and web services. The method of
I'm making an android application using phonegap. I'm using phonegap's Storage api for querying
Using J2SE, I tried making a LAN application using java.net.*, and it worked perfectly.
I am making a test fullscreen application using this guide . However, I am
I'm using C# and I'm making an application where a lot of UI loading
Lately I've been making a new application and I'm using a ton of forms.

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.