35 import java.io.IOException;
36
37
38 /**
39 * <code>JPanel</code> is a generic lightweight container.
40 * For examples and task-oriented documentation for JPanel, see
41 * <a
42 href="https://docs.oracle.com/javase/tutorial/uiswing/components/panel.html">How to Use Panels</a>,
43 * a section in <em>The Java Tutorial</em>.
44 * <p>
45 * <strong>Warning:</strong> Swing is not thread safe. For more
46 * information see <a
47 * href="package-summary.html#threading">Swing's Threading
48 * Policy</a>.
49 * <p>
50 * <strong>Warning:</strong>
51 * Serialized objects of this class will not be compatible with
52 * future Swing releases. The current serialization support is
53 * appropriate for short term storage or RMI between applications running
54 * the same version of Swing. As of 1.4, support for long term storage
55 * of all JavaBeans™
56 * has been added to the <code>java.beans</code> package.
57 * Please see {@link java.beans.XMLEncoder}.
58 *
59 * @author Arnaud Weber
60 * @author Steve Wilson
61 * @since 1.2
62 */
63 @JavaBean(defaultProperty = "UI", description = "A generic lightweight container.")
64 @SuppressWarnings("serial") // Same-version serialization only
65 public class JPanel extends JComponent implements Accessible
66 {
67 /**
68 * @see #getUIClassID
69 * @see #readObject
70 */
71 private static final String uiClassID = "PanelUI";
72
73 /**
74 * Creates a new JPanel with the specified layout manager and buffering
75 * strategy.
209 */
210 @BeanProperty(bound = false)
211 public AccessibleContext getAccessibleContext() {
212 if (accessibleContext == null) {
213 accessibleContext = new AccessibleJPanel();
214 }
215 return accessibleContext;
216 }
217
218 /**
219 * This class implements accessibility support for the
220 * <code>JPanel</code> class. It provides an implementation of the
221 * Java Accessibility API appropriate to panel user-interface
222 * elements.
223 * <p>
224 * <strong>Warning:</strong>
225 * Serialized objects of this class will not be compatible with
226 * future Swing releases. The current serialization support is
227 * appropriate for short term storage or RMI between applications running
228 * the same version of Swing. As of 1.4, support for long term storage
229 * of all JavaBeans™
230 * has been added to the <code>java.beans</code> package.
231 * Please see {@link java.beans.XMLEncoder}.
232 */
233 @SuppressWarnings("serial") // Same-version serialization only
234 protected class AccessibleJPanel extends AccessibleJComponent {
235
236 /**
237 * Get the role of this object.
238 *
239 * @return an instance of AccessibleRole describing the role of the
240 * object
241 */
242 public AccessibleRole getAccessibleRole() {
243 return AccessibleRole.PANEL;
244 }
245 }
246 }
|
35 import java.io.IOException;
36
37
38 /**
39 * <code>JPanel</code> is a generic lightweight container.
40 * For examples and task-oriented documentation for JPanel, see
41 * <a
42 href="https://docs.oracle.com/javase/tutorial/uiswing/components/panel.html">How to Use Panels</a>,
43 * a section in <em>The Java Tutorial</em>.
44 * <p>
45 * <strong>Warning:</strong> Swing is not thread safe. For more
46 * information see <a
47 * href="package-summary.html#threading">Swing's Threading
48 * Policy</a>.
49 * <p>
50 * <strong>Warning:</strong>
51 * Serialized objects of this class will not be compatible with
52 * future Swing releases. The current serialization support is
53 * appropriate for short term storage or RMI between applications running
54 * the same version of Swing. As of 1.4, support for long term storage
55 * of all JavaBeans
56 * has been added to the <code>java.beans</code> package.
57 * Please see {@link java.beans.XMLEncoder}.
58 *
59 * @author Arnaud Weber
60 * @author Steve Wilson
61 * @since 1.2
62 */
63 @JavaBean(defaultProperty = "UI", description = "A generic lightweight container.")
64 @SuppressWarnings("serial") // Same-version serialization only
65 public class JPanel extends JComponent implements Accessible
66 {
67 /**
68 * @see #getUIClassID
69 * @see #readObject
70 */
71 private static final String uiClassID = "PanelUI";
72
73 /**
74 * Creates a new JPanel with the specified layout manager and buffering
75 * strategy.
209 */
210 @BeanProperty(bound = false)
211 public AccessibleContext getAccessibleContext() {
212 if (accessibleContext == null) {
213 accessibleContext = new AccessibleJPanel();
214 }
215 return accessibleContext;
216 }
217
218 /**
219 * This class implements accessibility support for the
220 * <code>JPanel</code> class. It provides an implementation of the
221 * Java Accessibility API appropriate to panel user-interface
222 * elements.
223 * <p>
224 * <strong>Warning:</strong>
225 * Serialized objects of this class will not be compatible with
226 * future Swing releases. The current serialization support is
227 * appropriate for short term storage or RMI between applications running
228 * the same version of Swing. As of 1.4, support for long term storage
229 * of all JavaBeans
230 * has been added to the <code>java.beans</code> package.
231 * Please see {@link java.beans.XMLEncoder}.
232 */
233 @SuppressWarnings("serial") // Same-version serialization only
234 protected class AccessibleJPanel extends AccessibleJComponent {
235
236 /**
237 * Get the role of this object.
238 *
239 * @return an instance of AccessibleRole describing the role of the
240 * object
241 */
242 public AccessibleRole getAccessibleRole() {
243 return AccessibleRole.PANEL;
244 }
245 }
246 }
|