How to draw a rectangle over an element on the image using JavaFX? -


i have image displayed on javafx application. given coordinates, must display part on image using rectangle. example, if there textfield on image , give coordinates of textfield, rectangle should appear on textfield on image (just highlighting it). drawing rectangle easy, i'm having difficulty positioning on image. please help.

you should use parent component not layouts children automatically. can use pane:

@override public void start( final stage primarystage ) {     imageview imageview = new imageview( ... );     // optional: locating image @ ix-iy     // imageview.setx( ix );     // imageview.sety( iy );      rectangle r = new rectangle( rx, ry, width, height );      // add rectangle @ last, shows on top of other children     pane pane = new pane( imageview, r );      final scene scene = new scene( pane, 400, 300 );     primarystage.setscene( scene );     primarystage.show(); } 

Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -