Java Swing Tutorial - 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.

// ww  w . jav  a2  s.  c  om
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");
  }
}