Exception when adding a component to a panel with CardLayout

XMLWordPrintable

    • Type: Bug
    • Resolution: Not an Issue
    • Priority: P2
    • None
    • Affects Version/s: 1.1, 1.1.6
    • Component/s: client-libs
    • None
    • generic, x86
    • generic, windows_95, windows_nt


      Here's a test case:

      public class Test extends Frame {
       
          java.awt.Panel panel1;
          java.awt.Label label1;
       
          public Test() {
              setLayout(null);
              addNotify();
              resize(insets().left + insets().right
                              + 405,insets().top + insets().bottom + 305);
              panel1 = new java.awt.Panel();
              panel1.setLayout(new CardLayout(0,0));
              panel1.reshape(insets().left + 48,insets().top + 36,295,129);
              add(panel1);
              label1 = new java.awt.Label("text");
              label1.reshape(0,0,295,129);
              panel1.add(label1);
              setTitle("A Basic Application");
          }
       
          static public void main(String args[]) {
              new Frame1();
          }
      }


      Here's the exception:

      java.lang.IllegalArgumentException: cannot add to layout: constraint must be a s
      tring
              at java.awt.CardLayout.addLayoutComponent(CardLayout.java:100)
              at java.awt.Container.addImpl(Container.java:278)
              at java.awt.Container.add(Container.java:152)
              at Frame1.<init>(Frame1.java:23)
              at Test.main(Test.java:25)

            Assignee:
            Jeff Dinkins
            Reporter:
            J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: