• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

put an applet into a web page

 
Hui Zhao
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi, my codes works well in NetBeans as an applet, but why no appearance in a html.

One thing I must mention is I create my code that works both as an applet and as a stand-alone application.
I have three class: Combox.java ,Drawing.java and TextCell.java.
The code structure looks like
Thanks for any help.
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The HTML tag is called "applet", not "Japplet".
 
Hui Zhao
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have changed, but only a retcange frame showed, no any components.
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are there any messages in the browser status bar, or the Java Console?
 
Hui Zhao
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, but in my class "TestCell", File I/O indeed exists.
Is the reason or not?

Thanks
 
Hui Zhao
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
One thing I forget is:
Press Spacebar or Enter to activate this control
activate the control is to click inside the border of the applet.
But I click anywhere, nothing.
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do applets work in general, e.g. the ones on this page? Can you try it with a different browser than IE?
 
Hui Zhao
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All the examples works well except mine.
I tried them in IE and Firefox.
Dawn!
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does the applet contain code that actually shows something? I'm asking because the code you posted does not seem to do anything graphical.
 
Hui Zhao
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok,first thanks for your nice reply.Then my code is:
 
Hui Zhao
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The error from Java console is
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Applets are not allowed to do file I/O, unless they are signed, or the local security policy altered. That's what's causing this exception. See HowCanAnAppletReadFilesOnTheLocalFileSystem for more details.
 
Hui Zhao
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes,I am doing a self-signed certificate, I followed an example on the web.
But I got wrong at some step. Any help, thanks.
Where is the file migsuncert.crt located?
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Hui Zhao:
Where is the file migsuncert.crt located?

C:\Program Files\Java\jdk1.6.0_01\bin>keytool -export -alias migkey -file migsuncert.crt
Enter keystore password:
keytool error: java.io.FileNotFoundException: migsuncert.crt (Access is denied)


The filename is used for the certificate file you're trying to export to; it doesn't exist yet. Does the account you're using possibly not have write permissions for that directory? That's another reason for that exception to happen.
 
Hui Zhao
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I signed successfully in another machine.
And I follow the instructions in the book "Java Cookbook".
You can now sign the JAR file with your test certificate:

The jarsigner tool updates the META-INF directory of your JAR file to
contain certificate information and digital signatures for each entry in the archive.
Now I have two questions.
1)What is meant by the term "META-INF" directory?
2)Because my applet contains File I/O, after this step can I run my applet?
 
Ulf Dittmer
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is meant by the term "META-INF" directory?

Jar files contain a META-INF directory which in most cases contains just a single file: the manifest. In it you'll find various pieces of meta information about the jar file, including information about its signature. That's why it is updated if the jar file is signed. The jar file specification has more details on this.
Because my applet contains File I/O, after this step can I run my applet?

It should run. Have you tried it?
 
Hui Zhao
Ranch Hand
Posts: 116
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
okay,it works well.
One more question:why the height is 0, how can I set it?

Thank you very much.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic