49 |
import java.awt.event.ComponentEvent; |
import java.awt.event.ComponentEvent; |
50 |
import java.io.Serializable; |
import java.io.Serializable; |
51 |
|
|
52 |
|
import javax.accessibility.Accessible; |
53 |
|
import javax.accessibility.AccessibleContext; |
54 |
|
import javax.accessibility.AccessibleRole; |
55 |
import javax.swing.border.Border; |
import javax.swing.border.Border; |
56 |
import javax.swing.event.ChangeEvent; |
import javax.swing.event.ChangeEvent; |
57 |
import javax.swing.event.ChangeListener; |
import javax.swing.event.ChangeListener; |
98 |
* the underlying child at position <code>(-VX,-VY)</code></p> |
* the underlying child at position <code>(-VX,-VY)</code></p> |
99 |
* |
* |
100 |
*/ |
*/ |
101 |
public class JViewport extends JComponent |
public class JViewport extends JComponent implements Accessible |
102 |
{ |
{ |
103 |
|
/** |
104 |
|
* Provides accessibility support for <code>JViewport</code>. |
105 |
|
* |
106 |
|
* @author Roman Kennke (roman@kennke.org) |
107 |
|
*/ |
108 |
|
protected class AccessibleJViewport extends AccessibleJComponent |
109 |
|
{ |
110 |
|
/** |
111 |
|
* Creates a new instance of <code>AccessibleJViewport</code>. |
112 |
|
*/ |
113 |
|
public AccessibleJViewport() |
114 |
|
{ |
115 |
|
// Nothing to do here. |
116 |
|
} |
117 |
|
|
118 |
|
/** |
119 |
|
* Returns the accessible role of <code>JViewport</code>, which is |
120 |
|
* {@link AccessibleRole#VIEWPORT}. |
121 |
|
* |
122 |
|
* @return the accessible role of <code>JViewport</code> |
123 |
|
*/ |
124 |
|
public AccessibleRole getAccessibleRole() |
125 |
|
{ |
126 |
|
return AccessibleRole.VIEWPORT; |
127 |
|
} |
128 |
|
} |
129 |
|
|
130 |
/** |
/** |
131 |
* A {@link java.awt.event.ComponentListener} that listens for |
* A {@link java.awt.event.ComponentListener} that listens for |
218 |
*/ |
*/ |
219 |
ViewListener viewListener; |
ViewListener viewListener; |
220 |
|
|
221 |
|
/** |
222 |
|
* The accessible context of this <code>JViewport</code>. |
223 |
|
*/ |
224 |
|
AccessibleContext accessibleContext; |
225 |
|
|
226 |
public JViewport() |
public JViewport() |
227 |
{ |
{ |
228 |
setOpaque(true); |
setOpaque(true); |
562 |
setViewPosition (new Point(contentRect.x - |
setViewPosition (new Point(contentRect.x - |
563 |
(portBounds.width - contentRect.width), pos.y)); |
(portBounds.width - contentRect.width), pos.y)); |
564 |
} |
} |
565 |
|
|
566 |
|
/** |
567 |
|
* Returns the accessible context for this <code>JViewport</code>. This |
568 |
|
* will be an instance of {@link AccessibleJViewport}. |
569 |
|
* |
570 |
|
* @return the accessible context for this <code>JViewport</code> |
571 |
|
*/ |
572 |
|
public AccessibleContext getAccessibleContext() |
573 |
|
{ |
574 |
|
if (accessibleContext == null) |
575 |
|
accessibleContext = new AccessibleJViewport(); |
576 |
|
return accessibleContext; |
577 |
|
} |
578 |
} |
} |