java - how to add Multiple Stage with comboBox in javafx -


im making desktop application javafx want add internal or sub window dont know exact word in javafx of innerwindow had tried inner frame doesnt work. package jdesktop;

import java.io.file; import java.net.malformedurlexception; import java.net.url;  import javafx.application.application; import javafx.beans.value.changelistener; import javafx.beans.value.observablevalue; import javafx.concurrent.worker; import javafx.event.actionevent; import javafx.geometry.insets; import javafx.scene.scene; import javafx.scene.control.button; import javafx.scene.control.combobox; import javafx.scene.layout.hbox; import javafx.scene.web.webengine; import javafx.scene.web.webview; import javafx.stage.stage;  public class newclass extends application {      private static object webengine;      @override     public void start(final stage stage) {           //final javax.swing.jlabel jlabel1=new jlabel(new javax.swing.imageicon(getclass().getresource("/ini/nakodabhairav_fromtirth.jpg"))); // noi18n          button buttonurl = new button("load page http://192.168.2.18/a3/host/pmms.ankiti.com/?");         button buttonhtmlstring = new button("load html string");         button buttonhtmlfile = new button("load file c:/test/1206.jpg");         final webview browser = new webview();        final webengine webengine = browser.getengine();           final webview browser1 = new webview();        final webengine webengine1 = browser1.getengine();        final combobox prioritycombobox = new combobox();         webengine.getloadworker().stateproperty()         .addlistener(new changelistener<worker.state>() {             @override           public void changed(observablevalue ov, worker.state oldstate, worker.state newstate) {             if (newstate == worker.state.succeeded) {               stage.settitle(webengine.getlocation());               string trgurl=webengine.getlocation();               system.out.println(trgurl);          if(trgurl.matches("(.*)img=(.*)")){                        int n = trgurl.indexof("img=");                       //string str1 = integer.tostring(n);                       system.out.println(n+4);                       int len = trgurl.length();                       system.out.println("string length is: "+trgurl.length());                       system.out.println(trgurl.substring(n+4,len));                       string find = "file:"+trgurl.substring(n+4,len);                       system.out.println(find);                          webengine1.load(find);// loading image         }               }           }         });         string url = "http://192.168.2.18/a3/host/pmms.ankiti.com/?";                 // load page remote url.                webengine.load(url);        buttonurl.setonaction((actionevent event) -> {            string url1 = "http://192.168.2.18/a3/host/pmms.ankiti.com/?";              // load page remote url.              webengine.load(url1);          });          buttonhtmlstring.setonaction((actionevent event) -> {             string html = "<html><h1>hello</h1><h2>hello</h2></html>";             // load html string             webengine.loadcontent(html);          });         buttonhtmlfile.setonaction((actionevent event) -> {              try {                  file file = new file("c:/test/1206.jpg");                  url url1 = file.touri().tourl();                  // file:/c:/test/a.html                  system.out.println("local url: " + url1.tostring());                  webengine.load(url1.tostring());              }catch (malformedurlexception e) {              }          });          hbox root = new hbox();         root.setpadding(new insets(3));         root.setspacing(3);         root.getchildren().addall( browser1,browser);          prioritycombobox.getitems().addall(           "browser",            "browser1",             "browser/browser1"             );           // mycombobox.getitems().addall(browser1,browser);         // vbox vbox = new vbox(8); // spacing = 8         // vbox.setalignment(pos.bottom_center);         // vbox.getchildren().add(browser);          //  root.getchildren().addall( scrollpane(browser1));          scene scene = new scene(root);          //stage.settitle("javafx webview (o7planning.org)");         stage.setscene(scene);         stage.setwidth(450);         stage.setheight(300);          stage.show();            }     public static void main(string\[\] args) {         launch(args);     try {               string webenginelocation = webengine.getlocation();                         url url = new url(webenginelocation);            } catch (malformedurlexception e) {         }     } } 

this code of external window have add code internal window , external window should have webengine location in label refrence enter image description herei'm adding screenshot


Comments

Popular posts from this blog

python - Operations inside variables -

Generic Map Parameter java -

arrays - What causes a java.lang.ArrayIndexOutOfBoundsException and how do I prevent it? -