AccessibleContext: getAccessibleTable() : AccessibleContext « javax.accessibility « Java by API






AccessibleContext: getAccessibleTable()

import java.awt.Dimension;

import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleTable;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTable;

public class MainClass extends JFrame {
  MainClass() {
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JPanel p = new JPanel();
    p.setPreferredSize(new Dimension(200, 200));

    JTable jt = new JTable(10, 3);
    p.add(new JScrollPane(jt));

    getContentPane().add(p);

    pack();
    setVisible(true);
  }

  public static void main(String[] args) {
    MainClass ad7 = new MainClass();

    try {
      Thread.sleep(5000);
    } catch (InterruptedException e) {
    }

    ad7.dumpTableInfo(ad7.getAccessibleContext());
  }

  void dumpTableInfo(AccessibleContext ac) {
    AccessibleTable at = ac.getAccessibleTable();

    if (at != null) {
      int nCol = at.getAccessibleColumnCount();
      System.out.println("Columns = " + nCol);

      int nRow = at.getAccessibleRowCount();
      System.out.println("Rows = " + nRow);

      return;
    }

    int nChildren = ac.getAccessibleChildrenCount();

    for (int i = 0; i < nChildren; i++)
      dumpTableInfo(ac.getAccessibleChild(i).getAccessibleContext());
  }
}

           
       








Related examples in the same category

1.AccessibleContext: getAccessibleAction()
2.AccessibleAction: getAccessibleActionCount()
3.AccessibleContext: getAccessibleChildrenCount()
4.AccessibleContext: getAccessibleDescription()
5.AccessibleContext: getAccessibleName()
6.AccessibleContext: getAccessibleRelationSet()
7.AccessibleContext: getAccessibleSelection()
8.AccessibleContext: getAccessibleText()
9.AccessibleContext: getAccessibleValue()
10.AccessibleContext: setAccessibleDescription(String s)
11.AccessibleContext: setAccessibleName(String s)