/[classpath]/classpath/javax/swing/JList.java
ViewVC logotype

Diff of /classpath/javax/swing/JList.java

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

revision 1.16.2.4 by gnu_andrew, Sun Jan 16 15:15:13 2005 UTC revision 1.16.2.5 by gnu_andrew, Thu Jan 27 09:45:34 2005 UTC
# Line 1  Line 1 
1  /* JList.java --  /* JList.java --
2     Copyright (C) 2002, 2003, 2004  Free Software Foundation, Inc.     Copyright (C) 2002, 2003, 2004, 2005  Free Software Foundation, Inc.
3    
4  This file is part of GNU Classpath.  This file is part of GNU Classpath.
5    
# Line 129  public class JList extends JComponent im Line 129  public class JList extends JComponent im
129     */     */
130    public static final int HORIZONTAL_WRAP = 2;    public static final int HORIZONTAL_WRAP = 2;
131    
   /** Fired in a PropertyChangeEvent when the "cellRenderer" property changes. */  
   public static final String CELL_RENDERER_PROPERTY_CHANGED = "cellRenderer";  
   
   /** Fired in a PropertyChangeEvent when the "fixedCellHeight" property changes. */  
   public static final String FIXED_CELL_HEIGHT_PROPERTY_CHANGED = "fixedCellHeight";  
   
   /** Fired in a PropertyChangeEvent when the "fixedCellWidth" property changes. */  
   public static final String FIXED_CELL_WIDTH_PROPERTY_CHANGED = "fixedCellWidth";  
   
   /** Fired in a PropertyChangeEvent when the "layoutOrientation" property changes. */  
   public static final String LAYOUT_ORIENTATION_PROPERTY_CHANGED = "layoutOrientation";  
   
   /** Fired in a PropertyChangeEvent when the "model" property changes. */  
   public static final String MODEL_PROPERTY_CHANGED = "model";  
   
   /** Fired in a PropertyChangeEvent when the "prototypeCellValue" property changes. */  
   public static final String PROTOTYPE_CELL_VALUE_PROPERTY_CHANGED = "prototypeCellValue";  
   
   /** Fired in a PropertyChangeEvent when the "selectionBackground" property changes. */  
   public static final String SELECTION_BACKGROUND_PROPERTY_CHANGED = "selectionBackground";  
   
   /** Fired in a PropertyChangeEvent when the "selectionForeground" property changes. */  
   public static final String SELECTION_FOREGROUND_PROPERTY_CHANGED = "selectionForeground";  
   
   /** Fired in a PropertyChangeEvent when the "selectionModel" property changes. */  
   public static final String SELECTION_MODEL_PROPERTY_CHANGED = "selectionModel";  
   
   
132    /**    /**
133     * This property indicates whether "drag and drop" functions are enabled     * This property indicates whether "drag and drop" functions are enabled
134     * on the list.     * on the list.
# Line 187  public class JList extends JComponent im Line 159  public class JList extends JComponent im
159     * is one of the integer constants {@link #VERTICAL}, {@link     * is one of the integer constants {@link #VERTICAL}, {@link
160     * #VERTICAL_WRAP}, or {@link #HORIZONTAL_WRAP}.     * #VERTICAL_WRAP}, or {@link #HORIZONTAL_WRAP}.
161     */     */
   
162    int layoutOrientation;    int layoutOrientation;
163        
164    /** This property holds the data elements displayed by the list. */    /** This property holds the data elements displayed by the list. */
# Line 406  public class JList extends JComponent im Line 377  public class JList extends JComponent im
377     */     */
378    public void setFixedCellHeight(int h)    public void setFixedCellHeight(int h)
379    {    {
380        if (fixedCellHeight == h)
381          return;
382    
383      int old = fixedCellHeight;      int old = fixedCellHeight;
384      fixedCellHeight = h;      fixedCellHeight = h;
385      firePropertyChange(FIXED_CELL_WIDTH_PROPERTY_CHANGED, old, h);      firePropertyChange("fixedCellWidth", old, h);
386    }    }
387    
388    
# Line 435  public class JList extends JComponent im Line 409  public class JList extends JComponent im
409     * #prototypeCellValue} property is set, but setting it explicitly     * #prototypeCellValue} property is set, but setting it explicitly
410     * overrides the width computed from {@link #prototypeCellValue}.     * overrides the width computed from {@link #prototypeCellValue}.
411     *     *
412     * @see #getFixedCellWidth     * @see #getFixedCellHeight
413     * @see #getPrototypeCellValue     * @see #getPrototypeCellValue
414     */     */
415    public void setFixedCellWidth(int h)    public void setFixedCellWidth(int w)
416    {    {
417      int old = fixedCellHeight;      if (fixedCellWidth == w)
418      fixedCellHeight = h;        return;
419      firePropertyChange(FIXED_CELL_HEIGHT_PROPERTY_CHANGED, old, h);      
420        int old = fixedCellWidth;
421        fixedCellWidth = w;
422        firePropertyChange("fixedCellWidth", old, w);
423    }    }
424    
   
425    /**    /**
426     * Gets the value of the {@link #visibleRowCount} property.     * Gets the value of the {@link #visibleRowCount} property.
427     *     *
# Line 735  public class JList extends JComponent im Line 711  public class JList extends JComponent im
711     */     */
712    public void setSelectionBackground(Color c)    public void setSelectionBackground(Color c)
713    {    {
714        if (selectionBackground == c)
715          return;
716    
717      Color old = selectionBackground;      Color old = selectionBackground;
718      selectionBackground = c;      selectionBackground = c;
719      firePropertyChange(SELECTION_BACKGROUND_PROPERTY_CHANGED, old, c);      firePropertyChange("selectionBackground", old, c);
720      repaint();      repaint();
721    }    }
722    
# Line 758  public class JList extends JComponent im Line 737  public class JList extends JComponent im
737     */     */
738    public void setSelectionForeground(Color c)    public void setSelectionForeground(Color c)
739    {    {
740        if (selectionForeground == c)
741          return;
742    
743      Color old = selectionForeground;      Color old = selectionForeground;
744      selectionForeground = c;      selectionForeground = c;
745      firePropertyChange(SELECTION_FOREGROUND_PROPERTY_CHANGED, old, c);      firePropertyChange("selectionForeground", old, c);
746    }    }
747    
748    /**    /**
# Line 871  public class JList extends JComponent im Line 853  public class JList extends JComponent im
853            
854      ListCellRenderer old = cellRenderer;      ListCellRenderer old = cellRenderer;
855      cellRenderer = renderer;      cellRenderer = renderer;
856      firePropertyChange(CELL_RENDERER_PROPERTY_CHANGED, old, renderer);      firePropertyChange("cellRenderer", old, renderer);
857      revalidate();      revalidate();
858      repaint();      repaint();
859    }    }
# Line 907  public class JList extends JComponent im Line 889  public class JList extends JComponent im
889      if (this.model != null)      if (this.model != null)
890        this.model.addListDataListener(listListener);        this.model.addListDataListener(listListener);
891            
892      firePropertyChange(MODEL_PROPERTY_CHANGED, old, model);      firePropertyChange("model", old, model);
893      revalidate();      revalidate();
894      repaint();      repaint();
895    }    }
# Line 939  public class JList extends JComponent im Line 921  public class JList extends JComponent im
921      if (selectionModel != null)      if (selectionModel != null)
922        selectionModel.addListSelectionListener(listListener);        selectionModel.addListSelectionListener(listListener);
923            
924      firePropertyChange(SELECTION_MODEL_PROPERTY_CHANGED, old, model);      firePropertyChange("selectionModel", old, model);
925      revalidate();      revalidate();
926      repaint();      repaint();
927    }    }
# Line 1019  public class JList extends JComponent im Line 1001  public class JList extends JComponent im
1001     */     */
1002    public void setPrototypeCellValue(Object obj)    public void setPrototypeCellValue(Object obj)
1003    {    {
1004        if (prototypeCellValue == obj)
1005          return;
1006    
1007      Object old = prototypeCellValue;      Object old = prototypeCellValue;
1008      Component comp = getCellRenderer()      Component comp = getCellRenderer()
1009        .getListCellRendererComponent(this, obj, 0, false, false);        .getListCellRendererComponent(this, obj, 0, false, false);
# Line 1026  public class JList extends JComponent im Line 1011  public class JList extends JComponent im
1011      fixedCellWidth = d.width;      fixedCellWidth = d.width;
1012      fixedCellHeight = d.height;      fixedCellHeight = d.height;
1013      prototypeCellValue = obj;      prototypeCellValue = obj;
1014      firePropertyChange(PROTOTYPE_CELL_VALUE_PROPERTY_CHANGED, old, obj);      firePropertyChange("prototypeCellValue", old, obj);
1015    }    }
1016    
1017    public AccessibleContext getAccessibleContext()    public AccessibleContext getAccessibleContext()

Legend:
Removed from v.1.16.2.4  
changed lines
  Added in v.1.16.2.5

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