Abstract Interface ItemSelectable in Java

0
25
Spread the love
  • 28
  • 34
  • 56
  • 35
  •  
  •  
  •  
  • 12
  •  
  •  
    165
    Shares

Abstract Interface ItemSelectable in Java

An interface that describes an object that has one or more items that can be selected.

The structure of the Abstract Interface ItemSelectable is given by

public abstract interface ItemSelectable {
// Instance Methods
public abstract void addItemListener (ItemListener l);
public abstract Object[] getSelectedObjects();
public abstract void removeItemListener (ItemListener l);
}

The details of the class structure are given as follows:

public abstract void addItemListener (ItemListener l);

public abstract void addItemListener (ItemListener l) method adds a listener for ItemEvent objects.

Parameter
l – The listener to be added.

public abstract Object[] getSelectedObjects();

public abstract Object[] getSelectedObjects() method returns returns an array containing Objects representing the items that are currently selected. If no items are selected, null is returned.

This method returns returns an array containing Objects representing the items that are currently selected. If no items are selected, null is returned.

public abstract void removeItemListener (ItemListener l);

public abstract void removeItemListener (ItemListener l) method removes the specified ItemListener so it will not receive ItemEvent objects.

Parameter
l – The listener to be removed.

Don't miss out!
Subscribe To Newsletter

Receive top technical news, lesson ideas, travel tips and more!

Invalid email address
Give it a try. You can unsubscribe at any time.

Spread the love
  • 28
  • 34
  • 56
  • 35
  •  
  •  
  •  
  • 12
  •  
  •  
    165
    Shares

LEAVE A REPLY

Please enter your comment!
Please enter your name here