0 Replies Latest reply: Oct 10, 2012 9:51 AM by 966041 RSS

    javafx Image is not displayed properly on clicking Button

      I am completely new in javaFx. I am writing a small program where on clicking a button it reads an image and should display an o/p image. Here how it does the whole processing.
      I read the Image and get its pixels and i handover the pixel to C lib and get the output pixel and form a WritableImage and display it on the right side of a SplitPane. But the o/p image does not appear as it is expected on 1st click on the button(sometimes half part with distorted image appears) . on more than twice i click then the expected o/p image appears.

      Can anybody help me please.

      Here is my code:

      public class Ciptk extends Application {

           Stage primaryStage;
           ImageView image ;
           HBox rightArea;
           Scene scene;
           static int count=0,k=0;
           * @param args the command line arguments
           public static void main(String[] args) {

           public void start(Stage stage) {


                Platform.runLater(new Runnable() {
                     public void run() {
                          Group root = new Group();
                          scene = new Scene(root, 350.0, 250.0, Color.WHITE);

                          // Left and right split pane
                          SplitPane splitPane = new SplitPane();
                          //List<Node> items = splitPane.getItems();
                          VBox leftArea = new VBox(10);
                          Button negativeBut = new Button();
                          negativeBut.setOnAction(new EventHandler<ActionEvent>() {

                               public void handle(ActionEvent event) {

                                    System.out.println("Negative Clicked");               
                                    javafx.scene.image.Image img;
                                    int type;

                                    if(type==1)//for non-ppm image
                                    image=new ImageView(img);



           rightArea = new HBox();
           image = new ImageView(new Image("test.jpg"));
                          // add left area
                          // add right area

                          HBox splitPaneBox = new HBox();

                          //add menu bar and splipane to scene
                          VBox vBox = new VBox();