diff options
author | Mark Wielaard <mark@gcc.gnu.org> | 2005-11-15 23:20:01 +0000 |
---|---|---|
committer | Mark Wielaard <mark@gcc.gnu.org> | 2005-11-15 23:20:01 +0000 |
commit | 8f523f3a1047919d3563daf1ef47ba87336ebe89 (patch) | |
tree | a5eb7cf42a51869cc8aa1fad7ad6a90cca47fdd8 /libjava/classpath/javax/swing/JPanel.java | |
parent | 02e549bfaaec38f68307e7f34e46ea57ea1809af (diff) | |
download | gcc-8f523f3a1047919d3563daf1ef47ba87336ebe89.zip gcc-8f523f3a1047919d3563daf1ef47ba87336ebe89.tar.gz gcc-8f523f3a1047919d3563daf1ef47ba87336ebe89.tar.bz2 |
Imported GNU Classpath 0.19 + gcj-import-20051115.
* sources.am: Regenerated.
* Makefile.in: Likewise.
* scripts/makemake.tcl: Use glob -nocomplain.
From-SVN: r107049
Diffstat (limited to 'libjava/classpath/javax/swing/JPanel.java')
-rw-r--r-- | libjava/classpath/javax/swing/JPanel.java | 132 |
1 files changed, 80 insertions, 52 deletions
diff --git a/libjava/classpath/javax/swing/JPanel.java b/libjava/classpath/javax/swing/JPanel.java index c7f7c44..7805e92 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"; - } + } } |