getListCellRendererComponent in Swing

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.
 
L

Last Timer

Also there are couple of functions using the synchronized key word. Why
is synchronized used for a Swing app?
Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,128
Latest member
ElwoodPhil
Top