Java tutorial
import java.awt.Dimension; import javax.accessibility.AccessibleContext; import javax.accessibility.AccessibleIcon; import javax.swing.ImageIcon; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; public class MainClass extends JFrame { MainClass() { setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); JPanel p = new JPanel(); p.setPreferredSize(new Dimension(200, 50)); JButton jb = new JButton(new ImageIcon("bullet.gif")); p.add(jb); getContentPane().add(p); pack(); setVisible(true); } public static void main(String[] args) { MainClass ad5 = new MainClass(); ad5.dumpIconInfo(ad5.getAccessibleContext()); } void dumpIconInfo(AccessibleContext ac) { AccessibleIcon[] ai = ac.getAccessibleIcon(); if (ai != null) { for (int i = 0; i < ai.length; i++) { String s = ai[i].getAccessibleIconDescription(); System.out.println("Description = " + s); System.out.println("Width = " + ai[i].getAccessibleIconWidth()); System.out.println("height = " + ai[i].getAccessibleIconHeight()); } return; } int nChildren = ac.getAccessibleChildrenCount(); for (int i = 0; i < nChildren; i++) dumpIconInfo(ac.getAccessibleChild(i).getAccessibleContext()); } }