HTML Page in Applet

I am trying to figure out how to get HTML code to display in a panel of an Applet. Does anyone have any ideas. I have tomcat displaying a HTML file but I need to know how to display it inside of the applet.
Can it be in the same application. I don't want to unload the applet. I would like to see it inside of the applet.
Thanks
Eric

Yeah, bookmark this page! http://java.sun.com/j2se/1.4/docs/api/index.html
This is where I go first when I have questions. I wish more people in these forums would check the javadoc more often :).
Just search in the left frame for JEditorPane and click it to get its documentation. It's not too hard to configure it for html. If it doesn't you could try http://www.javaworld.com

Similar Messages

  • Any Way to display HTML pages on Applet

    Hi All,
    Is there any way to show web pages on Applet?
    Is it possible ?

    I am not aware of a simple way to display HTML in an applet. However, I have used the JEditorPane to display HTML documents. Handling links, etc. with this component requires some effort. Also requires Swing.
    Have you considered using the applet to display a page on the browser. (i.e. getAppletContext().showDocument(URL, [frame name]))? Just an idea.
    Good luck.

  • 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

  • Any "free" classes out there to display an HTML page within Applet?

    I'm not using Swing - so I'd prefer a basic HTML parser and renderer. I just want to make a simple help system for my applet -
    Any ideas?

    Yes JLabel supports HTML, e.g.
    public static void showHelp()
       JFrame frame = new JFrame();
       JLabel helpLabel = new JLabel();
       JLabel.setText("<HTML>This is a <b>help</b> file.</HTML>");
       frame.getContentPane().add(helpLabel);
       frame.setBounds(0,0,200,200);
       frame.setVisible(true);
    }

  • Display applet within html page

    hi there,
    i created an applet using the <embed> tag instead of the old <applet> tag. when i call the html page the applet is displayed in a separate popup. i want the applet to run on the html page - no popup.
    how do i achieve this?
    thanks for your replies!
    koen

    I think your tag isn't quite correct, try this one :
    <HTML>
    <body>
    <OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" width="600" height="300" align="middle">
    <PARAM NAME="code" VALUE="KoenMain">
    <PARAM NAME="type" VALUE="application/x-java-applet;version=1.3">
         <COMMENT>
         <EMBED width="600" height="300" type="application/x-java-applet;version=1.3" code="KoenMain">
         <NOEMBED>
    </COMMENT>
         This page requires a Sun Java Plugin 1.3
         </NOEMBED>
         </EMBED>
    </OBJECT>
    </body>
    </HTML>
    I tried this code (replacing KoenMain by a class of mine) and it works fine, with IE and Netscape, don't forget to specifie size (width, height) in your "EMBED" tag.
    If it doesn't work for you, I think the problem comes directly from your applet code.

  • Html page hides jframe

    I developed an application using jdk 1.2.2. Rcently we updated to 1.5.1. The html page that calls the applet opens. You can see the applet flash, but the html page then hides the applet. If you minimize the html page the applet shows, but I really don't want users to have to do this. I have tried using the visble(), toFront(),show(), and requestFocus() methods but to no avail. I have changed the code on the html page to reflect going after the 1.5.1jdk. Thanks for any help you can offer.
    Jeff

    I developed an application using jdk 1.2.2. Rcently we updated to 1.5.1. The html page that calls the applet opens. You can see the applet flash, but the html page then hides the applet. If you minimize the html page the applet shows, but I really don't want users to have to do this. I have tried using the visble(), toFront(),show(), and requestFocus() methods but to no avail. I have changed the code on the html page to reflect going after the 1.5.1jdk. Thanks for any help you can offer.
    Jeff

  • Annoying screen appears everytime when calling another html page.

    i deployed my form application onto the web successfully. But
    there's one screen (Oracle Developer Server R6i) appearing every
    time I go to another page.
    For example: I have 2 forms A and B, each has its own html page
    containing Applet tab. The application starts from A.html, and
    A will call B.html. This oracle screen displays all the time
    when i click back or forward.
    How can I eliminate it?

    Thank you for your answer.
    The reasons I want to use web.show_document are:
    Firstly I don't know how to close the calling form when open the
    called form. The code works in client/server env, but it just
    hangs there on the web.
    Secondly, I hope to use the web back button to return to the
    previous form.
    Is there anyway i can do to eliminate the splash screen and
    function well?
    My guess is that you are talking about the splash screen that
    you can disable with a paramter in the HTML file.
    But this will not happen if you use normal CALL_FORM or
    OPEN_FORM buil-in in forms to activate one form from the other.
    Don't use web.show_document to open a new form it will only work
    slower that way.

  • How to transport code on this page to applet?

    Hi friends..
    the following page has a program to capture images from a web-cam.. can u help me how to transport that code into an applet. So that i can import that applet into an html page, where the live video can be streamed.
    the link is :- http://forum.java.sun.com/thread.jspa?threadID=247253&start=0&tstart=0
    i tried this code. but on html page the code is not being initialized, though the program is getting compiled correctly.
    import javax.swing.*;
    import javax.swing.event.*;
    import java.io.*;
    import javax.media.*;
    import javax.media.format.*;
    import javax.media.util.*;
    import javax.media.control.*;
    import javax.media.protocol.*;
    import java.util.*;
    import java.awt.*;
    import java.awt.image.*;
    import java.awt.event.*;
    import java.applet.*;
    import com.sun.image.codec.jpeg.*;
    public class applet extends JApplet{
       static final int    WIDTH  = 320;
        static final int    HEIGHT = 320;
        //public intoApplet d = null;
        public static void main(String args[]){
             JFrame frame = new JFrame("Code Converter");
             applet a = new applet();
             a.init();
             frame.getContentPane().add(a);
             frame.setSize(WIDTH, HEIGHT);
             frame.setVisible(true);
        public void init() {
          System.out.println("Applet initializing");
          intoApplet d = new intoApplet();
          getContentPane().add(d);
        public void start() {
            System.out.println("Applet starting");
        public void stop() {
            System.out.println("Applet stopping");
        public void destroy() {
            System.out.println("Applet destroyed");
    public class intoApplet extends JPanel //implements ActionListener
      public Player player = null;
      public CaptureDeviceInfo di = null;
      public MediaLocator ml = null;
      public JButton capture = null;
      public Buffer buf = null;
      public Image img = null;
      public VideoFormat vf = null;
      public BufferToImage btoi = null;
      //public ImagePanel imgpanel = null;
      public intoApplet()
           System.out.print("into swing...");
        setLayout(new BorderLayout());
        setSize(320,320);
        String str1 = "vfw:Logitech USB Video Camera:0";
        String str2 = "vfw:Microsoft WDM Image Capture (Win32):0";
        di = CaptureDeviceManager.getDevice(str2);
        //ml = di.getLocator();
        ml = new MediaLocator("vfw://0");
        try
          player = Manager.createRealizedPlayer(ml);
          player.start();
          Component comp;
          if ((comp = player.getVisualComponent()) != null)
            add(comp,BorderLayout.NORTH);
          //add(capture,BorderLayout.CENTER);
          //add(imgpanel,BorderLayout.SOUTH);
        catch (Exception e)
          e.printStackTrace();
    public void playerclose()
        player.close();
        player.deallocate();
    }

    i tried this code..but on html page the applet isnot
    being initialised. And what error do you get? Look at the Java console.Java Console shows no error..
    when i run the applet class on console by java applet the frame comes and works fine.. but when i do that thru html page..the appl;et is not getting displayed..
    code of html page is:-
    <HTML>
    <HEAD> <TITLE> Hello World</TITLE>
    <BODY>
    This is the applet to check swing component import:<P>
    <APPLET
    CODE = "applet.class"
    WIDTH = "320" HEIGHT = "320"
    >
    </APPLET>
    </BODY>
    </HTML>
    applet.class is placed on same directory as that of html page.

  • Open a html page from an applet

    Hi,
    I would like to open, from an applet, an HTML page in a new window with a specific width an eight.
    Who can help me ?

    Here is an example of applet to javascript with liveconnect:
    http://www.narhari.com/java/applet2javascript/
    You can use the send(String) method from the sample applet to send something like:
    window.open('xyz.html','myPopup','width=200,height=200');in order to open a window with specific dimensions
    of course you can also build HTML in your applet and use send() + some javascript to render it.

  • How to call and run HTML pages from an Applet?

    I want to run another HTML page when pressed a button in an Applet,how can i do it?

    Are you looking for this?
    applet.getAppletContext().showDocument("http://cullenwines.com.au", "_top");

  • How can I display the HTML page from servlet which is called by an applet

    How can I display the HTML page from servlet which is called by an
    applet using the doPost method. If I print the response i can able to see the html document. How I can display it in the browser.
    I am calling my struts action class from the applet. I want to show the response in the same browser.
    Code samples will be appreciated.

    hi
    I got one way for this .
    call a javascript in showDocument() to submit the form

  • Referencing a "locally installed" Java applet from a server-based HTML page

    How does one reference a "locally installed" Java applet from a server-based HTML page (i.e. via the applet, object, or embed tags)? I have seen references in documentation that this is possible, but I have not seen any examples. I have tried a few things, but nothing seems to be working.
    Some background...
    I'm working on a web site that aggregates Internet video. For many users, I would like the site to work "without" requiring Java to be installed (or any prompts, etc.). This version of the site allows users to stream videos directly over the Internet and does not require any sort of access to the local system.
    However, in addition, I have a download manager that can be installed on the local system. Currently, it's a Windows-based "service" that is always running in the background, downloading files, etc. (with plans to later support other OSes).
    My dilemma is trying to communicate between my web site running in the local browser (executing JavaScript code) and the download manager. I call this component the "gateway". I need the gateway to be able to do the following:
    1) Pass user credentials from the web browser UI to the download manager (so it can communicate with my servers).
    2) Check the status of downloaded videos
    3) Launch a local media player (such as Windows Media, QuickTime, etc.) (or perhaps tell the download manager to launch the media player).
    Under Windows XP, I have an ActiveX control that can do these things. It communicates with the download manager via reading/writing to a shared XML configuration file.
    Unfortunately, under Vista and IE7 Protected Mode, ActiveX controls have become very restricted and my gateway no longer works. As such, I am looking at using Java for the gateway (also giving me the additional benefits of supporting additional browsers and OSes).
    From my understanding, I believe I can created a "face-less" Java applet, whose methods can be called from JavaScript. Ideally, I'm thinking I could install the applet onto the local system at the same time the download manager is installed. This would give the applet the security permissions it needs to communicate with the download manager.
    Thanks for any help and suggestions!

    Hi,
    Put the .jar file and the .class file in the path mentioned in one of the aliases in the plsql.conf file like /images or create
    a seperate directory and create an alias like /applets "path" in the plsql.conf file.
    <html>
    <body>
    <applet code=com.chartapplet.chart.BarChartApplet
    codebase=/applets/
    archive=/applets/chart.jar width=300 height=200>
    <param name=background value="white">
    </body>
    </html>
    Hope this helps.
    Thanks,
    Sharmila

  • How to display an image on the HTML page by using applet

    Dear friends,
    I am now writing an java applet, I want to display an image on the HTML page, and tried the following commands:
    {color:#ff00ff}{color:#000000}Image map; //put in the class definition
    map=getImage(getCodeBase(),"hhh.gif"); //put in the function of init()
    g.drawImage(map,0,300,this); //put in the function of paint(){color}
    {color}
    However, when I run it, the image wasn't displayed at all.
    I hope who guys ever come across this problem could help me to solve it. Thank you in advance!
    Hawaii

    Hi,
    I am no expert on Images
    but
    from personal exp.
    are you sure that map actually contains the image?
    try using
    ImageIcon ii = ImageIcon(String name);
    map = ii.getImage();I saw a tutorial on images i think on sun
    where they use ImageIcon to load the image

  • Java Applet in a HTML page: failing with PLS-00306: wrong number of args

    We are trying to use a Java Applet in a HTML page. as our system needs to be able to retrieve a predefined set of data from a third party system that uses Dynamic Data Exchange Protocol (DDE) and are encountering errors from APEX and in IE itself.
    We are using JavaDde from www.nevaobject.com that enables our Java applet to interact with Windows applications (Third Party System) using DDE.
    This functionality is currently used in our Web Form 6i application and we are trying to use the same in the new ApEx application.
    We are using ApEx version : 2.1 and actually aer encountering 2 problems:
    Problem 1: ApEx failing with PLS-00306: wrong number or types of arguments in call to 'ACCEPT'
    Problem 2: IE crashes if Applet used in a complex page with several regions (1 Context, 4 Report Regions, 2 level Tabs, Links)
    This problem does not occur in the page where there is only applet and one region. In the case of complex page the IE crashes if the page is reloaded
    Test scenario:
    1- Create a simple page with the HTML region.
    2- Define the Source of the above region as follows
    <OBJECT CLASSID="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
    CODEBASE="http://java.sun.com/products/plugin/autodl/jinstall-1_4-windows-i586.cab#version=1,4,0,0"
    WIDTH="1"
    HEIGHT="1"
    ID="simpleApplet"
    NAME="simpleApplet">
    <PARAM NAME="code" VALUE="simpleApplet.class" >
    <PARAM NAME="archive" VALUE="simpleApplet.jar" />
    <PARAM NAME="type" VALUE="application/x-java-applet;version=1.4">
    </OBJECT>
    3- Create a simple Java applet "simpleApplet" - for the test its enough if the applet will have just the init method printing out the mesage to the console
    4- Create a Submit Button (not redirect) in Region Header and create unconditional (do not set When Button Pressed property) Page Branch to navigate to another page (the page without the applet)
    6- Run the page and Submit -
    The error below is returned by the engine:
    In our case our applet is called ddeApplet - I do not know why is ApEx passing the Applet's ID down to the wwv_flow.accept method as a parameter
    Tue, 24 Jul 2007 08:15:39 GMT
    ORA-06550: line 7, column 2:
    PLS-00306: wrong number or types of arguments in call to 'ACCEPT'
    ORA-06550: line 7, column 2:
    PL/SQL: Statement ignored
    DAD name: rbdev2_ax
    PROCEDURE : wwv_flow.accept
    URL : http://castor:7778/pls/rbdev2_ax/wwv_flow.accept
    PARAMETERS :
    ============
    P_FLOW_ID:
    147
    P_FLOW_STEP_ID:
    500
    P_INSTANCE:
    6986070096861669560
    P_PAGE_SUBMISSION_ID:
    1005758
    P_REQUEST:
    CRASH
    P_ARG_NAMES:
    100380029717786501
    P_T01:
    147
    P_T02:
    101
    P_T03:
    5000044
    P_T04:
    1
    P_T05:
    S
    DDEAPPLET:
    Ddeapplet[panel0,0,0,1x1,layout=java.awt.BorderLayout,rootPane=javax.swing.JRootPane[,0,0,1x1,layout=javax.swing.JRootPane$RootLayout,alignmentX=null,alignmentY=null,border=,flags=385,maximumSize=,minimumSize=,preferredSize=],rootPaneCheckingEnabled=true]
    P_MD5_CHECKSUM:
    ENVIRONMENT:
    ============
    PLSQL_GATEWAY=WebDb
    GATEWAY_IVERSION=2
    SERVER_SOFTWARE=Oracle HTTP Server Powered by Apache/1.3.19 (Unix) mod_fastcgi/2.2.10 mod_perl/1.25 mod_oprocmgr/1.0
    GATEWAY_INTERFACE=CGI/1.1
    SERVER_PORT=7778
    SERVER_NAME=castor
    REQUEST_METHOD=POST
    QUERY_STRING=
    PATH_INFO=/pls/rbdev2_ax/wwv_flow.accept
    SCRIPT_NAME=/pls
    REMOTE_HOST=
    REMOTE_ADDR=192.168.66.169
    SERVER_PROTOCOL=HTTP/1.1
    REQUEST_PROTOCOL=HTTP
    REMOTE_USER=
    HTTP_CONTENT_LENGTH=661
    HTTP_CONTENT_TYPE=application/x-www-form-urlencoded
    HTTP_USER_AGENT=Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)
    HTTP_HOST=castor:7778
    HTTP_ACCEPT=image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-powerpoint, application/vnd.ms-excel, application/msword, application/x-shockwave-flash, */*
    HTTP_ACCEPT_ENCODING=gzip, deflate
    HTTP_ACCEPT_LANGUAGE=en-us
    HTTP_ACCEPT_CHARSET=
    HTTP_COOKIE=ISCOOKIE=true; LOGIN_USERNAME_COOKIE=rdanko; ORACLE_PLATFORM_REMEMBER_UN=RDANKO:ngrb; WWV_FLOW_USER2=70FBB00945FE46B9; V6_AUTHENTICATION_COOKIE=70FBB00945FE46B9
    Authorization=
    HTTP_IF_MODIFIED_SINCE=
    HTTP_REFERER=http://castor:7778/pls/rbdev2_ax/f?p=147:500:6986070096861669560:::::
    HTTP_SOAPACTION=

    "theArrow",
    It looks like whatever HTML you're including on your page is creating HTML input form elements inside the HTML form "wwv_flow". This form is posted to wwv_flow.accept, and of course, the PL/SQL procedure wwv_flow.accept doesn't know anything these additional arguments/form elements you're attempting to POST.
    Joel

  • 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.

Maybe you are looking for

  • Windows Media Center on my HP TouchSmart PC won't switch channels on my attached Cable Box.

    Have a Motorola DCX3501-M DVR (cable box) connected to my HP TouchSmart PC (Win 7 64-bit) in order to view and record HDTV channels.  Problem is I can't get Windows Media Center to communicate with the cable box properly, e.g., when I select a channe

  • Extended Classic Scenerio and Vendor Text

    This subject has been brought up before, I've reviewed all those messages.  The standard SRM product does not replicate vendor text to the backend system in the extended classic mode. Having said that, I've been trying to make this work and hope some

  • NamedQuery with parameter in IN clause

    Hi I need to execute a query like that returns all the files from the types specified in parameter: select o from file o where o.id in (:ids) tried this : Query query = em.createNamedQuery("File.findByFileIds"); query.setParameter("ids", idlist); idl

  • File Tranfer support in Tuxedo Messaging

    Hi, I would like to know if the file transfer support is there through tuxedo service call or not? We have a scenario where by we need to bring back .pdf files in the output of a tuxedo service call which are already created through a process. I woul

  • Lost iphotos

    Somehow my i photos seemed lost. Then I found them all in one folder (which I did not create). How do I put the contents of this folder back into Iphoto? Just moving the folder over does not seem to do it.