/[classpath]/classpath/javax/swing/plaf/basic/BasicListUI.java
ViewVC logotype

Diff of /classpath/javax/swing/plaf/basic/BasicListUI.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.10 by mkoch, Fri Oct 22 12:44:00 2004 UTC revision 1.11 by rabbit78, Sat Feb 26 17:10:41 2005 UTC
# Line 44  import java.awt.Dimension; Line 44  import java.awt.Dimension;
44  import java.awt.Graphics;  import java.awt.Graphics;
45  import java.awt.Point;  import java.awt.Point;
46  import java.awt.Rectangle;  import java.awt.Rectangle;
47    import java.awt.event.ComponentAdapter;
48    import java.awt.event.ComponentEvent;
49    import java.awt.event.ComponentListener;
50  import java.awt.event.FocusEvent;  import java.awt.event.FocusEvent;
51  import java.awt.event.FocusListener;  import java.awt.event.FocusListener;
52  import java.awt.event.MouseEvent;  import java.awt.event.MouseEvent;
# Line 71  import javax.swing.plaf.ListUI; Line 74  import javax.swing.plaf.ListUI;
74   */   */
75  public class BasicListUI extends ListUI  public class BasicListUI extends ListUI
76  {  {
77    
78      /**
79       * A helper class which listens for {@link ComponentEvent}s from
80       * the JList.
81       */
82      class ComponentHandler extends ComponentAdapter {
83    
84        /**
85         * Called when the component is hidden. Invalidates the internal
86         * layout.
87         */
88        public void componentResized(ComponentEvent ev) {
89          BasicListUI.this.damageLayout();
90        }
91      }
92    
93    /**    /**
94     * A helper class which listens for {@link FocusEvents}     * A helper class which listens for {@link FocusEvents}
95     * from the JList.     * from the JList.
# Line 296  public class BasicListUI extends ListUI Line 315  public class BasicListUI extends ListUI
315    /** The property change listener listening to the list. */    /** The property change listener listening to the list. */
316    PropertyChangeHandler propertyChangeListener;    PropertyChangeHandler propertyChangeListener;
317    
318      /** The component listener that receives notification for resizing the
319       * JList component.*/
320      ComponentListener componentListener;
321    
322    /** Saved reference to the list this UI was created for. */    /** Saved reference to the list this UI was created for. */
323    JList list;    JList list;
324    
# Line 437  public class BasicListUI extends ListUI Line 460  public class BasicListUI extends ListUI
460              Dimension dim = flyweight.getPreferredSize();              Dimension dim = flyweight.getPreferredSize();
461              cellHeights[i] = dim.height;              cellHeights[i] = dim.height;
462              cellWidth = Math.max(cellWidth, dim.width);              cellWidth = Math.max(cellWidth, dim.width);
463                cellWidth = Math.max(cellWidth, list.getSize().width);
464            }            }
465        }        }
466      else      else
# Line 481  public class BasicListUI extends ListUI Line 505  public class BasicListUI extends ListUI
505      listSelectionListener = new ListSelectionHandler();      listSelectionListener = new ListSelectionHandler();
506      mouseInputListener = new MouseInputHandler();      mouseInputListener = new MouseInputHandler();
507      propertyChangeListener = new PropertyChangeHandler();      propertyChangeListener = new PropertyChangeHandler();
508        componentListener = new ComponentHandler();
509      updateLayoutStateNeeded = 1;      updateLayoutStateNeeded = 1;
510    }    }
511    
# Line 527  public class BasicListUI extends ListUI Line 552  public class BasicListUI extends ListUI
552      list.addMouseListener(mouseInputListener);      list.addMouseListener(mouseInputListener);
553      list.addMouseMotionListener(mouseInputListener);      list.addMouseMotionListener(mouseInputListener);
554      list.addPropertyChangeListener(propertyChangeListener);      list.addPropertyChangeListener(propertyChangeListener);
555        list.addComponentListener(componentListener);
556    }    }
557    
558    /**    /**

Legend:
Removed from v.1.10  
changed lines
  Added in v.1.11

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26