bug-classpath
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Bug classpath/22961] awt: GridBagLayout.addLayoutComponent throws Illeg


From: gcc-bugzilla at gcc dot gnu dot org
Subject: [Bug classpath/22961] awt: GridBagLayout.addLayoutComponent throws IllegalArgumentException
Date: 16 Oct 2005 01:27:47 -0000

Steps to reproduce:
1. Compile and run the attached testcase

Expected results (sun's java 1.5.0):
1. A window shows up. It has filechooser components and "label0" below them.

Actual results (classpath 2005-05-30):
1. No window is shown and the following exception is thrown:
java.lang.IllegalArgumentException
   at java.awt.GridBagLayout.addLayoutComponent (GridBagLayout.java:132)
   at java.awt.Container.addImpl (Container.java:382)
   at java.awt.Container.add (Container.java:290)
   at gridbag.<init> (gridbag.java:11)
   at gridbag.main (gridbag.java:6)

Testcase:
import javax.swing.*;
import java.io.*;
import java.awt.BorderLayout;
public class gridbag extends JFrame {
        public static void main(String[] args) {
                (new gridbag()).show();
        }
        public gridbag() {
                JFileChooser fileChooser = new JFileChooser();
                JLabel label = new JLabel("label0");
                fileChooser.add(label, BorderLayout.SOUTH);
                fileChooser.showOpenDialog(this);
        }
}

I am not sure if this is a bug. 
http://java.sun.com/j2se/1.4.2/docs/api/java/awt/GridBagLayout.html#addLayoutComponent(java.awt.Component,
java.lang.Object) suggests that the exception must be thrown but sun's own java
does not seem to do that. Should we
1) make classpath not throw the exception and violate the javadoc
or
2) try to fix all free software projects that depend on the incorrect behavior?


------- Comment #1 from from-classpath at savannah dot gnu dot org  2005-05-31 
18:23 -------
Sorry, I just realized that maybe Sun's java does not use GridBagLayout at all
for JFileChooser. I am not sure but I think classpath shouldn't use
GridBagLayout either because
1) JFileChooser.add() should accept _any_ constraints.
2) GridBagLayout should accept _only_ GridBagConstraints.

Is it possible to retitle this bug to
"swing: JFileChooser should not use GridBagLayout" or do I just need to report
a new one?


------- Comment #2 from from-classpath at savannah dot gnu dot org  2005-05-31 
20:39 -------
You can leave this bug as it is. I will take care of this.


------- Comment #3 from from-classpath at savannah dot gnu dot org  2005-06-01 
11:10 -------
A fix for this is checked in. Please test and close this bug.


------- Comment #4 from from-classpath at savannah dot gnu dot org  2005-06-01 
11:27 -------
Thanks, seems to work now.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=22961





reply via email to

[Prev in Thread] Current Thread [Next in Thread]