Java JButton getButtonNumber(JButton btn)

Here you can find the source of getButtonNumber(JButton btn)

Description

Takes number from button name.

License

Apache License

Parameter

Parameter Description
btn a parameter

Declaration

public static int getButtonNumber(JButton btn) 

Method Source Code

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

import javax.swing.JButton;

public class Main {
    /**//from   w  w  w .j  ava  2 s .co  m
     * Takes number from button name.
     * @param btn
     * @return 
     */
    public static int getButtonNumber(JButton btn) {
        int value = -1;
        String svalue = btn.getText();
        try {
            value = Integer.parseInt(svalue);
        } catch (NumberFormatException nfe) {
        }

        return value;
    }
}

Related

  1. exit(JButton aButton)
  2. fixButtonWidth(JButton... buttons)
  3. fixToolbarButtonImpl(JButton button)
  4. formatButtonAsLabel(JButton button)
  5. formatJButton(JButton button, String tooltips)
  6. getScrollStroke(final JButton _jlbl_stroke)
  7. getWFStep(Vector actionButtons, String action)
  8. initHelpButton(final JButton buttonHelp)
  9. nombreImg(JButton boton)