frame = new ChromaticityJFrame(new CiexyYColorSelectedListener() {
@Override
public void onCiexyYColorSelected(double x, double y, double Y) {
try {
// Set the color I clicked
setColor(new AbsoluteColor(new Chromaticity(x, y), Y));
} catch (IOException e) {
e.printStackTrace();
}
}
});
frame.setVisible(true);
// Display light sources chromaticities
for(LightSource s : sources){
frame.addChromaticityPoint(s.getx(), s.gety());
}
// LAB color chooser frame
LabChooserJFrame frame2 = new LabChooserJFrame(new CieXYZColorSelectedListener() {
@Override
public void onCieXYZColorSelected(double X, double Y, double Z) {
try {
double[] XYZ = {X, Y, Z};
// XYZ to xyY conversion
double x = XYZ[0]/(XYZ[0]+XYZ[1]+XYZ[2]);
double y = XYZ[1]/(XYZ[0]+XYZ[1]+XYZ[2]);
Y = Y*10;
setColor(new AbsoluteColor(new Chromaticity(x, y), Y));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
frame2.setVisible(true);
// LAB color chooser frame
HuslChooserJFrame frame3 = new HuslChooserJFrame(new CieXYZColorSelectedListener() {
@Override
public void onCieXYZColorSelected(double X, double Y, double Z) {
try {
double[] XYZ = {X, Y, Z};
// XYZ to xyY conversion
double x = XYZ[0]/(XYZ[0]+XYZ[1]+XYZ[2]);
double y = XYZ[1]/(XYZ[0]+XYZ[1]+XYZ[2]);
Y = Y*5000;
setColor(new AbsoluteColor(new Chromaticity(x, y), Y));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
});
frame3.setVisible(true);
ChromaticityUCSJFrame frame4 = new ChromaticityUCSJFrame(new CiexyYColorSelectedListener() {
@Override
public void onCiexyYColorSelected(double x, double y, double Y) {
try {
// Set the color I clicked
setColor(new AbsoluteColor(new Chromaticity(x, y), Y));
} catch (IOException e) {
e.printStackTrace();
}
}
});
frame4.setVisible(true);
// Display light sources chromaticities
for(LightSource s : sources){
frame4.addChromaticityPoint(s.getx(), s.gety());
}
// Show Planckian Locus selector
PlanckianLocusJFrame planckFrame = new PlanckianLocusJFrame(new CiexyYColorSelectedListener() {
@Override
public void onCiexyYColorSelected(double x, double y, double Y) {
try {
// Set the color I clicked
setColor(new AbsoluteColor(new Chromaticity(x, y), Y));
} catch (IOException e) {
e.printStackTrace();
}
}
});