ColorProfileInfo.arrangeForMenu(PrinterProfiles);
for (ColorProfileInfo profile : profiles) {
printerProfile.addItem(profile);
}
// Initialize the printerProfile selection from the model:
ColorProfileInfo initProfile = model.getColorProfileInfo();
if (initProfile != null) {
for (ColorProfileInfo profile : profiles) {
if (profile != null) {
// Don't require strict equality for ColorProfileInfo's.
// Just ask that the names match:
if (profile.getName().equals(initProfile.getName())) {
printerProfile.setSelectedItem(profile);
}
}
}
}
// Avoid scroll bars in menus, even if some items may not be accessible:
printerProfile.setMaximumRowCount(25);
Box box = createLabelCombo(LOCALE.get("ProfileLabel"), printerProfile);
titlePanel.add(box);
printerProfile.addItemListener(
new ItemListener() {
public void itemStateChanged(ItemEvent e) {
if (e.getStateChange() == ItemEvent.SELECTED) {
final ColorProfileInfo cpi =
(ColorProfileInfo)printerProfile.getSelectedItem();
model.setColorProfile(cpi);
}
}
}