java.lang.Object
java.awt.Component
java.awt.List
- All Implemented Interfaces:
- ImageObserver, ItemSelectable, MenuContainer, Serializable, Accessible
- See Also:
- Top Examples
public void add(String item)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void add(String item,
int index)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void addActionListener(ActionListener l)
- See Also:
-
ActionEvent
, getActionListeners()
, removeActionListener(java.awt.event.ActionListener)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
@Deprecated
public void addItem(String item)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
@Deprecated
public void addItem(String item,
int index)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void addItemListener(ItemListener l)
- See Also:
-
ItemEvent
, deselect(int)
, select(int)
, getItemListeners()
, removeItemListener(java.awt.event.ItemListener)
, ItemSelectable
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void addNotify()
- See Also:
Component.removeNotify()
, Component.isDisplayable()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
@Deprecated
public boolean allowsMultipleSelections()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
@Deprecated
public void clear()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
@Deprecated
public int countItems()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
@Deprecated
public void delItem(int position)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
@Deprecated
public void delItems(int start,
int end)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void deselect(int index)
- See Also:
isIndexSelected(int)
, getSelectedItem()
, select(int)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public AccessibleContext getAccessibleContext()
- See Also:
- Component, Accessible
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public ActionListener[] getActionListeners()
- See Also:
-
ActionEvent
, removeActionListener(java.awt.event.ActionListener)
, addActionListener(java.awt.event.ActionListener)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public String getItem(int index)
- See Also:
getItemCount()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public int getItemCount()
- See Also:
getItem(int)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public ItemListener[] getItemListeners()
- See Also:
-
ItemEvent
, removeItemListener(java.awt.event.ItemListener)
, addItemListener(java.awt.event.ItemListener)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public String[] getItems()
- See Also:
isIndexSelected(int)
, deselect(int)
, select(int)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public <T extends EventListener> T[] getListeners(Class<T> listenerType)
- See Also:
getItemListeners()
, ClassCastException, Component
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public Dimension getMinimumSize()
- See Also:
- Component
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public Dimension getMinimumSize(int rows)
- See Also:
Component.getMinimumSize()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public Dimension getPreferredSize()
- See Also:
- Component
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public Dimension getPreferredSize(int rows)
- See Also:
Component.getPreferredSize()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public int getRows()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public int getSelectedIndex()
- See Also:
isIndexSelected(int)
, deselect(int)
, select(int)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public int[] getSelectedIndexes()
- See Also:
isIndexSelected(int)
, deselect(int)
, select(int)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public String getSelectedItem()
- See Also:
isIndexSelected(int)
, deselect(int)
, select(int)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public String[] getSelectedItems()
- See Also:
isIndexSelected(int)
, deselect(int)
, select(int)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public Object[] getSelectedObjects()
- See Also:
ItemSelectable
, getSelectedItems()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public int getVisibleIndex()
- See Also:
makeVisible(int)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public boolean isIndexSelected(int index)
- See Also:
deselect(int)
, select(int)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public boolean isMultipleMode()
- See Also:
setMultipleMode(boolean)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
@Deprecated
public boolean isSelected(int index)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public List()
throws HeadlessException
- See Also:
GraphicsEnvironment.isHeadless()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public List(int rows)
throws HeadlessException
- See Also:
GraphicsEnvironment.isHeadless()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public List(int rows,
boolean multipleMode)
throws HeadlessException
- See Also:
GraphicsEnvironment.isHeadless()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void makeVisible(int index)
- See Also:
getVisibleIndex()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
@Deprecated
public Dimension minimumSize()
- See Also:
- Component
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
@Deprecated
public Dimension minimumSize(int rows)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected String paramString()
- See Also:
- Component
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
@Deprecated
public Dimension preferredSize()
- See Also:
- Component
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
@Deprecated
public Dimension preferredSize(int rows)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected void processActionEvent(ActionEvent e)
- See Also:
Component.enableEvents(long)
, addActionListener(java.awt.event.ActionListener)
, ActionListener
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected void processEvent(AWTEvent e)
- See Also:
processItemEvent(java.awt.event.ItemEvent)
, processActionEvent(java.awt.event.ActionEvent)
, ItemEvent
, ActionEvent
, Component
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
protected void processItemEvent(ItemEvent e)
- See Also:
Component.enableEvents(long)
, addItemListener(java.awt.event.ItemListener)
, ItemListener
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void remove(int position)
- See Also:
add(String, int)
, ArrayIndexOutOfBoundsException
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void remove(String item)
- See Also:
- IllegalArgumentException
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void removeActionListener(ActionListener l)
- See Also:
-
ActionEvent
, getActionListeners()
, addActionListener(java.awt.event.ActionListener)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void removeAll()
- See Also:
delItems(int, int)
, remove(java.lang.String)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void removeItemListener(ItemListener l)
- See Also:
-
ItemEvent
, getItemListeners()
, addItemListener(java.awt.event.ItemListener)
, ItemSelectable
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void removeNotify()
- See Also:
Component.addNotify()
, Component.isDisplayable()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void replaceItem(String newValue,
int index)
- See Also:
- ArrayIndexOutOfBoundsException
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
[1452]How to change the color of a text in a list box??
By shaahul21 { at } sify { dot } com on 2005/06/17 02:43:34 Rate
import java.io.*;
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.ListCellRenderer.*;
public class change extends Applet
{
public change ( )
{ super ( ) ; }
//public boolean mouseclicked = false;
public void init ( )
{ setBackground ( Color.white ) ;
setForeground ( Color.red ) ;
try
{ setLayout ( null ) ;
DrawPanel drawpanel=new DrawPanel ( ) ;
add ( drawpanel ) ;
}
catch ( Exception e ) { }
}
public void start ( ) { }
public void stop ( ) { }
}
class DrawPanel extends Panel// implements ItemListener
{
List c;
int index;
public String selection,selected;
public String getSelectedItem ( )
{
selected=c.getSelectedItem ( setBackground ( Color.blue ) ) ;
return selected;
}
public int getSelectedIndex ( )
{
index=c.getSelectedIndex ( ) ;
return index;
}
public void replaceItem ( String selected,int index )
{
selection.setBackground ( Color.cyan ) ;
selection.setFont ( new Font ( "Roman",Font.ITALIC,38 ) ) ;
repaint ( ) ;
return ( this ) ;
}
public DrawPanel ( )
{ setBounds ( 0,150,500,500 ) ;
setBackground ( Color.orange ) ;
setForeground ( Color.yellow ) ;
List c = new List ( ) ;
c.addItem ( "A" ) ;
c.addItem ( "B" ) ;
c.addItem ( "C" ) ;
c.addItem ( "D" ) ;
c.addItem ( "E" ) ;
c.addItem ( "F" ) ;
c.addItem ( "G" ) ;
c.addItem ( "H" ) ;
c.addItem ( "I" ) ;
c.addItem ( "J" ) ;
c.addItem ( "K" ) ;
add ( "center",c ) ;
}
public void paint ( Graphics g ) { }
}
note:i want to change the color of a text in a list box through replaceItem ( ) method but i am getting a error of missing return statement.if i give a return statement then it points that void type should not be allowed here.
public void select(int index)
- See Also:
isIndexSelected(int)
, getSelectedItem()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
public void setMultipleMode(boolean b)
- See Also:
isMultipleMode()
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples
@Deprecated
public void setMultipleSelections(boolean b)
- Geek's Notes:
- Description Add your codes or notes Search More Java Examples