JTextField: requestFocus() : JTextField « javax.swing « Java by API






JTextField: requestFocus()

 

import javax.swing.JTextField;
import javax.swing.SwingUtilities;

public class Main {
  public static void main(String[] argv) throws Exception {
    final JTextField textfield = new JTextField(10);

    SwingUtilities.invokeLater(new Runnable() {
      public void run() {
        textfield.requestFocus();
      }
    });

  }
}

   
  








Related examples in the same category

1.JTextField.LEFT
2.JTextField.LEADING
3.JTextField.TRAILING
4.new JTextField(String text)
5.new JTextField(String text, int columns)
6.JTextField: addActionListener(ActionListener s)
7.JTextField: addFocusListener(FocusListener l)
8.JTextField: addKeyListener(KeyListener l)
9.JTextField: copy()
10.JTextField: cut()
11.JTextField: getActions()
12.JTextField: getCaretPosition()
13.JTextField: getDocument()
14.JTextField: getHorizontalVisibility()
15.JTextField: getHorizontalVisibility() (2)
16.JTextField: getInputMap()
17.JTextField: getKeymap()
18.JTextField: getScrollOffset()
19.JTextField: paste()
20.JTextField: registerKeyboardAction(ActionListener anAction,String aCommand,KeyStroke aKeyStroke,int aCondition)
21.JTextField: modelToView(int pos)
22.JTextField: read(Reader in, Object desc)
23.JTextField: setDocument(Document doc)
24.JTextField: setFocusAccelerator(char aKey)
25.JTextField: setHorizontalAlignment(int alignment)
26.JTextField: setInputVerifier(InputVerifier input)
27.JTextField: setPreferredSize(Dimension preferredSize)
28.JTextField: setNavigationFilter(NavigationFilter filter)
29.JTextField: setTransferHandler(TransferHandler newHandler)
30.JTextField: write(Writer out)