Makes sure the component won't receive the focus. - Java Swing

Java examples for Swing:Focus Event

Description

Makes sure the component won't receive the focus.

Demo Code

/*/* ww  w .  j  a  v  a2s . co m*/
 * @(#)PortingUtils.java 4/12/2006
 *
 * Copyright 2002 - 2006 JIDE Software Inc. All rights reserved.
 */
//package com.java2s;
import javax.swing.*;

public class Main {
    /**
     * Makes sure the component won't receive the focus.
     *
     * @param component the component
     */
    public static void removeFocus(JComponent component) {
        component.setRequestFocusEnabled(false);
        component.setFocusable(false);
    }
}

Related Tutorials