Java JFrame is focus owner

Description

Java JFrame is focus owner

import javax.swing.JButton;
import javax.swing.JFrame;

public class Main {
   public static void main(String[] argv) throws Exception {
      JButton component = new JButton("a");

      JFrame f = new JFrame();
      f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
      f.add(component);//from   www  .  jav  a 2 s .  com
      f.pack();
      f.setVisible(true);

     System.out.println(f.isFocusOwner());
   }
}



PreviousNext

Related