384 |
} |
} |
385 |
|
|
386 |
/** |
/** |
387 |
* This method creates a new JInternalFrame that is in the JDesktopPane |
* This method creates a new JInternalFrame that is in the JLayeredPane |
388 |
* which contains the parentComponent given. If no suitable JDesktopPane |
* which contains the parentComponent given. If no suitable JLayeredPane |
389 |
* can be found from the parentComponent given, a RuntimeException will be |
* can be found from the parentComponent given, a RuntimeException will be |
390 |
* thrown. |
* thrown. |
391 |
* |
* |
395 |
* @return A new JInternalFrame based on the JOptionPane configuration. |
* @return A new JInternalFrame based on the JOptionPane configuration. |
396 |
* |
* |
397 |
* @throws RuntimeException If no suitable JDesktopPane is found. |
* @throws RuntimeException If no suitable JDesktopPane is found. |
398 |
|
* |
399 |
|
* @specnote The specification says that the internal frame is placed |
400 |
|
* in the nearest <code>JDesktopPane</code> that is found in |
401 |
|
* <code>parent</code>'s ancestors. The behaviour of the JDK |
402 |
|
* is that it actually looks up the nearest |
403 |
|
* <code>JLayeredPane</code> in <code>parent</code>'s ancestors. |
404 |
|
* So do we. |
405 |
*/ |
*/ |
406 |
public JInternalFrame createInternalFrame(Component parentComponent, |
public JInternalFrame createInternalFrame(Component parentComponent, |
407 |
String title) |
String title) |
408 |
throws RuntimeException |
throws RuntimeException |
409 |
{ |
{ |
410 |
JDesktopPane toUse = getDesktopPaneForComponent(parentComponent); |
JLayeredPane toUse = JLayeredPane.getLayeredPaneAbove(parentComponent); |
411 |
if (toUse == null) |
if (toUse == null) |
412 |
throw new RuntimeException("parentComponent does not have a valid parent"); |
throw new RuntimeException |
413 |
|
("parentComponent does not have a valid parent"); |
414 |
|
|
415 |
JInternalFrame frame = new JInternalFrame(title); |
JInternalFrame frame = new JInternalFrame(title); |
416 |
|
|
419 |
|
|
420 |
frame.setClosable(true); |
frame.setClosable(true); |
421 |
toUse.add(frame); |
toUse.add(frame); |
|
|
|
422 |
// FIXME: JLayeredPane broken? See bug # 16576 |
// FIXME: JLayeredPane broken? See bug # 16576 |
423 |
// frame.setLayer(JLayeredPane.MODAL_LAYER); |
frame.setLayer(JLayeredPane.MODAL_LAYER); |
424 |
return frame; |
return frame; |
425 |
} |
} |
426 |
|
|