L
Last Timer
I'm following Swing 2nd edition book by Mathew Robinson and Pavel
Vorobiev. On pg 243 the code looks as followS:
CarComboModel model=new CarComboBoxModel(cars) // cars is a vector
m_cbCars=new JComboBox(model);
m_cbCars.setRenderer=new IconComboRenderer();
.....
class CarComboModel extends DefaultComboBoxModel {...}
class IconComboRenderer extends JLabel implements ListCellRenderer
{
....
}
public component getListCellRendererComponent (JList list, object obj,
int row, boolean sel, boolean hasFocus) {
....
}
public void paint (Graphics g) {...}
I have these basic questions:
a)why there is public component getListCellRendererCombonent?
b)is the method signature of getListCellRenderedComponent (is it a
method?) specified by the Swing developers?
Many Thanks for your answers.
Vorobiev. On pg 243 the code looks as followS:
CarComboModel model=new CarComboBoxModel(cars) // cars is a vector
m_cbCars=new JComboBox(model);
m_cbCars.setRenderer=new IconComboRenderer();
.....
class CarComboModel extends DefaultComboBoxModel {...}
class IconComboRenderer extends JLabel implements ListCellRenderer
{
....
}
public component getListCellRendererComponent (JList list, object obj,
int row, boolean sel, boolean hasFocus) {
....
}
public void paint (Graphics g) {...}
I have these basic questions:
a)why there is public component getListCellRendererCombonent?
b)is the method signature of getListCellRenderedComponent (is it a
method?) specified by the Swing developers?
Many Thanks for your answers.