Peter,
Below you'll find the code responsable for setting foucs back to child,
if there's one... If I only could 'freeze' the parent frame:
- No events possible (e.g. no clicking on buttons is possible)
- No move of frame is allowed
- ...
// First set listener in frame
// PropertyChangeListener for setting focus when frame is selected
addPropertyChangeListener(new PropertyChangeAdapter());
/** Sets the focus to the focus field when an internalframe
* gets selected.
*/
class PropertyChangeAdapter implements PropertyChangeListener {
public void propertyChange(PropertyChangeEvent evt) {
if (evt.getPropertyName().equals("selected")){
try {
// new value is true
Boolean bvalue=(Boolean)evt.getNewValue();
// selected
==> // if frame has a child open give focus back to child!
==> if (bvalue.booleanValue()) {
// get reference to child frame if it exists
==> InternalFrame child = Pool.getWindow(getChildId());
==> if (child != null) {
==> try {
==> child.setSelected(true);
// designated component in child will get focus, if
defined
==> child.getTheFocus();
}
catch(Exception e1) {
Debug.printError(e1,"Error selecting a internal frame");
}
}
else {
if (! bDisposing) {
Debug.println("Setting frame focus... " + " Id=" +
getId());
// Set Default Enter Button
try {
JButton defaultBut =
m_fp.getButtonPanel().getOKButton();
if (defaultBut != null)
getRootPane().setDefaultButton(defaultBut);
}
catch(java.lang.NullPointerException npe) {
}
getTheFocus();
}
}
}
}
catch(java.lang.ClassCastException cce) {
// new value is false which generates error
Debug.println("Loosing frame focus..."+ " Id=" + getId());
}
}
// Debug.println("PropertyChange() End");
}
}
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]
Sent: vrijdag 23 februari 2001 10:47
To: [EMAIL PROTECTED]
Subject: Re: JInternalFRame
<<Does anybody know how to make a JInternalFrame modal?
<<At this moment I'm using the following technique:
<<If the parent frame gets selected(and focus) it automatically transfers
<<control to the child frame
<<Is there a better way?
I have been wanting to do the same and have come to the conclusion, that it
can not be done with a jinternal frame.
Yours solution sounds like something i could use as well. I would be very
happy if you would send me a sample of your code
TIA
Regards
Peter Tilsted
Denmark
_______________________________________________
Advanced-swing mailing list
[EMAIL PROTECTED]
http://eos.dk/mailman/listinfo/advanced-swing