/[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.20 by mkoch, Fri Oct 22 12:43:59 2004 UTC revision 1.21 by mkoch, Fri Nov 26 20:48:40 2004 UTC
# Line 250  public class JList extends JComponent im Line 250  public class JList extends JComponent im
250     */     */
251    int visibleRowCount;    int visibleRowCount;
252    
   
   
253    /**    /**
254     * Fire a {@link ListSelectionEvent} to all the registered ListSelectionListeners.     * Fire a {@link ListSelectionEvent} to all the registered ListSelectionListeners.
255     */     */
256    void fireSelectionValueChanged(int firstIndex, int lastIndex, boolean isAdjusting)    protected void fireSelectionValueChanged(int firstIndex, int lastIndex, boolean isAdjusting)
257    {    {
258      ListSelectionEvent evt = new ListSelectionEvent(this, firstIndex, lastIndex, isAdjusting);      ListSelectionEvent evt = new ListSelectionEvent(this, firstIndex, lastIndex, isAdjusting);
259      ListSelectionListener listeners[] = getListSelectionListeners();      ListSelectionListener listeners[] = getListSelectionListeners();
# Line 265  public class JList extends JComponent im Line 263  public class JList extends JComponent im
263        }        }
264    }    }
265    
   
266    /**    /**
267     * This private listener propagates {@link ListSelectionEvent} events     * This private listener propagates {@link ListSelectionEvent} events
268     * from the list's "selectionModel" property to the list's {@link     * from the list's "selectionModel" property to the list's {@link
# Line 365  public class JList extends JComponent im Line 362  public class JList extends JComponent im
362      listListener = new ListListener();      listListener = new ListListener();
363    
364      setModel(new DefaultListModel());      setModel(new DefaultListModel());
365      setSelectionModel(new DefaultListSelectionModel());      setSelectionModel(createSelectionModel());
366    
367      updateUI();      updateUI();
368    }    }
369    
370    /**    /**
371       * Creates the default <code>ListSelectionModel</code>.
372       *
373       * @return the <code>ListSelectionModel</code>
374       */
375      protected ListSelectionModel createSelectionModel()
376      {
377        return new DefaultListSelectionModel();
378      }
379      
380      /**
381     * Gets the value of the {@link #fixedCellHeight} property. This property     * Gets the value of the {@link #fixedCellHeight} property. This property
382     * may be <code>-1</code> to indicate that no cell height has been     * may be <code>-1</code> to indicate that no cell height has been
383     * set. This property is also set implicitly when the     * set. This property is also set implicitly when the
# Line 501  public class JList extends JComponent im Line 508  public class JList extends JComponent im
508      return (ListSelectionListener[]) getListeners(ListSelectionListener.class);      return (ListSelectionListener[]) getListeners(ListSelectionListener.class);
509    }    }
510    
511      public int getSelectionMode()
512      {
513        return selectionModel.getSelectionMode();
514      }
515      
516    /**    /**
517     * Sets the list's "selectionMode" property, which simply mirrors the     * Sets the list's "selectionMode" property, which simply mirrors the
518     * same property on the list's {@link #selectionModel} property. This     * same property on the list's {@link #selectionModel} property. This
# Line 1196  public class JList extends JComponent im Line 1208  public class JList extends JComponent im
1208    {    {
1209      return false;      return false;
1210    }    }
1211    
1212      public int getAnchorSelectionIndex()
1213      {
1214        return selectionModel.getAnchorSelectionIndex();
1215      }
1216    
1217      public int getLeadSelectionIndex()
1218      {
1219        return selectionModel.getLeadSelectionIndex();
1220      }
1221    
1222      public int getMinSelectionIndex()
1223      {
1224        return selectionModel.getMaxSelectionIndex();
1225      }
1226    
1227      public int getMaxSelectionIndex()
1228      {
1229        return selectionModel.getMaxSelectionIndex();
1230      }
1231    
1232      public void clearSelection()
1233      {
1234        selectionModel.clearSelection();
1235      }
1236    
1237      public void setSelectionInterval(int anchor, int lead)
1238      {
1239        selectionModel.setSelectionInterval(anchor, lead);
1240      }
1241    
1242      public void addSelectionInterval(int anchor, int lead)
1243      {
1244        selectionModel.addSelectionInterval(anchor, lead);
1245      }
1246    
1247      public void removeSelectionInterval(int index0, int index1)
1248      {
1249        selectionModel.removeSelectionInterval(index0, index1);
1250      }
1251    
1252      /**
1253       * Returns the value of the <code>valueIsAdjusting</code> property.
1254       *
1255       * @return the value
1256       */
1257      public boolean getValueIsAdjusting()
1258      {
1259        return valueIsAdjusting;
1260      }
1261    
1262      /**
1263       * Sets the <code>valueIsAdjusting</code> property.
1264       *
1265       * @param isAdjusting the new value
1266       */
1267      public void setValueIsAdjusting(boolean isAdjusting)
1268      {
1269        valueIsAdjusting = isAdjusting;
1270      }
1271    
1272      /**
1273       * Return the value of the <code>dragEnabled</code> property.
1274       *
1275       * @return the value
1276       *
1277       * @since 1.4
1278       */
1279      public boolean getDragEnabled()
1280      {
1281        return dragEnabled;
1282      }
1283    
1284      /**
1285       * Set the <code>dragEnabled</code> property.
1286       *
1287       * @param enabled new value
1288       *
1289       * @since 1.4
1290       */
1291      public void setDragEnabled(boolean enabled)
1292      {
1293        dragEnabled = enabled;
1294      }
1295    
1296      /**
1297       * Returns the layout orientation.
1298       *
1299       * @return the orientation, one of <code>JList.VERTICAL</code>,
1300       * </code>JList.VERTICAL_WRAP</code> and <code>JList.HORIZONTAL_WRAP</code>
1301       *
1302       * @since 1.4
1303       */
1304      public int getLayoutOrientation()
1305      {
1306        return layoutOrientation;
1307      }
1308    
1309      /**
1310       * Sets the layout orientation.
1311       *
1312       * @param orientation the orientation to set, one of <code>JList.VERTICAL</code>,
1313       * </code>JList.VERTICAL_WRAP</code> and <code>JList.HORIZONTAL_WRAP</code>
1314       *
1315       * @since 1.4
1316       */
1317      public void setLayoutOrientation(int orientation)
1318      {
1319        if (layoutOrientation == orientation)
1320          return;
1321    
1322        int old = layoutOrientation;
1323        layoutOrientation = orientation;
1324        firePropertyChange("layoutOrientation", old, orientation);
1325      }
1326  }  }

Legend:
Removed from v.1.20  
changed lines
  Added in v.1.21

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