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

Focus is set to the first component after resizing main window.

    XMLWordPrintable

    Details

    • Subcomponent:
    • Resolved In Build:
      hopper
    • CPU:
      sparc
    • OS:
      solaris_2.5.1, solaris_8
    • Verification:
      Verified

      Description



      Name: tb29552 Date: 06/24/97


      1. - Start the sample programm.
         - Click on the second button.
         - Click on the last button.
         - Now the TextField will have the focus.

       I tried to implement a context sensitive status bar, but it does
       not work, because every time a new status bar should be displayed,
       the main window is resized and the focus is changed to the first
       component.

       2. Example source:

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

       public class FocusBug extends Frame implements ActionListener {
               public FocusBug() {
                       setLayout(new GridLayout(3, 1));
                       add(new TextField("Has focus after resize"));
                       add(new Button("Give me the focus please!"));
                       add(new Button("Test it!"));
                       ((Button)getComponent(2)).addActionListener(this);
                       pack();
               }

               public void actionPerformed(ActionEvent e) {
                      setSize(200, 200);
                      doLayout();
                      pack();
               }

               public static void main(String[] args) {
                       FocusBug window = new FocusBug();
                       window.show();
               }
      }
      company - TS Softwareentwicklung , email - ###@###.###
      ======================================================================

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              dmikhalksunw Denis Mikhalkin (Inactive)
              Reporter:
              tbell Tim Bell
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: