Login  Register

Re: NEWTCanvasJFX Resize

Posted by MikeORC on Jan 10, 2020; 5:06pm
URL: https://forum.jogamp.org/NEWTCanvasJFX-Resize-tp4040254p4040255.html

Ok I figured out some things:

I changed the initial block of code that sets up the window and NewtCanvasJFX to listen for width/height properties from the stackpane and forward them to Window which makes resizing work but it acts as if the initialize size is the minimum (see below).  The next question I have is, with NewtCanvasJFX can other JavaFX elements such as Slider be drawn on top of it?  By "on top" I mean z-order or overlayed. Under normal circumstances in JavaFX it is possible to have Sliders and buttons on top of other things using StackPane.

      glWindow = GLWindow.create(capabilities);
      glWindow.setSize(300, 250);
      this.glPanel = new NewtCanvasJFX(glWindow);
      this.glPanel.setWidth(300);
      this.glPanel.setHeight(250);
      openGLPane.getChildren().add(0, glPanel);

      glWindow.addGLEventListener(this);

      this.openGLPane.widthProperty().addListener(new ChangeListener<Number>()
      {
        @Override
        public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue)
        {
          System.out.println("resizing");
          glWindow.setSize(newValue.intValue(), glWindow.getHeight());
        }
      });

      this.openGLPane.heightProperty().addListener(new ChangeListener<Number>()
      {
        @Override
        public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue)
        {
          System.out.println("resizing");
          glWindow.setSize(glWindow.getWidth(), newValue.intValue());
        }
      });