public ContainerOrderFTPTest() { expectedTraversal = "B1B2F1"; b1 = new Button("B1"); b2 = new Button("B2"); frame = new Frame("F1"); frame.setLayout(new FlowLayout()); frame.setSize(200, 200); coftp = new ContainerOrderFocusTraversalPolicy(); frame.setFocusTraversalPolicy(coftp); frame.add(b1); frame.add(b2); frame.setVisible(true); }
@Test public void customFocusTraversalPolicy() { FormBuilder.create() .columns("pref") .rows("pref") .focusTraversalPolicy(new ContainerOrderFocusTraversalPolicy()) .build(); }
@Test(expected=IllegalStateException.class) public void rejectSettingFocusTraversalPolicyTwice() { FormBuilder.create() .columns("pref") .rows("pref") .focusTraversalPolicy(new ContainerOrderFocusTraversalPolicy()) .focusTraversalPolicy(new LayoutFocusTraversalPolicy()) .build(); }