Java JButton .getAccessibleContext ()

Syntax

JButton.getAccessibleContext() has the following syntax.

public AccessibleContext getAccessibleContext()

Example

In the following code shows how to use JButton.getAccessibleContext() method.


/*from  w w  w .  j  ava 2s.c  o  m*/
import javax.swing.ImageIcon;
import javax.swing.JButton;

public class Main {
  public static void main(String[] argv) throws Exception {
  JButton button = new JButton(new ImageIcon("image.gif"));
    button.setToolTipText("Button Name");

    button.getAccessibleContext().setAccessibleName("Button Name");
  }
}