Java JButton Settings tryToBuildAFocusGroup(AbstractButton... buttons)

Here you can find the source of tryToBuildAFocusGroup(AbstractButton... buttons)

Description

Tries to group the given buttons using the FocusTraversalUtils class - if available.

License

Open Source License

Declaration

public static void tryToBuildAFocusGroup(AbstractButton... buttons) 

Method Source Code

//package com.java2s;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import javax.swing.AbstractButton;

public class Main {
    /**//from   ww  w .ja v  a 2s.  c  om
     * Holds the public static method
     * {@code com.jgoodies.jsdl.common.focus.FocusTraversalUtils#group}.
     */
    private static Method groupMethod = null;

    /**
     * Tries to group the given buttons using the FocusTraversalUtils class
     * - if available. Does nothing, if this class is not in the class path.
     */
    public static void tryToBuildAFocusGroup(AbstractButton... buttons) {
        if (groupMethod == null) {
            return;
        }
        try {
            groupMethod.invoke(null, (Object) buttons);
        } catch (IllegalAccessException | InvocationTargetException e) {
            // Do nothing
        }
    }
}

Related

  1. showJFileChooser(javax.swing.JFileChooser chooser, java.awt.Component parent, java.lang.String approveButtonText)
  2. showJFileChooser(JFileChooser chooser, Component parent, String approveButtonText)
  3. showOptions(int width, int type, String title, String text, Object... buttons)
  4. styleButton(final AbstractButton btn)
  5. toBold(final T button)
  6. unifiedButtonLookAndFeel(JComponent b)
  7. updateSize(AbstractButton button, Dimension size)
  8. useOptimizedCustomButtonPainting()