java - I am using Javafx and I am trying to manipulate code within a .css file but cannot -


the problem code wish change string assigned defaultimg change background image of application. not receive runtime or compile error when running application. "client.css" file not being updated. messing up? there buttons called "img1" - "img6". these located near bottom of code. in these methods open file writer clear , rewrite code within css document. thank in advance helping me out.

  //settings application:      s_windowpane = new gridpane();     s_windowpane.setpadding(new insets(35));     s_windowpane.sethgap(0);     s_windowpane.setvgap(0);     s_windowpane.setid("settingspane");      s_buttonpane = new gridpane();     s_buttonpane.setpadding(new insets(15));     s_buttonpane.sethgap(0);     s_buttonpane.setvgap(20);     s_buttonpane.setalignment(pos.bottom_center);     s_buttonpane.setid("buttonpane");      s_bkgrndimagepane = new gridpane();     s_bkgrndimagepane.setprefwidth(500);     s_bkgrndimagepane.setprefheight(300);     s_bkgrndimagepane.sethgap(10);     s_bkgrndimagepane.setvgap(20);     s_bkgrndimagepane.setalignment(pos.center);     s_bkgrndimagepane.setid("backgroundimagepane");      image img1_ = new image(getclass().getresourceasstream("images/backgroundimg1.jpg"));     img1 = new button();     img1.setgraphic(new imageview(img1_));     s_bkgrndimagepane.add(img1, 0, 0);      image img2_ = new image(getclass().getresourceasstream("images/backgroundimg2.jpg"));     img2 = new button();     img2.setgraphic(new imageview(img2_));     s_bkgrndimagepane.add(img2, 1, 0);      image img3_ = new image(getclass().getresourceasstream("images/backgroundimg3.jpg"));     img3 = new button();     img3.setgraphic(new imageview(img3_));     s_bkgrndimagepane.add(img3, 2, 0);      image img4_ = new image(getclass().getresourceasstream("images/backgroundimg4.jpg"));     img4 = new button();     img4.setgraphic(new imageview(img4_));     s_bkgrndimagepane.add(img4, 0, 1);      image img5_ = new image(getclass().getresourceasstream("images/backgroundimg5.jpg"));     img5 = new button();     img5.setgraphic(new imageview(img5_));     s_bkgrndimagepane.add(img5, 1, 1);      image img6_ = new image(getclass().getresourceasstream("images/backgroundimg6.jpg"));     img6 = new button();     img6.setgraphic(new imageview(img6_));     s_bkgrndimagepane.add(img6, 2, 1);        cancel = new button();     cancel.settext("cancel");     cancel.setprefwidth(70);     cancel.setprefheight(35);     s_buttonpane.add(cancel, 0, 0);     cancel.setid("cancel");      apply = new button();     apply.settext("apply");     apply.setprefwidth(70);     apply.setprefheight(35);     s_buttonpane.add(apply, 0, 1);     apply.setid("apply");      s_windowpane.add(s_bkgrndimagepane, 0, 0);     s_windowpane.add(s_buttonpane, 1, 0);      s_root = new stackpane();     s_root.setid("s_root");      s_root.getchildren().add(s_windowpane);     settingsscene = new scene(s_root, 670,420);     settingsscene.getstylesheets().add("client.css");       cancel.setonaction(new eventhandler<actionevent>()      {         @override public void handle(actionevent e)          {             primarystage.setscene(clientscene);         }     });       //used reset , apply changes     apply.setonaction(new eventhandler<actionevent>()      {         @override public void handle(actionevent e)          {              primarystage.close();             primarystage.setscene(settingsscene);             primarystage.show();             primarystage.close();             primarystage.setscene(settingsscene);             primarystage.show();         }     });  //leaves settings menu without making physical changes     cancel.setonaction(new eventhandler<actionevent>()      {         @override public void handle(actionevent e)          {             primarystage.setscene(clientscene);         }     });        img1.setonaction(new eventhandler<actionevent>()      {         @override public void handle(actionevent e)          {             system.out.println(1);             try {                 printwriter pw = null;                 pw = new printwriter("src/client.css"); //long string containing code needed .css                 pw.write("#c_root{-fx-background-image: url('images/background.jpg');-fx-background-repeat: repeat;}#s_root{-fx-background-image: url('images/background.jpg');-fx-background-repeat: repeat;}#ipinput{-fx-effect: dropshadow( three-pass-box , rgba(0,0,0,0.6) , 5, 0.0 , 0 , 1 );}.button{-fx-background-color: linear-gradient(#f2f2f2, #d6d6d6),linear-gradient(#fcfcfc 0%, #d9d9d9 20%, #d6d6d6 100%),linear-gradient(#dddddd 0%, #f6f6f6 50%);-fx-background-radius: 8,7,6;-fx-background-insets: 0,1,2;-fx-text-fill: black;-fx-effect: dropshadow( three-pass-box , rgba(0,0,0,0.6) , 5, 0.0 , 0 , 1 );}#textdisplay{-fx-opacity: 1.0;-fx-effect: dropshadow( three-pass-box , rgba(0,0,0,0.6) , 5, 0.0 , 0 , 1 );-fx-font-fill: black;}#backgroundimagepane{-fx-opacity: 1.0;-fx-effect: dropshadow( three-pass-box , rgba(0,0,0,0.6) , 5, 0.0 , 0 , 1 );}#input{-fx-effect: dropshadow( three-pass-box , rgba(0,0,0,0.6) , 5, 0.0 , 0 , 1 );}");                 pw.flush();                 pw.close();             } catch (filenotfoundexception e1) {                 e1.printstacktrace();             }         }     });        img2.setonaction(new eventhandler<actionevent>()      {         @override public void handle(actionevent e)          {             system.out.println(2);             try {                 printwriter pw = null;                 pw = new printwriter("src/client.css"); //long string containing code needed .css                 pw.write("#c_root{-fx-background-image: url('images/background2.jpg');-fx-background-repeat: repeat;}#s_root{-fx-background-image: url('images/background2.jpg');-fx-background-repeat: repeat;}#ipinput{-fx-effect: dropshadow( three-pass-box , rgba(0,0,0,0.6) , 5, 0.0 , 0 , 1 );}.button{-fx-background-color: linear-gradient(#f2f2f2, #d6d6d6),linear-gradient(#fcfcfc 0%, #d9d9d9 20%, #d6d6d6 100%),linear-gradient(#dddddd 0%, #f6f6f6 50%);-fx-background-radius: 8,7,6;-fx-background-insets: 0,1,2;-fx-text-fill: black;-fx-effect: dropshadow( three-pass-box , rgba(0,0,0,0.6) , 5, 0.0 , 0 , 1 );}#textdisplay{-fx-opacity: 1.0;-fx-effect: dropshadow( three-pass-box , rgba(0,0,0,0.6) , 5, 0.0 , 0 , 1 );-fx-font-fill: black;}#backgroundimagepane{-fx-opacity: 1.0;-fx-effect: dropshadow( three-pass-box , rgba(0,0,0,0.6) , 5, 0.0 , 0 , 1 );}#input{-fx-effect: dropshadow( three-pass-box , rgba(0,0,0,0.6) , 5, 0.0 , 0 , 1 );}");                 pw.flush();                 pw.close();             } catch (filenotfoundexception e1) {                 e1.printstacktrace();             }         }     });        img3.setonaction(new eventhandler<actionevent>()      {         @override public void handle(actionevent e)          {             system.out.println(3);             try {                 printwriter pw = null;                 pw = new printwriter("src/client.css"); //long string containing code needed .css                 pw.write("#c_root{-fx-background-image: url('images/background3.jpg');-fx-background-repeat: repeat;}#s_root{-fx-background-image: url('images/background3.jpg');-fx-background-repeat: repeat;}#ipinput{-fx-effect: dropshadow( three-pass-box , rgba(0,0,0,0.6) , 5, 0.0 , 0 , 1 );}.button{-fx-background-color: linear-gradient(#f2f2f2, #d6d6d6),linear-gradient(#fcfcfc 0%, #d9d9d9 20%, #d6d6d6 100%),linear-gradient(#dddddd 0%, #f6f6f6 50%);-fx-background-radius: 8,7,6;-fx-background-insets: 0,1,2;-fx-text-fill: black;-fx-effect: dropshadow( three-pass-box , rgba(0,0,0,0.6) , 5, 0.0 , 0 , 1 );}#textdisplay{-fx-opacity: 1.0;-fx-effect: dropshadow( three-pass-box , rgba(0,0,0,0.6) , 5, 0.0 , 0 , 1 );-fx-font-fill: black;}#backgroundimagepane{-fx-opacity: 1.0;-fx-effect: dropshadow( three-pass-box , rgba(0,0,0,0.6) , 5, 0.0 , 0 , 1 );}#input{-fx-effect: dropshadow( three-pass-box , rgba(0,0,0,0.6) , 5, 0.0 , 0 , 1 );}");                 pw.flush();                 pw.close();             } catch (filenotfoundexception e1) {                 e1.printstacktrace();             }         }     });        img4.setonaction(new eventhandler<actionevent>()      {         @override public void handle(actionevent e)          {             system.out.println(4);             try {                 printwriter pw = null; //long string containing code needed .css                 pw = new printwriter("src/client.css");                 pw.write("#c_root{-fx-background-image: url('images/background4.jpg');-fx-background-repeat: repeat;}#s_root{-fx-background-image: url('images/background4.jpg');-fx-background-repeat: repeat;}#ipinput{-fx-effect: dropshadow( three-pass-box , rgba(0,0,0,0.6) , 5, 0.0 , 0 , 1 );}.button{-fx-background-color: linear-gradient(#f2f2f2, #d6d6d6),linear-gradient(#fcfcfc 0%, #d9d9d9 20%, #d6d6d6 100%),linear-gradient(#dddddd 0%, #f6f6f6 50%);-fx-background-radius: 8,7,6;-fx-background-insets: 0,1,2;-fx-text-fill: black;-fx-effect: dropshadow( three-pass-box , rgba(0,0,0,0.6) , 5, 0.0 , 0 , 1 );}#textdisplay{-fx-opacity: 1.0;-fx-effect: dropshadow( three-pass-box , rgba(0,0,0,0.6) , 5, 0.0 , 0 , 1 );-fx-font-fill: black;}#backgroundimagepane{-fx-opacity: 1.0;-fx-effect: dropshadow( three-pass-box , rgba(0,0,0,0.6) , 5, 0.0 , 0 , 1 );}#input{-fx-effect: dropshadow( three-pass-box , rgba(0,0,0,0.6) , 5, 0.0 , 0 , 1 );}");                 pw.flush();                 pw.close();             } catch (filenotfoundexception e1) {                 e1.printstacktrace();             }         }     });        img5.setonaction(new eventhandler<actionevent>()      {         @override public void handle(actionevent e)          {             system.out.println(5);             try {                 printwriter pw = null;                 pw = new printwriter("src/client.css"); //long string containing code needed .css                 pw.write("#c_root{-fx-background-image: url('images/background5.jpg');-fx-background-repeat: repeat;}#s_root{-fx-background-image: url('images/background5.jpg');-fx-background-repeat: repeat;}#ipinput{-fx-effect: dropshadow( three-pass-box , rgba(0,0,0,0.6) , 5, 0.0 , 0 , 1 );}.button{-fx-background-color: linear-gradient(#f2f2f2, #d6d6d6),linear-gradient(#fcfcfc 0%, #d9d9d9 20%, #d6d6d6 100%),linear-gradient(#dddddd 0%, #f6f6f6 50%);-fx-background-radius: 8,7,6;-fx-background-insets: 0,1,2;-fx-text-fill: black;-fx-effect: dropshadow( three-pass-box , rgba(0,0,0,0.6) , 5, 0.0 , 0 , 1 );}#textdisplay{-fx-opacity: 1.0;-fx-effect: dropshadow( three-pass-box , rgba(0,0,0,0.6) , 5, 0.0 , 0 , 1 );-fx-font-fill: black;}#backgroundimagepane{-fx-opacity: 1.0;-fx-effect: dropshadow( three-pass-box , rgba(0,0,0,0.6) , 5, 0.0 , 0 , 1 );}#input{-fx-effect: dropshadow( three-pass-box , rgba(0,0,0,0.6) , 5, 0.0 , 0 , 1 );}");                 pw.flush();                 pw.close();             } catch (filenotfoundexception e1) {                 e1.printstacktrace();             }         }     });        img6.setonaction(new eventhandler<actionevent>()      {         @override public void handle(actionevent e)          {             system.out.println(6);             try { //long string containing code needed .css                 printwriter pw = null;                 pw = new printwriter("src/client.css");                 pw.write("#c_root{-fx-background-image: url('images/background6.jpg');-fx-background-repeat: repeat;}#s_root{-fx-background-image: url('images/background6.jpg');-fx-background-repeat: repeat;}#ipinput{-fx-effect: dropshadow( three-pass-box , rgba(0,0,0,0.6) , 5, 0.0 , 0 , 1 );}.button{-fx-background-color: linear-gradient(#f2f2f2, #d6d6d6),linear-gradient(#fcfcfc 0%, #d9d9d9 20%, #d6d6d6 100%),linear-gradient(#dddddd 0%, #f6f6f6 50%);-fx-background-radius: 8,7,6;-fx-background-insets: 0,1,2;-fx-text-fill: black;-fx-effect: dropshadow( three-pass-box , rgba(0,0,0,0.6) , 5, 0.0 , 0 , 1 );}#textdisplay{-fx-opacity: 1.0;-fx-effect: dropshadow( three-pass-box , rgba(0,0,0,0.6) , 5, 0.0 , 0 , 1 );-fx-font-fill: black;}#backgroundimagepane{-fx-opacity: 1.0;-fx-effect: dropshadow( three-pass-box , rgba(0,0,0,0.6) , 5, 0.0 , 0 , 1 );}#input{-fx-effect: dropshadow( three-pass-box , rgba(0,0,0,0.6) , 5, 0.0 , 0 , 1 );}");                 pw.flush();                 pw.close();             } catch (filenotfoundexception e1) {                 e1.printstacktrace();             }         }     }); 


Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -