aboutsummaryrefslogtreecommitdiff
path: root/libjava/classpath/javax/swing/JPanel.java
diff options
context:
space:
mode:
Diffstat (limited to 'libjava/classpath/javax/swing/JPanel.java')
-rw-r--r--libjava/classpath/javax/swing/JPanel.java132
1 files changed, 80 insertions, 52 deletions
diff --git a/libjava/classpath/javax/swing/JPanel.java b/libjava/classpath/javax/swing/JPanel.java
index c7f7c448331..7805e92b6e9 100644
--- a/libjava/classpath/javax/swing/JPanel.java
+++ b/libjava/classpath/javax/swing/JPanel.java
@@ -43,6 +43,7 @@ import java.awt.LayoutManager;
import javax.accessibility.Accessible;
import javax.accessibility.AccessibleContext;
+import javax.accessibility.AccessibleRole;
import javax.swing.plaf.PanelUI;
/**
@@ -52,63 +53,90 @@ import javax.swing.plaf.PanelUI;
*/
public class JPanel extends JComponent implements Accessible
{
- public JPanel()
+ /**
+ * Provides accessibility support for <code>JPanel</code>.
+ *
+ * @author Roman Kennke (roman@kennke.org)
+ */
+ protected class AccessibleJPanel extends AccessibleJComponent
+ {
+ /**
+ * Creates a new instance of <code>AccessibleJPanel</code>.
+ */
+ public AccessibleJPanel()
{
- this(new FlowLayout(),
- true);
+ // Nothing to do here.
}
-
- public JPanel(boolean double_buffered)
- {
- this(new FlowLayout(),
- double_buffered);
- }
-
- public JPanel(LayoutManager layout)
- {
- this(layout,
- true);
- }
-
-
- public JPanel(LayoutManager layout,
- boolean isDoubleBuffered)
- {
- if (layout == null)
- {
- System.err.println("NO LAYOUT SET !!!");
- layout = new FlowLayout();
- }
- setLayout(layout);
- setOpaque(true);
-
- updateUI();
- }
-
- public String getUIClassID()
- { return "PanelUI"; }
-
- public void setUI(PanelUI ui) {
- super.setUI(ui);
- }
-
- public PanelUI getUI() {
- return (PanelUI)ui;
- }
-
- public void updateUI() {
- setUI((PanelUI)UIManager.getUI(this));
- }
-
-
- public AccessibleContext getAccessibleContext()
+ /**
+ * Returns the accessible role for <code>JPanel</code>, which is
+ * {@link AccessibleRole#PANEL}.
+ *
+ * @return the accessible role for <code>JPanel</code>
+ */
+ public AccessibleRole getAccessibleRole()
{
- return null;
+ return AccessibleRole.PANEL;
}
+ }
+
+ public JPanel()
+ {
+ this(new FlowLayout(), true);
+ }
+
+ public JPanel(boolean double_buffered)
+ {
+ this(new FlowLayout(), double_buffered);
+ }
+
+ public JPanel(LayoutManager layout)
+ {
+ this(layout, true);
+ }
+
+ public JPanel(LayoutManager layout, boolean isDoubleBuffered)
+ {
+ if (layout == null)
+ {
+ // TODO: Is this correct? Or should we throw a NPE?
+ layout = new FlowLayout();
+ }
+ setLayout(layout);
+ setOpaque(true);
+
+ updateUI();
+ }
+
+ public String getUIClassID()
+ {
+ return "PanelUI";
+ }
+
+ public void setUI(PanelUI ui)
+ {
+ super.setUI(ui);
+ }
+
+ public PanelUI getUI()
+ {
+ return (PanelUI) ui;
+ }
+
+ public void updateUI()
+ {
+ setUI((PanelUI) UIManager.getUI(this));
+ }
+
+ public AccessibleContext getAccessibleContext()
+ {
+ if (accessibleContext == null)
+ accessibleContext = new AccessibleJPanel();
+ return accessibleContext;
+ }
- protected String paramString()
- {
+ protected String paramString()
+ {
return "JPanel";
- }
+ }
}