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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T10:01:02+00:00 2026-06-05T10:01:02+00:00

i have created a static instance of a generic dialog in my program static

  • 0

i have created a static instance of a generic dialog in my program

static GenericDialog SaveDialog = null;

and below is the code to display the dialog

public boolean DispSaveDialog()
{
    //gd.addStringField("Identity : ", "annot");
    if(SaveDialog == null)
    {
        SaveDialog =  new GenericDialog("Save");
        Panel idnPanel = new Panel();
        idnPanel.add(new Label("Identity"));
        idnTextComp = new TextField("annot");
        csPrefix = idnTextComp.getText();
        TextListener tl = new TextListener() {

            @Override
            public void textValueChanged(TextEvent e) {
                // TODO Auto-generated method stub
                csPrefix = idnTextComp.getText();
            }
        };
        idnTextComp.addTextListener(tl);
        idnPanel.add(idnTextComp);
        SaveDialog.addPanel(idnPanel);
        final TextComponent textComponent = new TextField();
        ActionListener al = new ActionListener() {

            @Override
            public void actionPerformed(ActionEvent e) {
                // TODO Auto-generated method stub
                String label = e.getActionCommand();                
                //csPrefix = gd.getNextString();
                if (label=="Browse")
                {                   
                    String csFilename = imp.getTitle();                 
                    csTextFileName = FileNameProcess( csFilename );     
                }   
                textComponent.setText(csTextFileName);
            }
        };
        Button btBrowse = new Button("Browse");
        btBrowse.addActionListener(al);     
        Panel panel = new Panel();

        panel.add(new Label("Folder : "));
        //textComponent.setBounds(gd.getBounds());
        panel.add(textComponent);
        panel.add( btBrowse );  
        SaveDialog.addPanel(panel);         
    }   
    SaveDialog.showDialog();
    return true;
}

the issue i am facing is, when i open the dialog the second time, the OK and Cancel events are not triggered.
i have a feeling that the issue is silly, sorry and thanks in advance.

  • 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-05T10:01:03+00:00Added an answer on June 5, 2026 at 10:01 am

    The above code was so that when the generic dialog was displayed the second time the old values would be retained..
    i did a workaround for the same where i save the strings entered the first time in static string variables and load them after checking for null values.

    this is not the solution, just a workaround so i could close the issue on time. 🙁

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

Sidebar

Related Questions

I have created a public static class utils.cs I want to use it in
I have created my own Attached Property like this: public static class LabelExtension {
I have a generic factory which caches an instance before return it (simplified code):
I have created a static library following this link . But I am facing
I have created a page with a static image positioned to the ride side
I've created a website with ASP.NET MVC. I have a number of static pages
I have created a generic method that enables clients to specify both the concrete
I have built a little static object for saving generic types to Isolated Storage
I have the following generic question Here is a my generic message interface. public
I wrote a sample example , When I created a delegate instance like below

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.