Displaying html page with in the applet

I want to open an html page in the applet. If i use showDocument() of applet, it opens the html page in the browser, but i want to open the html page with in the applet(i.e., applet should display the html page). Is there any way which i can do the above thing.
Thanks in advance

Look at this sample:
import java.awt.*;
import java.net.*;
import java.io.*;
import javax.swing.*;
import java.awt.event.*;
import javax.swing.text.*;
public class BrwsA extends JApplet
     JPanel      jpa = new JPanel();
     JEditorPane jed = new JEditorPane();
     JScrollPane jsp = new JScrollPane(jpa);
public BrwsA()
     jpa.setLayout(new BorderLayout());
     jpa.add(jed);
     jpa.setPreferredSize(new Dimension(800,1000));
     jed.setEditable(false);
     jed.setContentType("text/html");
     jed.getEditorKit().createDefaultDocument();
     setContentPane(jsp);
public void init()
     try
          URL url = new URL(getCodeBase(),"test.html");
          jed.setPage(url);
     catch(MalformedURLException e)
     catch(IOException e)
}Noah

Similar Messages

  • Opening html page with in the applet

    I want to open an html page in the applet. If i use showDocument() of applet, it opens the html page in the browser, but i want to open the html page with in the applet(i.e., applet should display the html page). Is there any way which i can do the above thing.
    Thanks in advance

    Use a JEditorPane to display HTML (supports version 3.2 though)
    check API (that's for JDK 1.4.1 so check for version you use)
    http://java.sun.com/j2se/1.4.1/docs/api/javax/swing/JEditorPane.html
    Sky

  • How to call html page with in the flash

    I am new to action script, can some one guide me how to call html page with in the flash. lets say i have movie clip having instance name as "news_feed", I need to disply the html page in this news_feed. kindly help me, thanks alot

    some one tell me, weather it is possible or not ??

  • Displaying HTML page when server is unavailable

    Hi,
    I would like to display the static html page when the server is down. For example when server maintanance is going on I would like to display html page with information
    Please let me know what is the process to achive this.
    Thanks

    You might also want to check Custom Error pages:
    http://help.sap.com/saphelp_nw70/helpdata/EN/9a/e74d426332bd30e10000000a155106/frameset.htm
    Regards,
    Siddhesh

  • How to display HTML pages always in first rank in search result?

    I have a sharepoint 2010 site where search is configured, but when it is displaying the search result some time it is  showing the pdf files  in the first order and the html pages in the second order, I need to display html pages always
    in the first order.How can I accomplish it?

    Alex's link is by far the best one but this is an alternative if you wanted to read a bit more widely
    http://sharepointkaos.wordpress.com/2011/01/13/custom-ranking-model/
    Steven Andrews
    SharePoint Business Analyst: LiveNation Entertainment
    Blog: baron72.wordpress.com
    Twitter: Follow @backpackerd00d
    My Wiki Articles:
    CodePlex Corner Series
    Please remember to mark your question as "answered" if this solves (or helps) your problem.

  • Replace HTML page with an applet

    Hello to everybody!
    I created a servlet who can manage file upload from an HTML page.
    Now I want to replace that HTML page with an applet.
    I know that I need to use multipart/form-data , but I have no experience with applet.
    HTML page code is:
    <html>
    <head><title>Upload</title></head>
    <body>
    <FORM ACTION="http://localhost:8080/examples/servlets/servlet/UploadTest" ENCTYPE="multipart/form-data" METHOD=POST>
    What is your name? <INPUT TYPE=TEXT NAME=submitter> <BR>
    Which file do you want to upload? <INPUT TYPE=FILE NAME=file> <BR>
    <INPUT TYPE=SUBMIT>
    </FORM>
    </body>
    </html>
    Any help for "translating" this html page into an applet?
    Applet will send, like html page, a string and a file.
    Thanks in advance, Liuk

    If you use something like Apache Http Client you dont have to do any low level implementations.
    Also if you are the one who is writing both servlet and applet you dot have to stick to standerd formats. you can develop your own format and write both servlet and applet to handle it. that kind of thing can be done easily even with URLConnection. But if you plan to send large files then URLConnection may not be the right option becouse I have seen many complaining that URLConnection gives OutOfMemoryErrors when uploading large amounts of data.

  • HTML Page with Applet in JEditorPane

    Hi,
    I have a JEditorPane in which i want to show a HTML page which has an Applet embedded in it. Is there anyway that I can do this as if I just give the URL of the HTML file it gives me a text field with applet tag written in it.
    Or is there any other way that I can embed an Applet in my application in one of Swing components.
    Thanks in advance,

    Update:
    You may want to extend HTMLEditorKit:
    public class MyHTMLEditorKit extends HTMLEditorKit() {
        static ViewFactory viewFac = new HTMLFactory(){
           public View create(Element el) {
              if(el.getName().equalsIgnoreCase("APPLET")) {
                  Applet app = ...; // create applet from other attributes
              else return super.create(el);
    }Check this out. I don't know whether applet elements are included in the parsed document; nevertheless, check it out.
    Fritz

  • A tree-view in HTML page with nodes generated with java script in run time is not visible in the UI Automation Tree. Need Help

    I have a HTML page with an IFrame. Inside the Iframe there is a table with a tree view
    <iframe>
    <table>
    <tr>
    <td>
    <treeview id="tv1"></treeview>
    </td>
    </tr>
    </table>
    </iframe>
    In UIA, i am able to traverse till the tree view but not able to see it.
    I have used the TreeWalker.RawViewWalker Field to traverse the node from the desktop Automation.RootElement. 
    I tried to use AutomationElement.FromPoint method to check whether i am able to get that element. Fortunately i was able to get the automation element. 
    i tried to get the path to root element from the node element using the TreeWalker.RawViewWalker. I was able to get the parent path to the root element.
    But trying the reverse way like navigating from root element to tree node, was not getting the element for me. 
    Please help me with suggestions or inputs to resolve this issue. 

    Thanks Bernard,
    It works fine with JInitiator but not working with
    the JPI. For JPI what settings I need to do ??hi TKARIM and Bernard, i am having similar problem even with the Bernard's recommended setup. could you post the webutiljini.htm (i presume you are using config=test) ?
    i am actually using jinitiator 1.3.1.28 with Oracle HTTP Server of OAS 10gR2) calling Forms Server 6i (f60cgi). After setting up according to Bernard's recommended setup steps, the java console showed that it loaded the icon jar file when it could not read the form, but it skipped the loading of the icon jar file once it read and started the form. How do we specify in the form to pick up the icon from the jar file instead from a directory ? Or do we need to specify ? Any ideas ?
    Thx and Regards
    dkklau

  • How to display HTML formatted text in the field with Item Style: Raw Text

    How can I display HTML formatted text in the field with Item Style: Raw Text.
    Currently the Item Style is Raw Text, but the text is being displayed along with HTML tags without formatting.
    Regards

    Hi,
    Use Item Style formattedText.
    Regards,
    Gyan

  • Viewing HTML page saved  on the server from the browser

    Hi all
    In my application i am having some HTML pages saved on the server. I had given an option to the user to view the HTML page from my application. behind the scene what i am doing is that the view request will get handled by a servlet and from that servlet iam locating the HTML page on the server directory and sending the HTML page to browser by using the Servlet OutputStream. The HTML page is shown on the browser but the attached images are not shown. The images are also there in the server directory and are refered in the HTML file correctly. When i directly open the HTML file then the images are shown correctly.
    Can anyone suggest wat's wrong there.
    The code i m using is
    ServletOutputStream out=response.getOutputStream();
                        if(format.equalsIgnoreCase("pdf"))
                             logger.info("Seleted format is pdf..\n");
                             response.setContentType("application/pdf");
                        else
                             logger.info("Seleted format is html..\n");
                             response.setContentType("text/html");
    String file = ReportingConstants.URL_GENERATEDREPORTS+reportPath+itemName;
    // file : HTML file absolute path as string.
                        URL url=new URL(file);                    
                        BufferedInputStream bis=new BufferedInputStream(url.openStream());
                        BufferedOutputStream bos=new BufferedOutputStream(out);
                        byte[] buff = new byte[2048];
                        int bytesRead;
                        while(-1 != (bytesRead = bis.read(buff, 0, buff.length))) {
                             bos.write(buff, 0, bytesRead);
                             bos.flush();
                        }

    You have to undertsand how the browser handles images and other resources in a HTML page. In the HTML there is an image tag that has a url to an image which can be a reletive url or an absolute url (starts with a "/").
    If the url is a relative url the browser interprets the url as being relative to the url currently displayed in the address field discarding the last element of the url . So if the url in the address bar is http://www.myserver.com/myapp/mypage.html and the relative url is images/myimage.jpg, the browser will submit a request to the server for http://www.myserver.com/myapp/images/myimage.jpg
    Now let's say that you are call mypage.html from a servlet that has the url http://www.myserver.com/myapp/servlets/myservlet. Then when the browser tries to retrieve myimage.jpg it will use the url http://www.myserver.com/myapp/servlets/myservlet/images/myimage.jpg and since this is incorrect it will not be able to display the images.
    One solution to this is to change all of the image urls to absolute urls. That is the start with a slash where the slash represents the start of the url after the application domain name. For example you used an absolute url for myimage.jpg it would look like /images.myimage.jpg and when accessing the page through the servlet url (http://www.myserver.com/myapp/servlets/myservlet) the browser will discard everything after http://www.myserver.com/myapp and look for the image at http://www.myserver.com/myapp/images/myimage.jpg which is the correct url.
    A second solution is to use the HTML BASE tag which tells the browser not to interpret the image tag urls (and other resourses) using the current url in the address bar but to use the url supplied in the HTML BASE tag. The browser will still perform the same process for relative urls but now relative to the BASE tag url. Since the BASE tag url will be the same every time the page is accesssed the images should be correctly accessed no matter how the page is accessed (eg directly, using RequestDistpatcher or via your servlet)

  • Can I display html pages in flash player

    Hi all,
    Can I display html pages in flash player, i mean swf. Plz
    help me if it can be done. Can I call html pages in flash (i mean
    in flash player no new window)
    Thanks

    hi,
    Actullay i want the site to be opened with in the flash
    player, just like iframe in dreamweaver calling the external site
    in the mail html page. Plz Help me accessing external site page
    with in flash player
    Thanks

  • I am using IFrame and displayed Html page

    Hi Friends
                        I am using IFrame and displayed Html page in flex4
                        In this page open to Firefox But not IE please help me.
                          Thanks
                           V.ChandraSekhar

    You have deleted your page, but you have not deleted your page?
    Which is it?
    If you never saved it it is gone. If you saved it in Lion (OSX 10.7) with Pages 09 v4.1, there should be versions available when you mouse overv the document name at the top of the window.
    Peter

  • How to verify JavaScript alert message display on page with C#?

    Hi All,
    I have a question about verify the JavaScript alert message on page. For example, I input the script in browser address like: "javascript:onmouseover=alert('popup windows')" . How to verify there's a alert message displayed on page with C#?
    Thanks

    Are you trying to use some automation or ? What the previous solution is they have put the text in the dom for you to pull out with C# or other languages.
    if you are trying to automate this through a browser maybe look into WebDriver
    WebDriverWait wait = new WebDriverWait(driver, 2);
    wait.until(ExpectedConditions.alertIsPresent());
    Alert alert = driver.switchTo().alert(); var alertText = alert.Text;
    alert.accept();

  • How to show a html page in a swing applet -- URGENT!!!

    Hi All,
    I'm trying to show a html page inside a swing applet... is it possible to do that?? if so is there any built-in classes available for that?? If anyone have some examples, plz help me with that....
    Thanks,
    Ragu

    i havent tested.. but this should work. i am no expert on these either, just to give you an example.. :-)
    JEditorPane ePane = new JEditorPane();
    HTMLEditorKit html = new HTMLEditorKit();
    ePane.setEditorKit(html);
    HTMLDocument htmld = new HTMLDocument();
    try{
    URL url = new URL("http://hcs.harvard.edu/~undercon/");
    InputStream ins = url.openStream();
    ePane.setDocument(htmld);
    html.read(ins,htmld, 0);
    this.getContentPane().add(new JScrollPane(ePane),BorderLayout.CENTER);
    catch(Exception e)
    e.printStackTrace();
    }

  • Designing Embedded HTML Page with iWeb

    I designed a html page with with an embedded html page within it. It all looks fine in iWeb, but when I upload the page to the intenet and I try to view this page it does not come up properly. Although I initially see the page come up as I designed it (for a fraction of a second) it then disapears and I only see the page I embedded on my page.
    I added the following codes in HTML Snippet:
    <object data=http://www.mls.ca/PropertyResults.aspx?&vs=Residential&ret=300&curPage=PropertySearch.a spx&sts=0-0&beds=0-0&baths=0-0&bt=1%2c16%2c17&atsg=%2c&ci=cartierville&pro=4&mp= 500000-0-0&mrt=0-0-4&trt=2&of=1&ps=10&o=D width="600" height="400"> <embed src=http://www.mls.ca/PropertyResults.aspx?&vs=Residential&ret=300&curPage=PropertySearch.a spx&sts=0-0&beds=0-0&baths=0-0&bt=1%2c16%2c17&atsg=%2c&ci=cartierville&pro=4&mp= 500000-0-0&mrt=0-0-4&trt=2&of=1&ps=10&o=D width="600" height="400"> </embed> Embedd a web page within another web page. </object>
    <object data=http://www.mls.ca width="600" height="400"> <embed src=http://www.mls.ca width="600" height="400"> </embed> Embedd a web page within another web page. </object>
    As I said, the above pages come up fine in iWeb but not when I search them with Sagari.
    Can someone please help with this. Thanks, Padano

    This is the proper code :
    <iframe src="http://url.to.file.html" frameborder="0" width="500" height="500" scrolling="no" allowTransparency="true"></iframe>
    You can also use this :
    <div style="width: 650px; height: 650px">
      <script language="JavaScript">
        location.replace('../../../your files.html');
      </script>
    </div>
    Source : iframe alternative in the HTML Snippet
    And on this page you can see how to use <object> for html, png and jpg files :
    Embed content with the <object> HTML element

Maybe you are looking for

  • AUDIO_TS folder is empty after Build completed

    I've just run a Build and a Format (to DDP) of my single layer PAL DVD. The video track was .m2v and the were two .ac3 audio tracks. The Build process completed with no errors. BUT, the resulting AUDIO_TS folder was empty. The VIDEO_TS folder had lot

  • Consuming WebService SAP (J2EE)

    I´m working with Delphi 2007 for Win32 Enterprise and I´m using Delphi to make a client to consuming one SAP (J2EE) WebService, but, there is a problem with my Delphi´s client. The SAP show one error: 001B784233A4004A000000030000195400043C12D73325C4

  • ITunes is pink under Remote Desktop

    I can't change my remote desktop to 32-bit, it's locked to 16-bit. I have a headless media computer hooked up to my main AV rack, I remote desktop into it to do any configuration needed. It's really jarring to see the hot-pink iTunes staring at me wh

  • WRT350N mapping drives

    Is there a way to map the USB drive to a drive letter?  I've tried multiple ways but have been unsuccessful.    I can connect to the drive if I use the search command and open up the folders, but I would like to assign a drive letter for backup softw

  • Relating to IDOC

    Hi, There is a service agreement.Billing document is generated for that service agreement.The issue is that the billing document is having one PO number. Then the billing document is converted into an IDOC, and sent to the customer. the IDOC that get