import
javafx.application.Application;
import
javafx.scene.Scene;
import
javafx.scene.control.*;
import
javafx.scene.layout.*;
import
javafx.stage.Stage;
import
javafx.scene.image.*;
import
javafx.scene.effect.*;
import
java.io.*;
import
javafx.event.ActionEvent;
import
javafx.event.EventHandler;
import
javafx.scene.Group;
public
class
ColorAdjust_2
extends
Application {
public
void
start(Stage stage)
throws
Exception
{
stage.setTitle(
"ColorAdjust example"
);
TextField hue, saturation, brightness, contrast;
hue =
new
TextField(
"Hue"
);
saturation =
new
TextField(
"Saturation"
);
brightness =
new
TextField(
"Brightness"
);
contrast =
new
TextField(
"Contrast"
);
FileInputStream input =
new
FileInputStream(
"f:\\gfg.png"
);
Image image =
new
Image(input);
ImageView imageview =
new
ImageView(image);
ColorAdjust color_adjust =
new
ColorAdjust();
Button button =
new
Button(
"apply"
);
EventHandler<ActionEvent> event =
new
EventHandler<ActionEvent>() {
public
void
handle(ActionEvent e)
{
color_adjust.setHue(Double.parseDouble(hue.getText()));
color_adjust.setBrightness(Double.parseDouble(
brightness.getText()));
color_adjust.setContrast(Double.parseDouble(
contrast.getText()));
color_adjust.setSaturation(Double.parseDouble(
saturation.getText()));
}
};
button.setOnAction(event);
imageview.setEffect(color_adjust);
VBox vbox =
new
VBox(imageview, hue, saturation,
brightness, contrast, button);
Scene scene =
new
Scene(vbox,
200
,
400
);
stage.setScene(scene);
stage.show();
}
public
static
void
main(String args[])
{
launch(args);
}
}