Link to home
Start Free TrialLog in
Avatar of Samooramad
Samooramad

asked on

help

hi experts..
I want to select a menuItem that say "About" and get a small frame or dialog box that will have a couple lines of information like copyright and name of program. Do I just do that with a fram or what?
Avatar of zzynx
zzynx
Flag of Belgium image

I'd use a modal JDialog and add in it's root pane a panel containing whatever info you want.
ASKER CERTIFIED SOLUTION
Avatar of zzynx
zzynx
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Remark: I used a button to trigger instead of a menu, but that's irrelevant for your question, isn't it?
Avatar of Samooramad
Samooramad

ASKER

well I guess :)
ok I'll get back to you
yeah worked great..I'll award points now but could you tell me what this and true do in:
    JDialog dlg = new JDialog(this, true);

thanks
also what does setModal do?
one more :)
where exactly does   dlg.setLocationRelativeTo(this); place the dialog box?
>> JDialog dlg = new JDialog(this, true);
-this passes the main JFrame (the instance of JOptionPaneDemo2) as the owner of the dialog.
-true means: modal

>>also what does setModal do?
Where do you see that in the code?

>>where exactly does   dlg.setLocationRelativeTo(this); place the dialog box?
In the middle of "this" being "the instance of JOptionPaneDemo2", your main frame


>>where exactly does   dlg.setLocationRelativeTo(this); place the dialog box?
If you like to have it *always* in the middle of the screen (no matter where your frame is) then pass null as parameter:

       dlg.setLocationRelativeTo(null);
>>Where do you see that in the code?
not in your code ..I saw it somewhere else and thought I'd ask
setModal() specifies whether this dialog should be ... modal  (surprise !!! :°)