import java.net.*; import java.io.*; import javax.swing.*; import java.util.regex.*; import java.util.*; import java.awt.*; import java.awt.event.*; import java.util.List; public class main { public static void main(String[] args) { JFrame frame = new JFrame("A JavaX Frame"); JPanel panel = new JPanel(new BorderLayout()); final JTextArea textArea = new JTextArea(); panel.add(BorderLayout.CENTER, new JScrollPane(textArea)); final JTextField tfCmd = new JTextField(); panel.add(BorderLayout.SOUTH, tfCmd); frame.addWindowListener(new WindowAdapter() { public void windowOpened(WindowEvent e) { tfCmd.requestFocus(); } }); frame.add(panel); frame.setBounds(100, 100, 500, 400); frame.setVisible(true); exitOnFrameClose(frame); } static void exitOnFrameClose(JFrame frame) { frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } }