Java tutorial
import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JLabel; import javax.swing.JTextField; import javax.swing.SwingConstants; public class Main { public static void main(String[] args) { JLabel l; JTextField t; JButton b; JFrame f = new JFrame("Text Accelerator"); f.add(l = new JLabel("Name:", SwingConstants.RIGHT)); l.setDisplayedMnemonic('n'); f.add(l = new JLabel("House/Street:", SwingConstants.RIGHT)); l.setDisplayedMnemonic('h'); f.add(l = new JLabel("City:", SwingConstants.RIGHT)); l.setDisplayedMnemonic('c'); f.add(l = new JLabel("State/County:", SwingConstants.RIGHT)); l.setDisplayedMnemonic('s'); f.add(l = new JLabel("Zip/Post code:", SwingConstants.RIGHT)); l.setDisplayedMnemonic('z'); f.add(l = new JLabel("Telephone:", SwingConstants.RIGHT)); l.setDisplayedMnemonic('t'); f.add(b = new JButton("Clear")); b.setMnemonic('l'); f.add(t = new JTextField(35)); t.setFocusAccelerator('n'); f.add(t = new JTextField(35)); t.setFocusAccelerator('h'); f.add(t = new JTextField(35)); t.setFocusAccelerator('c'); f.add(t = new JTextField(35)); t.setFocusAccelerator('s'); f.add(t = new JTextField(35)); t.setFocusAccelerator('z'); f.add(t = new JTextField(35)); t.setFocusAccelerator('t'); f.add(b = new JButton("OK")); b.setMnemonic('o'); f.pack(); f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); f.setVisible(true); } }