java - How to open a new page in the same windows in javafx -


i developing project in javafx using netbeans ide. want open new page in same window. how ? provide code below. don't included import statements here. in actual code.

package welcomepage;  public class welcomepage extends application {      @override     public void start(stage stage) {          // use border pane root scene         borderpane border = new borderpane();          border.settop(addvbox());         border.setleft(addvbox1());          scene scene = new scene(border,700,450);         stage.setscene(scene);         stage.setresizable(false);         scene.getstylesheets().add         (welcomepage.class.getresource("welcomepage.css").toexternalform());         stage.show();      }      private vbox addvbox() {          vbox vbox = new vbox();         vbox.setpadding(new insets(5, 12, 5, 20));         vbox.setspacing(10);   // gap between nodes         //vbox.setstyle("-fx-background-color: #999999;");          image image = new image(getclass().getresourceasstream("logo11.png"));         label lb1=new label("    c - mark , attendance calculator");         lb1.setalignment(pos.center);         lb1.setfont(font.font("calibri",fontweight.bold,28));         lb1.settextfill(color.black);         lb1.setgraphic(new imageview(image));          vbox.getchildren().addall(lb1);          return vbox;     }      private vbox addvbox1()     {         vbox vbox1=new vbox();         vbox1.setpadding(new insets(20, 2, 15, 20));         vbox1.setspacing(20);           button btnl2=new button("sign in");         btnl2.setfont(font.font("calibri",fontweight.bold,16));         btnl2.setprefsize(300,60);         btnl2.setstyle(" -fx-base: #0066cc;");         //image imageok = new image(getclass().getresourceasstream("icon22.png"));         //btnl2.setgraphic(new imageview(imageok));          final tooltip tooltip2 = new tooltip();         tooltip2.settext("if have account,\nsign in here.");         btnl2.settooltip(tooltip2);          btnl2.setonaction(new eventhandler<actionevent>() {             @override             public void handle(actionevent e) {                 signin();             }         });           button btnl4=new button("help");         btnl4.setfont(font.font("calibri",fontweight.bold,16));         btnl4.setprefsize(300,60);         btnl4.setstyle(" -fx-base: #0066cc;");          final tooltip tooltip4 = new tooltip();         tooltip4.settext("get content\nabout software.");         btnl4.settooltip(tooltip4);          btnl4.setonaction(new eventhandler<actionevent>() {             @override             public void handle(actionevent e) {                 help();             }         });          button btnl5=new button("about");         btnl5.setfont(font.font("calibri",fontweight.bold,16));         btnl5.setprefsize(300,60);         btnl5.setstyle(" -fx-base: #0066cc;");          final tooltip tooltip5 = new tooltip();         tooltip5.settext("know about\nthis software.");         btnl5.settooltip(tooltip5);          btnl5.setonaction(new eventhandler<actionevent>() {              @override              public void handle(actionevent e) {                  about();              }         });          button btnl6=new button("exit");         btnl6.setfont(font.font("calibri",fontweight.bold,16));         btnl6.setprefsize(300,60);         btnl6.setstyle(" -fx-base: #0066cc;");         //image imageok = new image(getclass().getresourceasstream("cross.png"));         //btnr3.setgraphic(new imageview(imageok));          final tooltip tooltip6 = new tooltip();         tooltip6.settext("exit if had\nfinished works.");         btnl6.settooltip(tooltip6);          btnl6.setonaction(new eventhandler<actionevent>() {             @override             public void handle(actionevent e) {                 system.exit(0);             }         });          vbox1.getchildren().addall(btnl2,btnl4,btnl5,btnl6);          return vbox1;     }      public void signin()     {         stage stage=new stage();         borderpane border = new borderpane();          border.settop(loginhbox1());         border.setleft(loginvbox1());         border.setright(loginvbox2());          scene scene = new scene(border,700,450);         stage.setscene(scene);         stage.setresizable(false);         scene.getstylesheets().add         (login.class.getresource("login.css").toexternalform());         stage.show();      }      private hbox loginhbox1() {          hbox hbox = new hbox();         hbox.setpadding(new insets(15, 12, 10, 180));         hbox.setspacing(10);   // gap between nodes          label lb1=new label("log in or create new account");         lb1.setalignment(pos.center);         lb1.setfont(font.font("calibri",fontweight.bold,26));         lb1.settextfill(color.black);          hbox.getchildren().addall(lb1);          return hbox;     }      private vbox loginvbox1() {          vbox hbox = new vbox();         hbox.setpadding(new insets(20,30,15,50)); // set sides 10         hbox.setspacing(10);     // gap between nodes          label lb3=new label("log  in");         lb3.setalignment(pos.center);         lb3.setfont(font.font("calibri",fontweight.bold,24));         lb3.settextfill(color.black);          label lb1=new label("username");         lb1.setalignment(pos.center);         lb1.setfont(font.font("calibri",fontweight.bold,16));         lb1.settextfill(color.black);          textfield t1=new textfield();         t1.setprefsize(150,30);          label lb2=new label("password");         lb2.setalignment(pos.center);         lb2.setfont(font.font("calibri",fontweight.bold,16));         lb2.settextfill(color.black);          passwordfield pw1=new passwordfield();         pw1.setprefsize(150,30);          button b1=new button("log in");         b1.setfont(font.font("calibri",fontweight.bold,16));         b1.setprefsize(80,5);          hbox.getchildren().addall(lb3,lb1,t1,lb2,pw1,b1);          return hbox;     }      private vbox loginvbox2()     {        vbox hbox1 = new vbox();        hbox1.setpadding(new insets(15, 50, 15, 10));        hbox1.setspacing(10);         label lb4=new label("create  new  account");        lb4.setfont(font.font("calibri",fontweight.bold,24));        lb4.setprefsize(250,30);        lb4.settextfill(color.black);         label lb1=new label("full name ");        lb1.setfont(font.font("calibri",fontweight.bold,18));        lb1.setprefsize(100, 30);        lb1.settextfill(color.black);         textfield t1=new textfield();        t1.setprefsize(50,30);         label lb2=new label("user name ");        lb2.setfont(font.font("calibri",fontweight.bold,18));        lb2.setprefsize(150, 30);        lb2.settextfill(color.black);         textfield t2=new textfield();        t2.setprefsize(100,30);         label lb3=new label("password ");        lb3.setfont(font.font("calibri",fontweight.bold,18));        lb3.setprefsize(150, 30);        lb3.settextfill(color.black);         passwordfield t3=new passwordfield();        t3.setprefsize(100,30);         label lb5=new label("gender ");        lb5.setfont(font.font("calibri",fontweight.bold,18));        lb5.setprefsize(150, 30);        lb5.settextfill(color.black);         observablelist<string> options2 =         fxcollections.observablearraylist(        "male","female");        final combobox combobox2 = new combobox(options2);        combobox2.setprefsize(250,30);         button btn1=new button("create");        btn1.setfont(font.font("calibri",fontweight.bold,18));        btn1.setprefsize(100,30);          hbox1.getchildren().addall(lb4,lb1,t1,lb2,t2,lb3,t3,lb5,combobox2,btn1);        return hbox1;     }      public static void main(string[] args) {         launch(args);     } } 

you can keep pane in root node , through on action of next button can load node parent node.


Comments

Popular posts from this blog

python - Subclassed QStyledItemDelegate ignores Stylesheet -

java - HttpClient 3.1 Connection pooling vs HttpClient 4.3.2 -

SQL: Divide the sum of values in one table with the count of rows in another -