use of org.polymap.core.style.ui.ColorChooser in project polymap4-core by Polymap4.
the class ConstantColorEditor method createContents.
@Override
public Composite createContents(Composite parent) {
Composite contents = super.createContents(parent);
final Button button = new Button(parent, SWT.FLAT | SWT.LEFT);
button.setText(i18n.get("choose"));
button.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
ColorChooser cc = new ColorChooser(new RGB(prop.get().r.get(), prop.get().g.get(), prop.get().b.get()));
UIService.instance().openDialog(cc.title(), dialogParent -> {
cc.createContents(dialogParent);
}, () -> {
RGB rgb = cc.getRGB();
prop.get().r.set(rgb.red);
prop.get().b.set(rgb.blue);
prop.get().g.set(rgb.green);
updateButtonColor(button, rgb);
return true;
});
}
});
updateButtonColor(button, new RGB(prop.get().r.get(), prop.get().g.get(), prop.get().b.get()));
return contents;
}
Aggregations