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?
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?
I'd use a modal JDialog and add in it's root pane a panel containing whatever info you want.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Remark: I used a button to trigger instead of a menu, but that's irrelevant for your question, isn't it?
ASKER
well I guess :)
ok I'll get back to you
ok I'll get back to you
ASKER
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
JDialog dlg = new JDialog(this, true);
thanks
ASKER
also what does setModal do?
ASKER
one more :)
where exactly does dlg.setLocationRelativeTo( this); place the dialog box?
where exactly does dlg.setLocationRelativeTo(
>> 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
-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(
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);
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(
ASKER
>>Where do you see that in the code?
not in your code ..I saw it somewhere else and thought I'd ask
not in your code ..I saw it somewhere else and thought I'd ask
setModal() specifies whether this dialog should be ... modal (surprise !!! :°)