On Fri, 2005-11-11 at 16:09 -0500, Lillian Angel wrote:
> On Thu, 2005-11-10 at 20:35 +0000, Roman Kennke wrote:
> > Hi,
> > 
> > I fixed some buggies in the BasicListUI. The fixed cell height and width
> > should now correctly be recognized. In addition to that I optimized the
> > painting so that only the cells within the clip bounds are painted. This
> > greatly improved performance when scrolling. This is really smooth now.
> > I'll implement a similar optimization for JTable, JTree and the text
> > components soon.
> > 
> > 2005-11-10  Roman Kennke  <[EMAIL PROTECTED]>
> > 
> >         * javax/swing/plaf/basic/BasicListUI.java
> >         (valueChanged): Repaint list when selection changed.
> >         (updateLayoutState): Reworked to correctly respect fixed cell
> > sizes.
> >         (installListeners): Create component listener before adding it.
> >         (paint): Optimized to only draw the cells in the clip.
> 

Also, attached is the same test case with a simple change. I put the
list inside a JScrollPane. When you scroll, your patch works, but the
painting is not reliable- the list disappears sometimes when scrolling.

Lillian
import java.awt.*;
import javax.swing.*;

public class MyList extends JFrame {

        private JList list;
        private JButton m_addButton;

        public MyList() {
                setTitle("Scrollable JList");

                Object[] items = {"aa", "aaa", "aaaa", "aaaaa", "aaaaa",
                "aaaaaa", "aaaaaaa", "aaaaaaaa", "aaaaaaaaa", "aaaaaaaaa",
                "b", "bb", "bbb", "bbbb", "bbbbb", "bbbbbb", "bbbbbbb"};
                list = new JList(items);
                JScrollPane scrollPane = new JScrollPane(list);
                getContentPane().add(scrollPane, BorderLayout.CENTER);

                pack();
                show();
        }

        public static void main(String[] args) {
                new MyList();
        }

}

_______________________________________________
Classpath-patches mailing list
Classpath-patches@gnu.org
http://lists.gnu.org/mailman/listinfo/classpath-patches

Reply via email to