Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6957130

Addint Component to JSplitPane and to CardLayout panel doesn't work

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P4 P4
    • None
    • 6u19
    • client-libs

      FULL PRODUCT VERSION :
      java version "1.6.0_19"
      Java(TM) SE Runtime Environment (build 1.6.0_19-b04)
      Java HotSpot(TM) 64-Bit Server VM (build 16.2-b04, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows [Version 6.1.7600]

      A DESCRIPTION OF THE PROBLEM :
      When adding a component to a JSplitPane and then to a JPanel using the CardLayout, the JSplitPane no longer contains the added component.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Run the attached source code.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      Having the "rightPane" visible in the "splitPane" as well as the "panel".
      ACTUAL -
      The "rightPane" is only visible when displaying "CardB". When displaying "CardA" the SplitPane only displays the LeftComponent, and the splitter is all the way to the right and cannot be moved as though the rightComponent has become null.

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import java.awt.*;
      import javax.swing.*;

      public class AppFrame extends JFrame
      {
      public AppFrame()
      {
      JPanel rightPane = new JPanel();
      JSplitPane splitPane = new JSplitPane (JSplitPane.
      HORIZONTAL_SPLIT, new JPanel(), rightPane);

      CardLayout cardLayout = new CardLayout();
      JPanel panel = new JPanel (cardLayout);
      panel.add (splitPane, "CardA");
      panel.add (rightPane, "CardB");

      setLayout (new BorderLayout());
      add (panel, BorderLayout.CENTER);

      setSize (640, 480);
      setVisible (true);
      }

      public static void main (String ... args)
      {
      new AppFrame();
      }
      }
      ---------- END SOURCE ----------

            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: