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

Nested JOptionPane.showInternalXxx return default value immediately

XMLWordPrintable

    • x86
    • linux

      FULL PRODUCT VERSION :
      java version "1.6.0_22"
      Java(TM) SE Runtime Environment (build 1.6.0_22-b04)
      Java HotSpot(TM) Server VM (build 17.1-b03, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Linux ubuntu 2.6.35-23-generic-pae

      A DESCRIPTION OF THE PROBLEM :
      Nested JOptionPane.showInternalXxx return default value immediately.

      While another modal internal frame exists, JOptionPane.showInternalXxx does NOT wait the selected value.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      parent confirm start
      child confirm start
      ----- Expected is waiting until user input
      child confirm end
      parent confirm end

      ACTUAL -
      parent confirm start
      child confirm start
      child confirm end -1
      ---- child confirm does not wait and return -1 immediately
      parent confirm end

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------

      public class Test {
      public static void main(String[] args) {
      final JDesktopPane desktop = new JDesktopPane();
      JButton button = new JButton(
      new AbstractAction("do parent confirm") {
      public void actionPerformed(ActionEvent e) {
      System.out.println("parent confirm start");
      int parentRC = JOptionPane.showInternalConfirmDialog(
      desktop,
      new Object[] {
      "this is parent confirm",
      new JButton(
      new AbstractAction("do child confirm") {
      public void actionPerformed(ActionEvent e) {
      System.out.println("child confirm start");
      int childRC = JOptionPane.showInternalConfirmDialog(
      desktop,
      "this is child confirm"
      );
      System.out.println("child confirm end " + childRC);
      }
      }
      )
      }
      );
      System.out.println("parent confirm end " + parentRC);
      }
      }
      );
      button.setBounds(10, 10, 200, 20);
      desktop.add(button);
      desktop.setSize(400, 300);
      desktop.setPreferredSize(desktop.getSize());
      final JFrame frame = new JFrame("test frame");
      frame.setContentPane(desktop);
      frame.pack();
      frame.setDefaultCloseOperation(JInternalFrame.EXIT_ON_CLOSE);
      frame.setVisible(true);
      }
      }
      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      do not return when (nativeContainer.modalComp != null) at Container#startLWModal
      or
      make sure to wait the value after startLWModal call backed at JOptionPane#showInternalInputDialog

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Imported:
              Indexed: