swingx
  1. swingx
  2. SWINGX-1464

JXCollapsiblePane starts to flicker after adding an scrollable JEditorPane

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.6.1
    • Fix Version/s: None
    • Labels:
      None

      Description

      I would like to show/hide a JEditorPane having scrollable content.
      Additionally i want to limit the size of the JXCollapsiblePane.

      Here is a JUnit 4 test case to reproduce:

      CollapsiblePanelTest.java
      import static org.junit.Assert.fail;
      
      import java.awt.BorderLayout;
      import java.awt.Dimension;
      import java.awt.Font;
      import java.util.UUID;
      
      import javax.swing.JEditorPane;
      import javax.swing.JFrame;
      import javax.swing.JPanel;
      import javax.swing.JScrollPane;
      
      import org.jdesktop.swingx.JXCollapsiblePane;
      import org.jdesktop.swingx.JXCollapsiblePane.Direction;
      import org.junit.Test;
      
      public class CollapsiblePanelTest
      {
        @Test
        public void collapsiblePanelTest()
        {
          JFrame frame = new JFrame();
          frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
          frame.setPreferredSize(new Dimension(700, 500));
          frame.setLayout(new BorderLayout());
          frame.add(new TestPanel());
          frame.pack();
          frame.setVisible(true);
      
          while (frame.isVisible())
          {
            try
            {
              Thread.sleep(1000);
            }
            catch (InterruptedException e)
            {
              fail();
            }
          }
        }
      
        public static class TestPanel extends JPanel
        {
          public TestPanel()
          {
            setPreferredSize(new Dimension(300, 500));
      
            JEditorPane pane1 = new JEditorPane();
            pane1.setPreferredSize(new Dimension(300, 100));
            pane1.setFont(new Font("Monospaced", Font.PLAIN, 12));
            insertText(pane1);
      
            JXCollapsiblePane collPane = new JXCollapsiblePane(Direction.DOWN);
            collPane.getContentPane().add(new JScrollPane(pane1));
      
            add(collPane);
          }
      
          private void insertText(JEditorPane pane)
          {
            StringBuilder builder = new StringBuilder();
            for ( int i = 0; i < 20; i++ )
            {
              builder.append(UUID.randomUUID());
              builder.append("\n");
            }
            pane.setText(builder.toString());
          }
        }
      }
      

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Karl Schaefer
            Reporter:
            michael.kuettner
          • Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated: