Forums Register Login
popup design help
i have around 10 popup screens and it has to work on click of a button
new PopupScreen1(ID)
class PopupScreen1 extends JDialog
private String ID;
public PopuPScreen1(Sting ID)
this.ID = ID;
try {
catch (Exception e)
public createComponents() {
//creats the swing components
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.
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.

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?
thank you, that helps..

This thread has been viewed 420 times.

All times above are in ranch (not your local) time.
The current ranch time is
Oct 19, 2018 02:02:41.