• Post Reply Bookmark Topic Watch Topic
  • New Topic

popup design help  RSS feed

 
KunkalaGuntala Samba Siva Rao
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have around 10 popup screens and it has to work on click of a button
button1_click()
{
new PopupScreen1(ID)
}
class PopupScreen1 extends JDialog
{
private String ID;
public PopuPScreen1(Sting ID)
{
this.ID = ID;
try {
createComponents()
}
catch (Exception e)
{
e.printStackTrace();
}
}
public createComponents() {
//creats the swing components
setValues();
}
public void setValues()
{
//calls db procedure and sets values
}
}

as you see i need the dialog popup screen to popup only when the user clicks the button.
and each time it creates a new object
the question is
1. how to handle this to reduce memory problems.
2. sometimes the user may not click, so no need to instantiate
3. when user clicks the button for first time i want to create the object
4. for the second time, i want to just use the old object
5. how does the memory allocation work in this case for multiusers, will each user be allocated memory in the his PC on click or its all in server.
i am confused..please help.
 
Stephen Huey
Ranch Hand
Posts: 618
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suggest you search in the HTML and Javascript forum farther down on the Javaranch forums page, and if you don't find the answer to your question, then post in there. Javascript does not really belong in the Java forum.
 
Ernest Friedman-Hill
author and iconoclast
Sheriff
Posts: 24217
38
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Javascript does not really belong in the Java forum.

You're right, it doesn't. I have no idea why you're pointing this out here, though, as this seems to be a question about a Swing app.
As far as create-on-button-press, based on your requirements, you want to have a member variable, someplace, for each screen, to hold an instance of that dialog. What each actionPerformed() method should do is to check the member for the appropriate dialog, and if it's null, instantiate the object; then show the dialog held in that variable, whether it previously existed or not.
Now, the last part about multiple users confuses me. a Swing app is inherently a single-user app; it runs on the user's desktop, and if there is a server component, it has nothing to do with the GUI. Perhaps you're having some problems with basic application architecture understanding?
 
KunkalaGuntala Samba Siva Rao
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you, that helps..
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!