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

Button in Window malfunctions on Solaris

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 1.1.2
    • Fix Version/s: None
    • Component/s: client-libs
    • Labels:
      None
    • Subcomponent:
    • CPU:
      sparc
    • OS:
      solaris_2.5.1

      Description

      This problem occurs on Solaris, but not on Windows NT.

      This example has a Button in a Window, which when pressed causes the button
      to move. The problem is that when the Frame that owns the Window is not shown,
      and some other Frame is, then the Button ceases to get Action events
      (it behaves as if disabled, receiving mouse events but not action).

      To demonstrate the problem, run "java Win other"

      (other cases that work correctly can be shown with "java Win" "java Win xxx", "java Win both")



      Here is the example:


      import java.awt.*;
      import java.awt.event.*;

      public class Win extends Window implements ActionListener {

        Button b = new Button("Wow");

        public Win(Frame f){
          super(f);
          setLayout(new BorderLayout());
          b.addActionListener(this);
          add("Center", b);
          System.err.println("calling pack");
          setSize(50,50);
          setLocation(100,100);
        }

        public void actionPerformed(ActionEvent e){
          Point p = getLocation();
          if(p.x>200)hide();
          setLocation(p.x+20,p.y+20);
        }

        public static void main(String[] args){
          Frame f = new Frame("Window bug");
          if((args.length==0)||(args[0].equals("both"))){
            f.add("Center", new Label("Look for another window!"));
            f.pack();
            f.show();
            f.setLocation(300,300);
          }
          if((args.length>0)&&((args[0].equals("other")||(args[0].equals("both"))))){
            Frame xx=new Frame("Other");
            xx.add("Center", new Label("Look for another window!"));
            xx.pack();
            xx.show();
          }
          Win w = new Win(f);
          w.show();
        }

      }

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                mbronsonsunw Mike Bronson (Inactive)
                Reporter:
                duke J. Duke (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: