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

  • Home
  • SEARCH
  • 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 6970523
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T16:43:13+00:00 2026-05-27T16:43:13+00:00

I created a class from Dialog which contains a TextArea : public class Alert

  • 0

I created a class from Dialog which contains a TextArea :

public class Alert extends Dialog {
    private Container c = new Container(new BorderLayout());
    private Label titre = new Label("Mobile Banking");
    private TextArea chp;
    private Command[] comms;
    public Alert(String text, Command[] comms)
    {
        super();
        titre.setUIID("titre_alert");
        titre.setAlignment(Label.CENTER);
        this.comms = comms;
        setAutoDispose(true);
        for (int cmd=0; cmd<comms.length; cmd++)
            addCommand(comms[cmd]);
        chp = new TextArea();
        chp.setEditable(false);
        chp.setAlignment(Label.CENTER);
        chp.getSelectedStyle().setBorder(null);
        chp.getUnselectedStyle().setBorder(null);
        chp.getSelectedStyle().setBgColor(this.getStyle().getBgColor());
        chp.getUnselectedStyle().setBgColor(this.getStyle().getBgColor());
        if (text.length() % 2 != 0)
            text = " ".concat(text);
        while (text.substring(0, (text.length()/2)+1).length() < chp.getMaxSize()/2)
        {
            text = " ".concat(text);
        }
        chp.setText(text);
        c.addComponent(BorderLayout.NORTH, titre);
        c.addComponent(BorderLayout.CENTER, chp);
    }
    public Command affiche()
    {
        return show(null, c, comms);
    }
}

Inside a Form I start a thread which makes a HttpConnection call and other tasks. If the tasks end successfully then I call the affiche() method of the above class Alert :

alert = new Alert("Chargement effectué avec succès !", new Command[]{ok});
cntnr.removeComponent(cPatienter); // container displaying the "please wait..."
repaint(); // repainting the Form
if (alert.affiche() == ok) // showing the confirmation of successfullness of the task
{
     alert.dispose();
     controller.displayScreen("Menuprincipale");
}

The problem is that , sometimes , the text shown when calling the affiche() method is duplicated : it should show only the text Chargement effectué avec succès ! but sometimes it shows the text and also Chargement effectué.

So how to make it that only the text parameter is only shown but not duplicated ?

  • 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-27T16:43:14+00:00Added an answer on May 27, 2026 at 4:43 pm

    You are invoking LWUIT on a separate thread which is illegal. You need to use Display.callSerially to avoid a race condition in the text layout code. Something like this:

    Display.getInstance().callSerially(new Runnable() {
       public void run() {
           // your LWUIT code here, no need for repaints 
       }
    });
    

    A better approach is to use LWUIT4IO for your networking since it does this seamlessly for you.

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

Sidebar

Related Questions

I created a java class which extends CustomItem : package view; import com.sun.lwuit.Dialog; import
Say I've got a domain model created from C# classes like this: public class
I created a new Telerik reporting class library (single report for now) which builds
How a user exception class is created from standard exception? Addressing below cases Say
Let's say I have created two objects from class foo and now want to
I have a collection of classes that inherit from an abstract class I created.
I want to create a Class, say MyDiv , which inherits from the original
I would like to create a customized popup dialog which contains a spinner. The
CustomDialogExample.java public class CustomDialogExample extends Activity { /** Called when the activity is first
What are the Resharper 4 shortcuts to Create a class from usage? e.g. I

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.