Java JButton Settings hasText(AbstractButton button)

Here you can find the source of hasText(AbstractButton button)

Description

Checks whether the specified button has associated text.

License

Open Source License

Parameter

Parameter Description
button Button.

Return

If the button has associated text, true is returned, otherwise false.

Declaration

public static boolean hasText(AbstractButton button) 

Method Source Code

//package com.java2s;

import javax.swing.*;

public class Main {
    /**//  w  w  w.j av  a 2s . co  m
     * Checks whether the specified button has associated text.
     * 
     * @param button
     *            Button.
     * @return If the button has associated text, <code>true</code> is returned,
     *         otherwise <code>false</code>.
     */
    public static boolean hasText(AbstractButton button) {
        String text = button.getText();
        if ((text != null) && (text.length() > 0)) {
            return true;
        }
        return false;
    }
}

Related

  1. getWindowFileChooserOKButton(JFileChooser chooser)
  2. groupButtons(AbstractButton... buttons)
  3. groupButtons(final Container container, final boolean recursive)
  4. growFont(JComponent button)
  5. hasIcon(AbstractButton button)
  6. hideApproveButton(JFileChooser fileChooser)
  7. hideJFileChooserButtons(JFileChooser sessionFileChooser)
  8. interButtonSpace()
  9. isScrollBarButton(AbstractButton button)