简体   繁体   中英

Deploy HTML file in java browser

I have a unique requirement i want my html files to be deployed on browser free platform. And when it comes to platform free and browser free only one word comes to my mind applet so i will like my HTML file(with css and js) to be rendered on an applet or swing window or some other stuff.

Any idea how to do it. Any new suggestions will be appreciated.

Not sure why you'd want a Swing applet to be rendered using HTML/CSS - that was exactly the point of creating Swing applets in the first place (so they don't relay on Web technologies).

If you really want a "browser free platform", I would suggest staying away from HTML/CSS/Javascript and writing a native app (Java / Windows / etc..)

Applets are running inside a browser, therefore it wont work, but you can create a standalone java GUI application that has an embedded browser in it. For example the SWT browser

      import org.eclipse.swt.browser.*;
      ...
      Browser browser;
      try {
         browser = new Browser(shell, SWT.NONE);
         browser.setUrl("http://www.google.com");
      } catch (SWTError e) {
         MessageBox messageBox = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
         messageBox.setMessage("Browser cannot be initialized.");
         messageBox.setText("Exit");
         messageBox.open();
         System.exit(-1);
      }

Or you can integrate the lobobrowser

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM