AccessibleValue: getMinimumAccessibleValue()
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