Disables the forward and backward focus traversal keys on the given component. - Java java.awt

Java examples for java.awt:Component

Description

Disables the forward and backward focus traversal keys on the given component.

Demo Code


//package com.java2s;
import java.awt.*;

import java.util.*;

public class Main {
    /**/* ww  w.  j  a  v  a2s  .  com*/
     * Disables the forward and backward focus traversal keys on the given
     * component.
     */
    public static void disableFocusTraversal(Component c) {
        Set<AWTKeyStroke> emptySet = Collections.emptySet();
        c.setFocusTraversalKeys(
                KeyboardFocusManager.FORWARD_TRAVERSAL_KEYS, emptySet);
        c.setFocusTraversalKeys(
                KeyboardFocusManager.BACKWARD_TRAVERSAL_KEYS, emptySet);
    }
}

Related Tutorials