javax.swing
protected class: JScrollPane.AccessibleJScrollPane [javadoc |
source]
java.lang.Object
AccessibleJComponent
javax.swing.JScrollPane$AccessibleJScrollPane
All Implemented Interfaces:
PropertyChangeListener, ChangeListener
This class implements accessibility support for the
JScrollPane class. It provides an implementation of the
Java Accessibility API appropriate to scroll pane user-interface
elements.
Warning:
Serialized objects of this class will not be compatible with
future Swing releases. The current serialization support is
appropriate for short term storage or RMI between applications running
the same version of Swing. As of 1.4, support for long term storage
of all JavaBeansTM
has been added to the java.beans package.
Please see java.beans.XMLEncoder .
| Field Summary |
|---|
| protected JViewport | viewPort | |
| Methods from java.lang.Object: |
|---|
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Method from javax.swing.JScrollPane$AccessibleJScrollPane Detail: |
public AccessibleRole getAccessibleRole() {
return AccessibleRole.SCROLL_PANE;
}
Get the role of this object. |
public void propertyChange(PropertyChangeEvent e) {
String propertyName = e.getPropertyName();
if (propertyName == "horizontalScrollBar" ||
propertyName == "verticalScrollBar") {
if (e.getNewValue() instanceof JScrollBar) {
setScrollBarRelations((JScrollBar)e.getNewValue());
}
}
}
This method gets called when a bound property is changed. |
public void resetViewPort() {
/*
* Resets the viewport ChangeListener and PropertyChangeListener
*/
if (viewPort != null) {
viewPort.removeChangeListener(this);
viewPort.removePropertyChangeListener(this);
}
viewPort = JScrollPane.this.getViewport();
if (viewPort != null) {
viewPort.addChangeListener(this);
viewPort.addPropertyChangeListener(this);
}
}
|
void setScrollBarRelations(JScrollBar scrollBar) {
/*
* The JScrollBar is a CONTROLLER_FOR the JScrollPane.
* The JScrollPane is CONTROLLED_BY the JScrollBar.
*/
AccessibleRelation controlledBy =
new AccessibleRelation(AccessibleRelation.CONTROLLED_BY,
scrollBar);
AccessibleRelation controllerFor =
new AccessibleRelation(AccessibleRelation.CONTROLLER_FOR,
JScrollPane.this);
// set the relation set for the scroll bar
AccessibleContext ac = scrollBar.getAccessibleContext();
ac.getAccessibleRelationSet().add(controllerFor);
// set the relation set for the scroll pane
getAccessibleRelationSet().add(controlledBy);
}
|
public void stateChanged(ChangeEvent e) {
if (e == null) {
throw new NullPointerException();
}
firePropertyChange(ACCESSIBLE_VISIBLE_DATA_PROPERTY,
Boolean.valueOf(false),
Boolean.valueOf(true));
}
Invoked when the target of the listener has changed its state. |