Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    Aug 2012
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation Trying to display in a jframe an html file from my computer

    Hi, i've been working on this for months and i've tried so many different things. can anyone help me with this?

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    You can't. HTML needs an object embedded into it, but JFrame isn't interpretable. Use an applet instead.

  • #3
    New to the CF scene
    Join Date
    Aug 2012
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Care to explain?

  • #4
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    JFrame's cannot be rendered through HTML. You need to embed an object of type applet instead.
    Applet can handle a JFrame, so you just need to wrap your JFrame in an applet class instead. See this tutorial for more applet information: http://docs.oracle.com/javase/tutori...let/index.html

  • #5
    New to the CF scene
    Join Date
    Aug 2012
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts
    okay so another question:

    what if i create an html file and i want to call it using:


    File file = new File("insert file path");

    would that work, or is the applet the only way to do it?
    Last edited by tornskyz; 08-17-2012 at 07:38 PM.

  • #6
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,994
    Thanks
    4
    Thanked 2,662 Times in 2,631 Posts
    I don't understand what you are looking to do here. If you open a file with an IO handling method, you retrieve it as text. It'll only do something if you parse it and handle it in some fashion.
    If you want to run it over http embeded in an html file, use an applet. If you want to handle it as server code over http, use a servlet or JSP. If you want to handle a desktop application capable of communicating over http, then look at writing a JFrame and establish http connections.


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •