Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4194862

Dialogs of internal frames centered on parent JDesktopPane vs. the JIntlFrames

XMLWordPrintable

    • beta
    • generic
    • generic



      Name: krT82822 Date: 12/03/98


      JOptionPane.showInternal...Dialog() dialogs appear in the center of the desktop pane rather than above the center of the internal frame
      they are associated with. In addition, when these dialogs are closed, the layering of the windows appears quite random--I would expect that
      when I dismiss a dialog associated with an internal frame, that frame is moved to the front.


      import javax.swing.*;
      import java.awt.*;
      import java.awt.event.*;

      public class CenteredDlg extends JFrame
      {
              JDesktopPane desktop;
              JInternalFrame textFrame;

              public CenteredDlg()
              {
                      Dimension screenSize = getToolkit().getScreenSize();
                      setBounds (screenSize.width / 4, screenSize.height / 4,
                                                               screenSize.width / 2, screenSize.height / 2);
                      addWindowListener (new WindowAdapter() {
                              public void windowClosing (WindowEvent event)
                              {
                                      System.exit(0);
                              }
                      });

                      desktop = new JDesktopPane();
                      desktop.setOpaque(false);
                      setContentPane(desktop);
                      desktop.setLayout(null);

                      textFrame = new JInternalFrame ("Test", true, true, true, true);
                      desktop.add (textFrame);
                      textFrame.setSize(150, 100);
                      textFrame.setLocation(20, 20);
                      textFrame.setVisible(true);
              }

              public void postDialog() {
                      JOptionPane.showInternalConfirmDialog(textFrame, "Blah dee blah dee BLAH!");
              }

              static public void main(String args[])
              {
                      CenteredDlg mainFrame = new CenteredDlg();
                      mainFrame.show();
                      mainFrame.postDialog();
              }
      }

      (Review ID: 40911)
      ======================================================================

            hgajewsksunw Hania Gajewska (Inactive)
            kryansunw Kevin Ryan (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: