import javax.imageio.*; import java.awt.image.*; import java.awt.event.*; import java.awt.*; import java.security.spec.*; import java.security.*; import java.lang.management.*; import java.lang.ref.*; import java.lang.reflect.*; import java.net.*; import java.io.*; import javax.swing.table.*; import javax.swing.text.*; import javax.swing.event.*; import javax.swing.*; import java.util.concurrent.atomic.*; import java.util.concurrent.*; import java.util.regex.*; import java.util.List; import java.util.zip.*; import java.util.*; public class main { public static void main(String[] args) throws Exception { SwingUtilities.invokeLater(new Runnable() { public void run() { try { Component focused = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner(); if (focused instanceof JTextField) print("Focused text field: " + focused); else if (focused != null) print("Focused other object: " + focused); else print("No focused object."); /* L l = allSwingComponentsOfType(JTextField.class); print(l.size() + " text field(s) found."); for (JTextField tf : l) if (tf.isFocused...()) { } */ } catch (Exception _e) { throw _e instanceof RuntimeException ? (RuntimeException) _e : new RuntimeException(_e); } } }); } static StringBuffer print_log = new StringBuffer(); static void print() { print(""); } static void print(Object o) { String s = String.valueOf(o) + "\n"; print_log.append(s); System.out.print(s); } static void print(long l) { print(String.valueOf(l)); } static int l(Object[] array) { return array == null ? 0 : array.length; } static int l(List list) { return list == null ? 0 : list.size(); } static int l(String s) { return s == null ? 0 : s.length(); } }