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

java.awt.Frame.toFront method does not work on WIN32

    XMLWordPrintable

    Details

    • Subcomponent:
    • CPU:
      x86
    • OS:
      windows_95

      Description

      The program below when run displays 2 windows stacked one on top of each other.
      When the button in one is pressed the other is raised to the top of te window
      stack.

      This works fine under Solaris 2.5.1 withJ DK 1.0.2, but fails under Windows '95
      with JDK1.0.2

      The "other" window is raised rather than the one being clicked on since, otherwise
      Windows '95 default behaviour of raising a window that gets focus masks the
      problem. This is most likely related to the bug.

      import java.awt.*;
      import java.applet.*;
      import java.io.*;

      public class winstackFrame extends Frame {
          winstackFrame win=null;

          public static void main(String args[]) {
          
             winstackFrame w1 = new winstackFrame("Frame 1");
             winstackFrame w2 = new winstackFrame("Frame 2");
             w1.raiseWin(w2);
             w2.raiseWin(w1);

          }

                
          void raiseWin(winstackFrame f) {
             win = f;
          }

          public winstackFrame (String s) {
          super(s);
          Panel p1 = new Panel();
          Button b1 = new Button("Raise Frame");
          p1.add(b1);
          add("Center",p1);
          reshape(100,100,200,100);
          show();

         }

         public synchronized boolean action(Event e, Object o) {

          if (e.target instanceof Button) {
               System.out.println("raising window");
               if ((win != null) && (win instanceof Frame)) {
                    win.toFront();
                    return true;
               }
          }
          return false;
        }
      }

        Attachments

          Activity

            People

            Assignee:
            rramsunw Ranganathan Ram (Inactive)
            Reporter:
            prr Philip Race
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: