Code example for Vector

Methods: addAll

0
 
public class GameWindowFocusTraversalPolicy extends FocusTraversalPolicy{ 
	Vector<Component> order; 
 
	public GameWindowFocusTraversalPolicy(Vector<Component> order) { 
		this.order = new Vector<Component>(order.size()); 
		this.order.addAll(order); 
	} 
	public Component getComponentAfter(Container focusCycleRoot, 
			Component aComponent) 
	{ 
		int idx = (order.indexOf(aComponent) + 1) % order.size(); 
		return order.get(idx); 
	} 
 
	public Component getComponentBefore(Container focusCycleRoot, 
			Component aComponent) 
	{ 
		int idx = order.indexOf(aComponent) - 1; 
		if (idx < 0) { 
			idx = order.size() - 1;