How to show applets in a html file ?

Hi all
I have created an applet with jdev ,and I also generated the corresponding html file and a main method. So the java file runs standalone when I click on the run button , but when I copied the class file and the html file in a web server, then there is nothing in the applet region ! Can anyone help me ?
Here are the code :
Code of the java file :
// Copyright (c) 2001
package pack_applet;
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
* Applet
* <P>
* @author xxxx
public class Capplet extends JApplet {
boolean isStandalone = false;
String x;
String y;
JLabel label = new JLabel();
* Constructs a new instance.
* getParameter
* @param key
* @param def
* @return java.lang.String
public String getParameter(String key, String def) {
if (isStandalone) {
return System.getProperty(key, def);
if (getParameter(key) != null) {
return getParameter(key);
return def;
public Capplet() {
* Initializes the state of this instance.
* init
public void init() {
x = this.getParameter("x", "0");
y = this.getParameter("y", "1");
try {
jbInit();
catch (Exception e) {
e.printStackTrace();
private void jbInit() throws Exception {
this.setSize(new Dimension(400, 400));
this.getContentPane().add(label, BorderLayout.CENTER);
label.setText("x = "+x+" y = "+y);
* start
public void start() {
* stop
public void stop() {
* destroy
public void destroy() {
* getAppletInfo
* @return java.lang.String
public String getAppletInfo() {
return "Applet Information";
* getParameterInfo
* @return java.lang.String[][]
public String[][] getParameterInfo() {
String[][] pinfo =
{"x", "String", ""},
{"y", "String", ""},
return pinfo;
* main
* @param args
public static void main(String[] args) {
Capplet applet = new Capplet();
applet.isStandalone = true;
JFrame frame = new JFrame();
frame.setTitle("Applet Frame");
frame.getContentPane().add(applet, BorderLayout.CENTER);
applet.init();
applet.start();
frame.setSize(400, 420);
Dimension d = Toolkit.getDefaultToolkit().getScreenSize();
frame.setLocation((d.width - frame.getSize().width) / 2, (d.height - frame.getSize().height) / 2);
frame.setVisible(true);
frame.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } });
static {
try {
UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
catch(Exception e) {
e.printStackTrace();
And code of the html file :
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=windows-1252">
<HTML>
<TITLE>
HTML Applet Test Page
</TITLE>
</HEAD>
<BODY>
<SCRIPT LANGUAGE="JavaScript"><!--
var info = navigator.userAgent; var ns = false;
var ie = (info.indexOf("MSIE") > 0 && _info.indexOf("Win") > 0
&& _info.indexOf("Windows 3.1") < 0)
//--></SCRIPT>
<COMMENT><SCRIPT LANGUAGE="JavaScript1.1"><!--
var _ns = (navigator.appName.indexOf("Netscape") >=0
&& ((_info.indexOf("Win") > 0 && _info.indexOf("Win16") < 0
&& java.lang.System.getProperty("os.version").indexOf("3.5") < 0)
|| (_info.indexOf("Sun") > 0) || (_info.indexOf("Linux") > 0)));
//--></SCRIPT></COMMENT>
pack_applet.Capplet will appear below in a Java enabled browser.<BR>
<SCRIPT LANGUAGE="JavaScript"><!--
if (_ie == true) document.writeln('<OBJECT classid="clsid:8AD9C840-044E-11D1-B3E9-00805F499D93" WIDTH = 400 HEIGHT = 400 ALIGN = middle NAME = "TestApplet" codebase="HTTP://java.sun.com/products/plugin/1.2/jinstall-12-win32.cab#Version=1,2,0,0"> <NOEMBED><XMP>');
else if(_ns == true) document.writeln('<EMBED type="application/x-java-applet;version=1.2" WIDTH = 400 HEIGHT = 400 ALIGN = middle NAME = "TestApplet" java_CODE = "pack_applet.Capplet" java_CODEBASE = "Capplet.class" "x" = "0" "y" = "1" pluginspage="http://java.sun.com/products/plugin/1.2/plugin-install.html"> <NOEMBED><XMP>');
//--></SCRIPT>
<APPLET CODE = "pack_applet.Capplet" CODEBASE = "Capplet.class" WIDTH = 400 HEIGHT = 400 ALIGN = middle NAME = "TestApplet" >
</XMP>
<PARAM NAME = CODE VALUE = "pack_applet.Capplet" >
<PARAM NAME = CODEBASE VALUE = "Capplet.class" >
<PARAM NAME = NAME VALUE = "TestApplet" >
<PARAM NAME = "type" VALUE = "application/x-java-applet;version=1.2">
<PARAM NAME = "x" VALUE = "0">
<PARAM NAME = "y" VALUE = "1">
</APPLET>
</NOEMBED></EMBED></OBJECT>
</BODY>
</HTML>
Thank you very much.

you can load your pdf into your browser using
navigateToURL(new URLRequest("yourpdf.pdf"));

Similar Messages

  • How do I download and saves html files off my website to store and save using Dreamweaver CS3?

    How do I download and saves html files off my website to store and save using Dreamweaver CS3?
    I need to save all files from web and store onto a drive to reupload to a new domain name.  I use Dreamweaver CS3.

    First define your Local Site folder in Dreamweaver.  DW will use this folder to store your site files.
    Go to Manage Sites > New or Edit site.  See screenshots.
    Servers:  Enter your remote server's log-in details.  When complete, hit TEST to see if the connection is working.  If all is well, hit SAVE.
    From the Files Panel (F8), click on Remote Server to show the files that are currently there.  Click the green Down Arrow to GET files from remote server to your local site folder.
    Nancy O.

  • How to run an applet(in a html file) in the server?

    I am using the jpedal Viewer inmy code, I embedded the applet code
    in a html file , it is running fine, but when I try to run the same Viewer applet in the Server it is throwing an error
    "java.lang.NoClassDefFoundError: org/jpedal/objects/acroforms/DefaultAcroRenderer
         at org.jpedal.PdfDecoder.startup(Unknown Source)
         at org.jpedal.PdfDecoder.<init>(Unknown Source)
         at pdfViewer.PdfApplet.init(PdfApplet.java:199)
         at sun.applet.AppletPanel.run(Unknown Source)
         at java.lang.Thread.run(Unknown Source)"
    What is the problem ?
    Please suggest solution for it?
    Its urgent

    I am trying to run the Applet in Tomcat server,
    Could you post the code where you invoke the Applet? It sounds like you're saying you're trying to run the Applet as part of your server-side code. The other interpretation is that you are simply accessing the Applet through the browser that happens to be on the machine being used as the server.
    Like I say, post the code that shows how you're trying to use the Applet "on the server".

  • How to get applet to load text file and use it

    The applet is loaded from my site and the short text file is updated by a perl script in my cgi-bin, which is called whenever someone loads the html that loads my applet.
    The text file is just a counter string and I'd like to use it to display #.gif's at a certain place on the applet window (no problem there if I can get the text file into the applet).
    How would I get the applet to load the text file into a string or array?
    It has a running thread and I'd like it to update it periodically.

    I believe you can do that with Class.getResourceAsStream.
    Or you can do it explicitly with java.net.* stuff.

  • How do I update web template HTML files on MAC

    I'm running lightroom 4.3 on a PC. The web template needed a few changes making, mainly the layout and replacing links for images etc., I could not find a way to update via lightroom so I changed the detail.html and grid.html files directly in C:\Program Files\Adobe\Adobe Photoshop Lightroom 4.3\Shared\webengines\default_html.lrwebengine. Now I need to make the same changes in lightroom 4.3 on a MAC, but have no idea how to locate the same files and update?
    Please can someone help me?

    The equivalent location on the Mac is:
    //Applications/Adobe Photoshop Lightroom 4/Contents/PlugIns/Web.lrmodule/Contents/Resources/galleries/default_html.lrwebengine
    To see either of the Contents folders in the above path, you have to Command/Right-click on the previously mentioned file (Adobe Photohsop Lightroom 4 and Web.lrmodule) and choose Show Package Contents.

  • How to show java program on html

    i have gotten some program fm a website. the program was in java form which is save as .class. can i know how do i display my result in the html??
    thanks alot!!

    you may write a applet,for example:
    import java.awt.*;
    import java.applet.*;
    public class Testexample extends Applet {
         public void init() {
         public void paint(Graphics g) {
              g.drawString("Welcome to Java!!", 50, 60 );
    compile this java.and then write a html in the same path with Testexample.class:
    <HTML>
    <HEAD>
    </HEAD>
    <BODY BGCOLOR="000000">
    <CENTER>
    <APPLET
         code     = "Testexample.class"
         width     = "500"
         height     = "300"
         >
    </APPLET>
    </CENTER>
    </BODY>
    </HTML>
    now you may show this java program from html

  • How to set default value for html:file in struts

    hi
                   i am working on an application using struts situation is i am using the
    <html:file property="" /> to allow the user to upload file. but i need that a default file should be set so that even if the user donot click browse ie                the user wish to upload that default file the default file get uploaded on page submition.     Is it possible to set any default value for html:file ...if yes plz provide any suggestion or links how to achieve this.     thanks in advance

    www.google.com?q=STRUTS+DOCUMENTATION

  • How to display Image/Logo in Html file generated from Webdynpro App

    Dear All,
      I have developed a webdynpro application and onClick of the Button I am opening  a new browser by generating HTML file.The file is opened successfully.
    My requirement is to display the company logo on that HTML file.  Where to place that image file and how to call that image file in my HTML.
    Regards
    Ponnusamy

    Hi,
    Ex. 1 - If the Index file is in the same directory, called "test"
    tales/numbers.jpg
    Ex. 2 - If the image is in a subdirectory, called "test1" within "test"
    test/test1/numbers.jpg
    img src="test/test1/numbers.jpg"
    Regards
    Ayyapparaj

  • Dumb PHP ? How do I use PHP in .html files.[solved]

    I've googled but I just seem to be missing it.
    Could someone please point me to documentation or tell me what/how do I enable the Apache server to process inline php in .html files?
    Last edited by FeatherMonkey (2008-03-25 16:51:21)

    http://www.desilva.biz/php/phpinhtml.html
    Instead of using htaccess, you can just change httpd.conf.
    Last edited by lucke (2008-03-25 16:02:56)

  • How can i include css in html file when exported

    I want the CSS should be included in the html file when exported, how is that posable?

    Muse follows its own structure and keeps HTML, CSS and JS code in separate files as and when possible. If you want all that code to be merged into the HTML file itself, then there is no option to force Muse to do that. You can however, add your own CSS code into the HTML page by adding the CSS using either the Insert HTML option or using the HTML for <head> option in Page Properties > Metadata.
    Cheers,
    Vikas

  • How to use substring in  ITS(HTML file)

    Hai,
    I am modifying d_searchhelp.html file in agate. I want a use a substring function this file. So I used the below code.
      newclassname=~searchhelpcontrolname;
      oldclassname=newclassname.substring(0,8);
                                                                ^ ^ ^
    This is the error i got when i use this HTML file in searchhelp.
    @ ...\templates\system\dm\msiexplorer\d_searchhelp.html (263,42): error : syntax error   : '('
    @ ...\templates\system\dm\msiexplorer\d_searchhelp.html (263,44): error : syntax error   : ','
    @ ...\templates\system\dm\msiexplorer\d_searchhelp.html (263,46): error : syntax error   : ')'
    Please let me know how to use substring.
    Thanks & Regards,
    H.K.Hayath Basha

    Hello H.K.Hayath Basha,
    please see the HTML Business documentation on <http://help.sap.com/saphelp_nw04/helpdata/en/5f/1fb5174aee11d189740000e8322d00/frameset.htm>:
      string strSub (in string string, in int position, in int length)
    With regards,
      TJ

  • How can i render a dynamic html file in jsp page

    Hi everybody,
    i am trying to render a dynamic html file in jsp page with the result of querying a database.
    The response of the query is a xml document. And i have a stylesheet to transfer it to html.
    How can i render the html in a jsp file?

    I am using below code for HTML files
    private var appFile:String="index.html";
    if (StageWebView.isSupported)
                        currentState = "normal";
                        webView.stage = stage;
                        webView.viewPort = new Rectangle( 10, 130, (stage.stageWidth)-20, 750 );
                        var fPath:String = new File(new File("app:/assets/html/aboutus/"+ appFile).nativePath).url; 
                        webView.loadURL(fPath);
                        addEventListener(ViewNavigatorEvent.REMOVING,onRemove);
                    else {
                        currentState = "unsupported";
                        lblSupport.text = "StageWebView feature not supported";
    above code is working fine for me.

  • How to give security permission for html file which is accessing a database

    there a applet code which is accessing database and i am placing that code in one folder in any drive and iam placing a
    applet tag in a html file and storing on desktop.
    now if i run that html file i am unable to connect to database and it is not not giving any exception errors.
    what is the security permission we have to provide for that html file.
    i want this solution immediately plz.

    sign your midlet suite and give the permission in the jad / manifest
    http://java.sun.com/j2me/docs/wtk2.2/docs/UserGuide-html/security.html

  • Plsss help me: how to set default values in html:file and html:radio

    Hai,
    To set default value to text box i use the following code. It works well.
    <html:text property="modifyserverdesc" value="<%= serverDesc%>" styleClass="text" size="38"/>But for file i use the code
    <html:file styleClass="file" property="modifyserverimgfile" value="<%= serverImage%>" size="40"/>It doesn't display value. What is problem here?
    how to set default selection in <html:radio>.

    No it won't help.
    You can't set a value into an <input type="file"> control at all. The user has to put values in themselves.
    The reason behind this is security. If the programmer could put any value they liked in there, you could upload any file at all from a users computer without their intervention. eg C:\windows\system32\passwords.txt
    Bottom line: you can't put a default value into the input type="file" control.
    And a good thing too ;-)

  • How to add css styles in html file generated from Report builder?

    Hi,
    I schedule report in web browser,but the generated report html file looks very simple and doesn't correspond with the other html files which have css styles.So I want to add css styles to the generated html file from *.rdf in report builder.That is to say I should integrate css style with myReport.rdf.Can anybody tell me how to do that?
    thanks in advance.
    Regards
    jungle

    hello,
    i am not quite sure, what you want to achieve. did you try the DESFORMAT=HTMLCSS which generates inline-style-information.
    regards,
    the oracle reports team --pw                                                                                                                                                                                                                                                                                                                                                               

Maybe you are looking for

  • How to get fixed field length when download a CSV  file ?

    hi all ,     I had downloaded a CSV file from an ALV list which created by myself. the current layout of the CSV file is : aaa;bbbbbbbbbb;cc;                                                                      for example . but what i want is : aaa 

  • Error while opening Tcode EC51E Change Move-in

    Hi, In My project we have CRM 7.0 + ISU ECC6.0 , we use IC Webclient for Move-in Process. Once the Move-in is done and I check the Move-in document in T-code EC51E I get following error , "No Defult product for Service Type maintained in Table ECRMSE

  • XML string to XML parsing in JCD

    I have stored an XML file as a CLOB in the Oracle DB. While fetching this data into JCD using Oracle OTD, I am getting this CLOB field as a string containing the XML. Now I want to parse this XML string to XML, as I need to map the individual fields

  • Creating R/3 service orders from CRM

    Hi Experts I am working on an scenario in the Interaction Center WinClient where complaints can be registered concerning iobjects. For now, we have made the design using activities, where the objective is to simple register complaints. However we wou

  • Was the Smart Playlist podcast order bug on iPod nano fixed in iTunes 11

    iTunes 9 broke the order in which Smart Playlists play podcasts in on the Nano.  See "Smart Playlist order not respected on ipod nano after upgrade to iTunes 9" (https://discussions.apple.com/thread/2154509).  Has this been fixed in iTunes 11?