Java JButton Settings setButtonText(ButtonGroup buttonGroup, List texts)

Here you can find the source of setButtonText(ButtonGroup buttonGroup, List texts)

Description

setter method for button text.

License

Apache License

Parameter

Parameter Description
buttonGroup ButtonGroup
texts List

Declaration

public static void setButtonText(ButtonGroup buttonGroup, List<Integer> texts) 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.util.Enumeration;
import java.util.List;
import javax.swing.AbstractButton;
import javax.swing.ButtonGroup;

public class Main {
    /**/*from ww w.  j  a v a2s .  c  o m*/
     * setter method for button text.
     *
     * @param  buttonGroup  ButtonGroup
     * @param  texts        List
     */
    public static void setButtonText(ButtonGroup buttonGroup, List<Integer> texts) {
        int index = 0;

        for (Enumeration<AbstractButton> buttons = buttonGroup.getElements(); buttons.hasMoreElements();) {
            AbstractButton button = buttons.nextElement();
            button.setText(texts.get(index).toString());
            index++;
        }
    }
}

Related

  1. setButton(AbstractButton button, Icon icon, ActionListener buttonListener)
  2. setButtonContentMargin(AbstractButton button, Insets margin)
  3. setButtonInsetsRecursive(Insets insets, Container container)
  4. setButtonSelected(ButtonGroup buttonGroup, int selected)
  5. setButtonStyle(AbstractButton btn)
  6. setHelpIDString(javax.swing.AbstractButton btn, String id)
  7. setHorizontalMargin(AbstractButton button, int hMargin)
  8. setImageIcon(AbstractButton abstractButton, URL url)
  9. setMnemonic(AbstractButton actionComponent)