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

JOptionPane.showInternal*Dialog() throws AppletSecurityException

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 1.3.0
    • deploy
    • x86
    • windows_98



      Name: yyT116575 Date: 01/11/2001


      java version "1.3.0"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
      Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)

      I am using a variety of JInternalFrame objects inside an applet to clone an
      existing DOS-based interface. The internal frames all have a class that extends
      JDesktopPane as their immediate parent. The frames typically enclose JPanels
      with various JTextField input fields on them and buttons like "ok", "clear" and
      "cancel". The data from the JTextFields is stored in an object representing the
      data when "ok" is clicked on, following a data-validation check. I would like to
      call JOptionPane.showInternalMessageDialog(thePanel, message, title,
      JOptionPane.WARNING_MESSAGE) if the data validation fails on any JPanel 'form'.
      However, I am finding that such a call causes a
      netscape.security.AppletSecurityException: checkawteventqueueaccess to be
      thrown.

      On the other hand, using the JOptionPane.showMessageDialog() method rather than
      the showInternal*** (with otherwise identical code) causes no problem at all. I
      haven't seen a reference to this problem in particular, although I did read that
      it used to be necessary to employ a workaround to prevent awt event queue access
      generating an AppletSecurityException for JInternalPane in applets and this
      sounds to me like a related problem. Optimistically, I tried pasting in the
      reported fix for the latter, ie:

      JRootPane rp = myPanel.this.getRootPane();
      rp.setClientProperty("defeatSystemEventQueueCheck", Boolean.TRUE);

      without success. The structure of my interface is rather complex with a lot of
      classes so I can't really give you all the code to reproduce the exact problem,
      but I'll do my best to give you the basic structure and hope you can offer me
      some help...

      public class MainInputPanel extends InputPanel
      {

      // this class is added to the ContentPane of a class that extends JInternalFrame
      // In turn, the JInternalFrame is added to a class that extends JDesktopPane.
      // The latter is added to the ContentPane of a class that extends JApplet

      // calling JOptionPane.showMessageDialog() in the code below causes no probs
      // whereas replacing the call with JOptionPane.showMessageDialog() causes
      // Netscape to throw an AppletSecurityException

         /**
          * Listener for buttons present on MainInputPanel form
          */
          class ButtonListener implements ActionListener
          {

            public void actionPerformed(ActionEvent event)
            {
              Object source = event.getSource();


                  if(source == showGasDataPanelButton)
                  {
                     System.out.println("Heard gas panel show button");
                     GasDataFrame gasFrame =
      enclosingFrame_.getViewpacPane().getGasDataFrame();

                     try
                     {
                        MainInputPanel.this.copyEdits();
                     }
                     catch(NumberFormatException nfe)
                     {
                        //Show warning dialog - the gas data panel options depend on the flow type selection
                        JOptionPane.showInternalMessageDialog
                        ( MainInputPanel.this,
                              nfe.getMessage(),
                              "Main input validation",
                              JOptionPane.WARNING_MESSAGE);

                        return;
                     }

            }

         }

      }

      // external class InputPanel:

      import javax.swing.*;
      import com.esdu.glenrowan.viewpac.exception.viewpacexception.*;

      public abstract class InputPanel extends JPanel
      {
         abstract void initialiseForm();
         abstract void copyEdits();
         abstract void validateForm() throws InvalidViewpacInputDataException;
      }
      (Review ID: 106301)
      ======================================================================

            mafishersunw Margarita Fisher (Inactive)
            yyoungsunw Yung-ching Young (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: