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

REGRESSION: Container + Jtable problem table is cut in the middle

    XMLWordPrintable

Details

    • Bug
    • Resolution: Not an Issue
    • P3
    • None
    • 5.0
    • client-libs
    • x86
    • windows_xp

    Description

      FULL PRODUCT VERSION :
      java version "1.5.0_01"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_01-b08)
      Java HotSpot(TM) Client VM (build 1.5.0_01-b08, mixed mode, sharing)

      ADDITIONAL OS VERSION INFORMATION :
      Microsoft Windows XP [Version 5.1.2600]

      A DESCRIPTION OF THE PROBLEM :
      the table is cutting in the middle and cann't return to it's original size by itself.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Looking in this code everything seems to look ok and also working fine...
      till you have a situation of 3 or 2 tables open and you clicking a row on first or second table
      (the one that is upstairs)... and then you try to close the tables back.


      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      I wanted to see the first table as is when I am closing the other.
      ACTUAL -
      The table cut itself and cann't be seen as I wanted

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      no Error Message

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      import javax.swing.*;
      import javax.swing.table.*;
      import javax.swing.border.*;
      import java.awt.*;
      import java.awt.event.*;

      public class jtest extends JFrame{

      public JButton closeButton;
      public JButton openButton;
      public JScrollPane sp;
      public JScrollPane sp1;
      public JScrollPane sp2;
      public int Counter;
      public jtest()
      {
      setBounds(0,0,790,495);
      setTitle("test");
      closeButton = new JButton("closeDetails");
      openButton = new JButton("openDetails");
      closeButton.setEnabled(false);
      openButton.setEnabled(true);

      Container contentPane = getContentPane();
      contentPane.setLayout(null);

      JTable jt = new JTable(new String[][] {
                                     {"This", "is"}, {"a", "Test"}},
                                 new String[] {"Column", "Header"});
      JTable jt1 = new JTable(new String[][] {
                                     {"This", "is"}, {"a", "Test1"}},
                                 new String[] {"Column1", "Header1"});
      JTable jt2 = new JTable(new String[][] {
                                     {"This", "is"}, {"a", "Test2"}},
                                 new String[] {"Column2", "Header2"});
      JScrollPane jsp = new JScrollPane(jt);
      sp = new JScrollPane(jt);
        sp1 = new JScrollPane(jt1);
        sp2 = new JScrollPane(jt2);
        sp.getViewport().setBackground(Color.white);
      sp1.getViewport().setBackground(Color.green);
      sp2.getViewport().setBackground(Color.blue);
      getContentPane().add(sp);
              Insets insets = contentPane.getInsets();
      sp.setBounds(0,0,781,420);

              JPanel p = new JPanel();
           p.setLayout(new BoxLayout(p, BoxLayout.X_AXIS));
      JPanel ButtonsPanel = new JPanel();


      ActionListener openListener = new ActionListener() {
           public void actionPerformed(ActionEvent e) {
      System.out.println(Counter);
      if(Counter==0)
      {
      closeButton.setEnabled(true);
      getContentPane().add(sp);
      getContentPane().add(sp1);
      sp1.setBounds(0,38*(Counter+1),781,420-(38*(Counter+1)));
      sp.setBounds(0,0,781,38);
      repaint();
      Counter++;
      }
      else
      {
      openButton.setEnabled(false);
      getContentPane().add(sp1);
      getContentPane().add(sp2);
      sp2.setBounds(0,38*(Counter+1),781,420-(38*(Counter+1)));
      sp1.setBounds(0,38*Counter,781,38);
      repaint();
      Counter++;
      }
      }
      };
      ActionListener closeListener = new ActionListener() {
           public void actionPerformed(ActionEvent e)
      {
      System.out.println(Counter);
      if(Counter==1)
      {
      Counter--;
      closeButton.setEnabled(false);
      getContentPane().add(sp);
      getContentPane().add(sp1);
      sp1.setBounds(0,0,0,0);
      sp.setBounds(0,0,781,460);
      repaint();
      }
      else
      {
      Counter--;
      openButton.setEnabled(true);
      getContentPane().add(sp2);
      getContentPane().add(sp1);
      sp2.setBounds(0,0,0,0);
      sp1.setBounds(0,38*(Counter),781,420-(38*(Counter)));
      repaint();
      }
      }
           };
           openButton.addActionListener(openListener);
          ButtonsPanel.add(openButton);
      closeButton.addActionListener(closeListener);
          ButtonsPanel.add(closeButton);
      p.add(ButtonsPanel);

             getContentPane().add(p);
      p.setBounds(0,420,781,40);
      }
      public static void main(String args[])
      {
           try
           {
      jtest main = new jtest();
      main.setVisible(true);
      }
      catch(Exception e){}
      }
      }
      ---------- END SOURCE ----------

      Release Regression From : 1.4.2_07
      The above release value was the last known release where this
      bug was known to work. Since then there has been a regression.
      ###@###.### 2005-05-05 11:44:25 GMT

      Attachments

        Issue Links

          Activity

            People

              dav Andrei Dmitriev (Inactive)
              ndcosta Nelson Dcosta (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:
                Imported:
                Indexed: