Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is it possible to popup a dialog from Applet?

 
Qunfeng Wang
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It may be a wizard dialog. I'm afraid when the dialog pops up, I can't get data from the applet anymore, even I still hold the reference.
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure, applets can open dialogs or frames. Why do you think you can't get data from the applet if you open one?
 
Qunfeng Wang
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes. But how to set the dialog's parent? According to JDialog's API, only Frame or Window can be its parent. In fact, the dialog is poped up from a JInternalFrame in the Applet. I can't find any containters in my applet to be dialog's parent.

If a dialog doesn't have a parent, it's not friendly to the user in some way. JOptionPane can let a general container(JPanel, JInternalFrame, etc) be its parent. But the dialog is restricted to MessageDialog, OptionDialog etc. I can't add my customized dialog into it.

Since 1.6, a new method JOptionPane.createDialog() seems to return a clean dialog which I can add my components into. I'm not sure.

:roll: It seems a Swing question.
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
But how to set the dialog's parent?

Why do you need a parent? What's wrong with the no-argument constructor?

If a dialog doesn't have a parent, it's not friendly to the user in some way.

I don't understand what this means. How is it not user-friendly? Why would the user care about this?
 
Qunfeng Wang
Ranch Hand
Posts: 434
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for you reply.

1 The dialog's position is relatively to its parent. Although I can use some Utiliy method to do this, but it's more natural if it has a parent.

2 If a dialog has no parent it will disappear when user cliking anohter window or application. In MS Windows, you need to use Alt + Tab to popup the dialog out. That's the non-user-friendly I said.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic