use of com.android.tools.idea.uibuilder.mockup.colorextractor.ExtractedColor in project android by JetBrains.
the class ColorExtractorTool method initColorsComponents.
private void initColorsComponents() {
myExtractButton.addActionListener(e -> {
if (myExtractedColors != null) {
myColors.removeAll();
}
if (!myIsExtractingColor) {
ColorExtractor colorExtractor = new DBSCANColorExtractor(myMockup);
myIsExtractingColor = true;
colorExtractor.run(new ColorExtractor.ColorExtractorCallback() {
@Override
public void result(Collection<ExtractedColor> rgbColors) {
myProgressBar.setValue(100);
myExportButton.setEnabled(true);
myIsExtractingColor = false;
myExtractedColors = rgbColors;
for (ExtractedColor color : rgbColors) {
ColorPanel colorPanel = new ColorPanel(color);
colorPanel.addHoveredListener(ColorExtractorTool.this);
JPanel component = colorPanel.getComponent();
component.setMaximumSize(component.getPreferredSize());
myColors.add(component, 0);
}
myColors.revalidate();
}
@Override
public void progress(int progress) {
myProgressBar.setValue(progress);
}
});
}
});
}
Aggregations