FileDocCategorySizeDatePackage
FocusTraversalExample.javaAPI DocExample1235Thu Oct 24 20:14:28 BST 2002None

FocusTraversalExample

public class FocusTraversalExample extends JPanel

Fields Summary
Constructors Summary
public FocusTraversalExample()

        setLayout(new GridLayout(6, 1));
        JButton button1 = new JButton("Texas");
        JButton button2 = new JButton("Vermont");
        JButton button3 = new JButton("Florida");
        JButton button4 = new JButton("Alabama");
        JButton button5 = new JButton("Minnesota");
        JButton button6 = new JButton("California");

        setBackground(Color.lightGray);
        add(button1);
        add(button2);
        add(button3);
        add(button4);
        add(button5);
        add(button6);
    
Methods Summary
public static voidmain(java.lang.String[] args)

        JFrame frame = new JFrame("Alphabetized Button Focus Traversal");
        frame.setFocusTraversalPolicy(new AlphaButtonPolicy());
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        frame.setContentPane(new FocusTraversalExample());
        frame.setSize(400, 300);
        frame.setVisible(true);