/** * returns the checked state of the element at the given index * * @param index the index of the element to return the checked state for * @return the checked state of the specifed element */ public boolean getChecked(int index) { return ((CheckBoxListModel) getModel()).getChecked(index); }
/** * sets the checked state of the element at the given index * * @param index the index of the element to set the checked state for * @param checked the new checked state */ public void setChecked(int index, boolean checked) { ((CheckBoxListModel) getModel()).setChecked(index, checked); }
/** * returns the checked state of the element at the given index * * @param index the index of the element to return the checked state for * @return the checked state of the specifed element */ public boolean getChecked(int index) { return ((CheckBoxListModel) getModel()).getChecked(index); }
/** * sets the checked state of the element at the given index * * @param index the index of the element to set the checked state for * @param checked the new checked state */ public void setChecked(int index, boolean checked) { ((CheckBoxListModel) getModel()).setChecked(index, checked); }
/** * returns an array with the indices of all checked items * * @return the indices of all items that are currently checked */ public int[] getCheckedIndices() { Vector<Integer> list; int[] result; int i; // traverse over model list = new Vector<Integer>(); for (i = 0; i < getModel().getSize(); i++) { if (getChecked(i)) { list.add(new Integer(i)); } } // generate result array result = new int[list.size()]; for (i = 0; i < list.size(); i++) { result[i] = list.get(i).intValue(); } return result; } }
/** * returns an array with the indices of all checked items * * @return the indices of all items that are currently checked */ public int[] getCheckedIndices() { Vector<Integer> list; int[] result; int i; // traverse over model list = new Vector<Integer>(); for (i = 0; i < getModel().getSize(); i++) { if (getChecked(i)) { list.add(new Integer(i)); } } // generate result array result = new int[list.size()]; for (i = 0; i < list.size(); i++) { result[i] = list.get(i).intValue(); } return result; } }
model = (CheckBoxListModel) m_List.getModel(); for (Capability cap : Capability.values()) { model.addElement(cap);
model = (CheckBoxListModel) m_List.getModel(); for (Capability cap : Capability.values()) { model.addElement(cap);
/** * transfers the Capabilities object to the JList. * * @see #m_Capabilities * @see #m_List */ protected void updateList() { CheckBoxListModel model; model = (CheckBoxListModel) m_List.getModel(); for (Capability cap : Capability.values()) { model.setChecked(model.indexOf(cap), m_Capabilities.handles(cap)); } }
/** * transfers the Capabilities object to the JList. * * @see #m_Capabilities * @see #m_List */ protected void updateList() { CheckBoxListModel model; model = (CheckBoxListModel) m_List.getModel(); for (Capability cap : Capability.values()) { model.setChecked(model.indexOf(cap), m_Capabilities.handles(cap)); } }
/** * transfers the selected Capabilities from the JList to the Capabilities * object. * * @see #m_Capabilities * @see #m_List */ protected void updateCapabilities() { CheckBoxListModel model; model = (CheckBoxListModel) m_List.getModel(); for (Capability cap : Capability.values()) { if (model.getChecked(model.indexOf(cap))) { m_Capabilities.enable(cap); } else { m_Capabilities.disable(cap); } } }
/** * transfers the selected Capabilities from the JList to the Capabilities * object. * * @see #m_Capabilities * @see #m_List */ protected void updateCapabilities() { CheckBoxListModel model; model = (CheckBoxListModel) m_List.getModel(); for (Capability cap : Capability.values()) { if (model.getChecked(model.indexOf(cap))) { m_Capabilities.enable(cap); } else { m_Capabilities.disable(cap); } } }