0 Replies Latest reply: Apr 4, 2013 11:08 PM by 938211 RSS

    Text fields in JDialog are not editable under Java 1.7 for Mac OSX

    938211
      I experience the issue described in http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7196264 and http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=8010486 with Java 1.7.17 on Mac OSX 10.8.x. Despite these bugs are closed, I can easily reproduce these issues with the simplest applet.
      My code:
      public class TestApplet extends JApplet
      {
           private static final long serialVersionUID = 1L;
      
           public void init()
           {
                try
                {
                     SwingUtilities.invokeAndWait(new Runnable()
                     {
                          public void run()
                          {
                               try
                               {
                                    createGui();
                               }
                               catch (Exception e)
                               {
                                    e.printStackTrace();
                               }
                          }
                     });
                }
                catch (Exception e)
                {
                     e.printStackTrace();
                }
           }
      
           private void createGui() throws ClassNotFoundException, InstantiationException, IllegalAccessException, UnsupportedLookAndFeelException
           {
                UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
      
                      final JPanel panel = new JPanel();
                panel.setPreferredSize(new Dimension(500, 500));
      
                JButton openDialogBtn = new JButton("Open dialog");
                openDialogBtn.addActionListener(new ActionListener()
                {
                     public void actionPerformed(ActionEvent arg0)
                     {
                          JDialog dialog = new JDialog();
                          dialog.setSize(200, 200);
                          dialog.setModal(true);
                          
                          JTextArea txtField = new JTextArea();
                          dialog.add(txtField, BorderLayout.CENTER);
                          
                          dialog.setVisible(true);
                     }
                });
                panel.add(openDialogBtn);
                setContentPane(panel);
           }
      }
      The textarea appears not editable when I run this applet on Mac 10.7 and 10.8 with Java 1.7. On an old Mac (10.6 with Java 1.6) this applet works fine as well as on Win7 and Win8 machines with Java 1.7.

      How can I get it fixed on Mac OSX 10.7, 10.8 with Java 1.7?