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

[macosx] Dialogs do not receive focus

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 7
    • Fix Version/s: None
    • Component/s: client-libs
    • Labels:
    • Subcomponent:
    • CPU:
      x86
    • OS:
      os_x

      Description

      FULL PRODUCT VERSION :
      java version "1.7.0_08-ea"
      Java(TM) SE Runtime Environment (build 1.7.0_08-ea-b05)
      Java HotSpot(TM) 64-Bit Server VM (build 23.4-b01, mixed mode)

      Java Plug-in 10.8.0.05

      ADDITIONAL OS VERSION INFORMATION :
      Mac OS X 10.7.4

      A DESCRIPTION OF THE PROBLEM :
      When opening a dialog from a swing applet running on the browser, none of the dialog components has focus. Even when clicking on the dialog, it does not receive any focus.
      This only happens when running the applet on the browser.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Because this problem is only visible when the applet runs on the browser, the first step is to create a jar file and an html file that makes use of that jar file.

      1. Runs the html file;
      2. press the button 'open dialog' to show the dialog;

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      1. When the dialog is shown, the button "Yes" should have the focus.
      2. When the JTextField in the dialog is pressed, should receive keyboard focus.
      ACTUAL -
      1. The Button "Yes" does receive the initial focus;
      2. When clicking on the JTextField present on the dialog it does not receive any keyboard focus.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      No errors on the Java console.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      package com.macosx.tests;

      import java.awt.Color;
      import java.awt.Dimension;
      import java.awt.GridLayout;
      import java.awt.event.ActionEvent;
      import java.awt.event.ActionListener;

      import javax.swing.JApplet;
      import javax.swing.JButton;
      import javax.swing.JOptionPane;
      import javax.swing.JPanel;
      import javax.swing.JTextField;
      import javax.swing.SwingUtilities;

      public class AppletDialogExample extends JApplet{

      private JPanel panel;
      private JButton openDialogBtn;

      private void doStart()
      {
      panel = new JPanel();
      panel.setPreferredSize(new Dimension(500,500));
      panel.setBackground(Color.GRAY);

      openDialogBtn = new JButton("open dialog");
      openDialogBtn.addActionListener(new ActionListener(){

      @Override
      public void actionPerformed(ActionEvent arg0) {
      Runnable run = new Runnable()
      {
      public void run()
      {
      JPanel dialogPanel = new JPanel(new GridLayout(1,1));
      JTextField textField = new JTextField();
      dialogPanel.add(textField);

      JOptionPane.showConfirmDialog(null, dialogPanel);
      }
      };
      SwingUtilities.invokeLater(run);
      }
      });
      panel.add(openDialogBtn);
              setContentPane(panel);
      }

      @Override
      public void start() {
      try {
      SwingUtilities.invokeAndWait(new Runnable() {
      public void run() {
      doStart();
      }
      });
      } catch (Exception e) {
      throw new RuntimeException(e);
      }
      }
      }


      <html>
      <head>
      <title>Menu test Applet</title>
      </head>
      <body>
      <applet id="appletID" height="800" width="600"
        code="com.macosx.tests.AppletDialogExample"
        archive="test.jar">
      </applet>
      </div>
      </body>
      </html>
      ---------- END SOURCE ----------

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                dcherepanov Dmitry Cherepanov
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                6 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: