cancel
Showing results for 
Search instead for 
Did you mean: 

Popups not centered when adding ReportViewerBean to JDialog

Former Member
0 Kudos

This issue follows on from

When running ReportViewerBean from a JDialog, the Export dialog and other popups locate top-left on the screen instead of being centered over the Panel. The code listing below illustrates a standalone JDialog but the requirement is for the JDialog (which contains the RVB) to be owned by a JFrame.

When a JFrame is used to contain the RVB instead of the dialog, it works as expected - all popup dialogs center.


      ReportViewerBean b = new ReportViewerBean();
      // ... bean config code
      JDialog d = new JDialog();
      //JFrame f = new JFrame(); // works
      d.setTitle("JRC Test");
      d.addWindowListener(new WindowAdapter() {
        @Override
        public void windowClosing(WindowEvent e) {
          System.exit(0);
        }
      });
      d.add(b, BorderLayout.CENTER);
      d.setSize(new Dimension(800, 500));
      d.setLocationRelativeTo(null);
      b.init();
      b.start();
      d.setVisible(true);

Accepted Solutions (1)

Accepted Solutions (1)

ted_ueda
Employee
Employee
0 Kudos

ReportViewerBean looks for a parent instance of java.awt.Frame to do positioning.

Sincerely,

Ted Ueda

Answers (0)