85 * when the viewport is obscured by another window, or partially offscreen.
86 * When another window
87 * obscures the viewport the copyArea will copy garbage and a
88 * paint event will be generated by the system to inform us we need to
89 * paint the newly exposed region. The only way to handle this is to
90 * repaint the whole viewport, which can cause slower performance than the
91 * backing store case. In most applications very rarely will the user be
92 * scrolling while the viewport is obscured by another window or offscreen,
93 * so this optimization is usually worth the performance hit when obscured.
94 * <p>
95 * <strong>Warning:</strong> Swing is not thread safe. For more
96 * information see <a
97 * href="package-summary.html#threading">Swing's Threading
98 * Policy</a>.
99 * <p>
100 * <strong>Warning:</strong>
101 * Serialized objects of this class will not be compatible with
102 * future Swing releases. The current serialization support is
103 * appropriate for short term storage or RMI between applications running
104 * the same version of Swing. As of 1.4, support for long term storage
105 * of all JavaBeans™
106 * has been added to the <code>java.beans</code> package.
107 * Please see {@link java.beans.XMLEncoder}.
108 *
109 * @author Hans Muller
110 * @author Philip Milne
111 * @see JScrollPane
112 * @since 1.2
113 */
114 @SuppressWarnings("serial") // Same-version serialization only
115 public class JViewport extends JComponent implements Accessible
116 {
117 /**
118 * @see #getUIClassID
119 * @see #readObject
120 */
121 private static final String uiClassID = "ViewportUI";
122
123 /** Property used to indicate window blitting should not be done.
124 */
125 static final Object EnableWindowBlit = "EnableWindowBlit";
1381 *
1382 * @param newExtent a <code>Dimension</code> object specifying
1383 * the size of the view
1384 */
1385 public void setExtentSize(Dimension newExtent) {
1386 Dimension oldExtent = getExtentSize();
1387 if (!newExtent.equals(oldExtent)) {
1388 setSize(newExtent);
1389 fireStateChanged();
1390 }
1391 }
1392
1393 /**
1394 * A listener for the view.
1395 * <p>
1396 * <strong>Warning:</strong>
1397 * Serialized objects of this class will not be compatible with
1398 * future Swing releases. The current serialization support is
1399 * appropriate for short term storage or RMI between applications running
1400 * the same version of Swing. As of 1.4, support for long term storage
1401 * of all JavaBeans™
1402 * has been added to the <code>java.beans</code> package.
1403 * Please see {@link java.beans.XMLEncoder}.
1404 */
1405 @SuppressWarnings("serial") // Same-version serialization only
1406 protected class ViewListener extends ComponentAdapter implements Serializable
1407 {
1408 public void componentResized(ComponentEvent e) {
1409 fireStateChanged();
1410 revalidate();
1411 }
1412 }
1413
1414 /**
1415 * Creates a listener for the view.
1416 * @return a <code>ViewListener</code>
1417 */
1418 protected ViewListener createViewListener() {
1419 return new ViewListener();
1420 }
1421
1852 * @return an AccessibleJViewport that serves as the
1853 * AccessibleContext of this JViewport
1854 */
1855 public AccessibleContext getAccessibleContext() {
1856 if (accessibleContext == null) {
1857 accessibleContext = new AccessibleJViewport();
1858 }
1859 return accessibleContext;
1860 }
1861
1862 /**
1863 * This class implements accessibility support for the
1864 * <code>JViewport</code> class. It provides an implementation of the
1865 * Java Accessibility API appropriate to viewport user-interface elements.
1866 * <p>
1867 * <strong>Warning:</strong>
1868 * Serialized objects of this class will not be compatible with
1869 * future Swing releases. The current serialization support is
1870 * appropriate for short term storage or RMI between applications running
1871 * the same version of Swing. As of 1.4, support for long term storage
1872 * of all JavaBeans™
1873 * has been added to the <code>java.beans</code> package.
1874 * Please see {@link java.beans.XMLEncoder}.
1875 */
1876 @SuppressWarnings("serial") // Same-version serialization only
1877 protected class AccessibleJViewport extends AccessibleJComponent {
1878 /**
1879 * Get the role of this object.
1880 *
1881 * @return an instance of AccessibleRole describing the role of
1882 * the object
1883 */
1884 public AccessibleRole getAccessibleRole() {
1885 return AccessibleRole.VIEWPORT;
1886 }
1887 } // inner class AccessibleJViewport
1888 }
|
85 * when the viewport is obscured by another window, or partially offscreen.
86 * When another window
87 * obscures the viewport the copyArea will copy garbage and a
88 * paint event will be generated by the system to inform us we need to
89 * paint the newly exposed region. The only way to handle this is to
90 * repaint the whole viewport, which can cause slower performance than the
91 * backing store case. In most applications very rarely will the user be
92 * scrolling while the viewport is obscured by another window or offscreen,
93 * so this optimization is usually worth the performance hit when obscured.
94 * <p>
95 * <strong>Warning:</strong> Swing is not thread safe. For more
96 * information see <a
97 * href="package-summary.html#threading">Swing's Threading
98 * Policy</a>.
99 * <p>
100 * <strong>Warning:</strong>
101 * Serialized objects of this class will not be compatible with
102 * future Swing releases. The current serialization support is
103 * appropriate for short term storage or RMI between applications running
104 * the same version of Swing. As of 1.4, support for long term storage
105 * of all JavaBeans
106 * has been added to the <code>java.beans</code> package.
107 * Please see {@link java.beans.XMLEncoder}.
108 *
109 * @author Hans Muller
110 * @author Philip Milne
111 * @see JScrollPane
112 * @since 1.2
113 */
114 @SuppressWarnings("serial") // Same-version serialization only
115 public class JViewport extends JComponent implements Accessible
116 {
117 /**
118 * @see #getUIClassID
119 * @see #readObject
120 */
121 private static final String uiClassID = "ViewportUI";
122
123 /** Property used to indicate window blitting should not be done.
124 */
125 static final Object EnableWindowBlit = "EnableWindowBlit";
1381 *
1382 * @param newExtent a <code>Dimension</code> object specifying
1383 * the size of the view
1384 */
1385 public void setExtentSize(Dimension newExtent) {
1386 Dimension oldExtent = getExtentSize();
1387 if (!newExtent.equals(oldExtent)) {
1388 setSize(newExtent);
1389 fireStateChanged();
1390 }
1391 }
1392
1393 /**
1394 * A listener for the view.
1395 * <p>
1396 * <strong>Warning:</strong>
1397 * Serialized objects of this class will not be compatible with
1398 * future Swing releases. The current serialization support is
1399 * appropriate for short term storage or RMI between applications running
1400 * the same version of Swing. As of 1.4, support for long term storage
1401 * of all JavaBeans
1402 * has been added to the <code>java.beans</code> package.
1403 * Please see {@link java.beans.XMLEncoder}.
1404 */
1405 @SuppressWarnings("serial") // Same-version serialization only
1406 protected class ViewListener extends ComponentAdapter implements Serializable
1407 {
1408 public void componentResized(ComponentEvent e) {
1409 fireStateChanged();
1410 revalidate();
1411 }
1412 }
1413
1414 /**
1415 * Creates a listener for the view.
1416 * @return a <code>ViewListener</code>
1417 */
1418 protected ViewListener createViewListener() {
1419 return new ViewListener();
1420 }
1421
1852 * @return an AccessibleJViewport that serves as the
1853 * AccessibleContext of this JViewport
1854 */
1855 public AccessibleContext getAccessibleContext() {
1856 if (accessibleContext == null) {
1857 accessibleContext = new AccessibleJViewport();
1858 }
1859 return accessibleContext;
1860 }
1861
1862 /**
1863 * This class implements accessibility support for the
1864 * <code>JViewport</code> class. It provides an implementation of the
1865 * Java Accessibility API appropriate to viewport user-interface elements.
1866 * <p>
1867 * <strong>Warning:</strong>
1868 * Serialized objects of this class will not be compatible with
1869 * future Swing releases. The current serialization support is
1870 * appropriate for short term storage or RMI between applications running
1871 * the same version of Swing. As of 1.4, support for long term storage
1872 * of all JavaBeans
1873 * has been added to the <code>java.beans</code> package.
1874 * Please see {@link java.beans.XMLEncoder}.
1875 */
1876 @SuppressWarnings("serial") // Same-version serialization only
1877 protected class AccessibleJViewport extends AccessibleJComponent {
1878 /**
1879 * Get the role of this object.
1880 *
1881 * @return an instance of AccessibleRole describing the role of
1882 * the object
1883 */
1884 public AccessibleRole getAccessibleRole() {
1885 return AccessibleRole.VIEWPORT;
1886 }
1887 } // inner class AccessibleJViewport
1888 }
|