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






AccessibleContext: getAccessibleValue()

import java.awt.Adjustable;
import java.awt.Dimension;

import javax.accessibility.AccessibleContext;
import javax.accessibility.AccessibleValue;
import javax.swing.JFrame;
import javax.swing.JPanel;
import javax.swing.JScrollBar;

public class MainClass extends JFrame {
  MainClass() {
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    JPanel p = new JPanel();
    p.setPreferredSize(new Dimension(300, 50));
    JScrollBar jsb;
    jsb = new JScrollBar(Adjustable.HORIZONTAL, 0, 1, 0, 100);
    jsb.setPreferredSize(new Dimension(200, 20));
    p.add(jsb);

    getContentPane().add(p);

    pack();
    setVisible(true);
  }

  public static void main(String[] args) {
    MainClass ad9 = new MainClass();
    try {
      Thread.sleep(5000);
    } catch (InterruptedException e) {
    }

    ad9.dumpValueInfo(ad9.getAccessibleContext());
  }

  void dumpValueInfo(AccessibleContext ac) {
    AccessibleValue av = ac.getAccessibleValue();

    if (av != null) {
      System.out.println("Minimum value = " + av.getMinimumAccessibleValue());
      System.out.println("Current value = " + av.getCurrentAccessibleValue());
      System.out.println("Maximum value = " + av.getMaximumAccessibleValue());

      return;
    }

    int nChildren = ac.getAccessibleChildrenCount();

    for (int i = 0; i < nChildren; i++)
      dumpValueInfo(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: getAccessibleTable()
9.AccessibleContext: getAccessibleText()
10.AccessibleContext: setAccessibleDescription(String s)
11.AccessibleContext: setAccessibleName(String s)