css - BorderPane setCenter overflow -


please having issues code, trying build media player application in javafx , using borderpane layout child nodes top, center , bottom respectively, seems fine when set center node bottom node disappears.

i have css file don't think part of problem, unless wrong.

please, can out on how layout child nodes top, center , button respectively.

note: if comment out

root.setcenter(new main().mediaview(view)); 

line, top , bottom nodes fine.

thanks.

here's code:

package application; import java.io.file;  import javafx.application.application; import javafx.geometry.pos; import javafx.scene.scene; import javafx.scene.layout.borderpane; import javafx.scene.layout.hbox; import javafx.scene.layout.stackpane; import javafx.scene.media.media; import javafx.scene.media.mediaplayer; import javafx.scene.media.mediaview; import javafx.scene.paint.color; import javafx.stage.stage; import javafx.stage.stagestyle;   public class main extends application {      @override     public void start(stage primarystage) {         try {             new main().getpane(primarystage);         } catch(exception e) {             e.printstacktrace();         }     }       public static void main(string[] args) {         launch(args);     }      public void getpane(stage stage) {                media media = new media(new file("src/the_nut_job.mp4").touri().tostring());         mediaplayer mediaplayer = new mediaplayer(media);         mediaview view = new mediaview(mediaplayer);          mediaplayer.setonready(new runnable() {             @override             public void run() {                  double width = mediaplayer.getmedia().getwidth();                 double height = mediaplayer.getmedia().getheight();                  system.out.println(width +", "+height);                  borderpane root = new borderpane();                 root.settop(new main().titlebar());                 root.setbottom(new main().toolbar());                  //borderpane.setalignment(new main().mediaview(view), pos.center);                 root.setcenter(new main().mediaview(view));                   scene scene = new scene(root, width, height);                 scene.getstylesheets().add(getclass().getresource("application.css").toexternalform());                 stage.initstyle(stagestyle.transparent);                 scene.setfill(color.transparent);                 stage.setscene(scene);                 stage.show();                 mediaplayer.play();             }         });     }      public stackpane mediaview(mediaview mview) {         stackpane view = new stackpane();         view.getchildren().add(mview);         view.setid("view");         return view;     }        public hbox titlebar() {         hbox titlebar = new hbox();         titlebar.setminheight(35);         titlebar.setmaxheight(35);         titlebar.setid("title");         return titlebar;     }      public hbox toolbar() {         hbox toolbar = new hbox();         toolbar.setminheight(35);         toolbar.setmaxheight(35);         toolbar.setid("tool");         return toolbar;     } } 

and here's css:

/* javafx css - leave comment until have @ least create 1 rule uses -fx-property */ .root {     -fx-border-color: #e6e6fa;     -fx-border-radius: 8 8 0 0;     -fx-border-width: 1;     -fx-background-radius: 8 8 0 0;     -fx-background-color: transparent; }  #title {     -fx-background-color: #222;     -fx-border-color: transparent;     -fx-border-radius: 8 8 0 0;     -fx-background-radius: 8 8 0 0; }  #tool {     -fx-background-color: #222;     -fx-border-color: white;     -fx-border-radius: 0 0 8 8;     -fx-background-radius: 0 0 8 8; }  #view {     -fx-background-color: transparent;     -fx-border-radius: 0 0 8 8;     -fx-background-radius: 0 0 8 8; } 


Comments

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -