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

FileDialog broken on Win32

XMLWordPrintable

    • sparc
    • solaris_2.5.1

      I'm making a FileDialog call to save a file.

      FileDialog fd = new FileDialog((Frame) parent, "Save File...", FileDialog.SAVE);

      The Dialog is not coming up on Win32, it comes up on Solaris. The problem is appearing in my Java 2D TestProduct which has a number of swing components. The problem did not reproduce for me on a JDK 1.1 applet. Pretty strange, I thought. The regression applet is :

      /java/sqe_TestExec/JCK-112a/tests/api/java_awt_manual/ComponentTest.html

      The location of the Java 2D TestProduct is :

      /home/lichtenw/JavaMedia/2d/TestProduct

      Copy this to Windows, run the runnit.bat script. Check the script out so that it's pointing to a jdk and swing.

      Once the TestProduct is up, press the run button, press the stop button, press the "Save to File" button. Expecting the save dialog to appear.

      carol.hayes@Eng 1998-02-11:
      Brian sent a smaller, standalone program that reproduces this - run it and press the big button:

      import java.applet.*;
      import java.awt.*;
      import java.awt.event.*;
      import java.io.File;
      import java.io.FileOutputStream;
      import java.io.FileInputStream;
      import java.util.Date;
      import java.awt.swing.*;



      public class TestResults extends Applet implements ActionListener {


          public TestResults() {
      setLayout(new BorderLayout());
      Button b = new Button("Save to File");
      b.addActionListener(this);
      add(b);
          }


          public void actionPerformed(ActionEvent e) {

              Container parent = getParent(); // get the parent of your applet
      while( parent != null && !( parent instanceof Frame) ) {
          parent = parent.getParent();
          }
      System.out.println(parent);

              FileDialog fd = new FileDialog((Frame) parent, "Save File...", FileDialog.SAVE);
      System.out.println(fd);
      Date d = new Date();
      fd.setFile(d.toString());
              fd.show();
              if (fd.getFile() != null) {
      System.out.println("Saving: " + fd.getDirectory() + fd.getFile());
              }
          }

          public static void main(String s[]) {
      Frame f = new Frame("Test");
      f.add("Center", new TestResults());
      f.pack();
      f.setSize(new Dimension(400,400));
      f.show();
          }
      } // end TestResults

            dmendenhsunw David Mendenhall (Inactive)
            blichtensunw Brian Lichtenwalter (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: