Java JButton Settings doSetTextInEDT(final AbstractButton abstractButton, final String text)

Here you can find the source of doSetTextInEDT(final AbstractButton abstractButton, final String text)

Description

do Set Text In EDT

License

Open Source License

Declaration

private static void doSetTextInEDT(final AbstractButton abstractButton, final String text) 

Method Source Code

//package com.java2s;
/**/*from  w w  w .  ja  va2  s . c om*/
 * Copyright 2009 - 2014 J?rgen Lundgren
 * 
 * This file is part of org.macroing.wicked.
 * 
 * org.macroing.wicked is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * org.macroing.wicked is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with org.macroing.wicked. If not, see <http://www.gnu.org/licenses/>.
 */

import javax.swing.AbstractButton;

import javax.swing.SwingUtilities;

public class Main {
    private static void doSetTextInEDT(final AbstractButton abstractButton, final String text) {
        abstractButton.setText(text);
    }

    public static void setText(final AbstractButton abstractButton, final String text) {
        doSetText(abstractButton, text);
    }

    private static void doSetText(final AbstractButton abstractButton, final String text) {
        if (abstractButton != null && text != null) {
            if (SwingUtilities.isEventDispatchThread()) {
                doSetTextInEDT(abstractButton, text);
            } else {
                SwingUtilities.invokeLater(new Runnable() {
                    @Override
                    public void run() {
                        doSetTextInEDT(abstractButton, text);
                    }
                });
            }
        }
    }
}

Related

  1. customize(AbstractButton btn)
  2. decoratedToSimpleButton(final T button)
  3. doClick(final AbstractButton button)
  4. doHover(boolean b, AbstractButton... btns)
  5. doSetText(final AbstractButton abstractButton, final String text)
  6. drawActiveButtonBorder(Graphics g, int x, int y, int w, int h)
  7. drawDefaultButtonBorder(Graphics g, int x, int y, int w, int h, boolean active)
  8. emphasizeButton(AbstractButton btn)
  9. equalizeButtonSizes(JPanel jPanelButtons)