LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices

Reply
 
Search this Thread
Old 05-20-2007, 03:26 PM   #1
basak
Member
 
Registered: Jul 2006
Posts: 41

Rep: Reputation: 15
java applets


Hi,
For a standalone application, I wrote a Java class which extends JFrame. When I execute it, it works well, the content I want to display appears as a pop-up window. Now, I want to display the same content in the web browser as an applet. Searching on the internet, I thought I found the way to implement it. I built a new class RunApplet in a file RunApplet.java as below:

import java.awt.*;
import java.applet.*;

public class RunApplet extends Applet {
public void init() {
GameGUI myA = new GameGUI();
myA.setVisible(true);
}
}

GameGUI is my class which extends JFrame. Then I wrote an htm file as below:

<html>
<head><title>Network Project</title></head>
<body>
<applet code="RunApplet.class" width=750 height=700></applet>
</body>
</html>

When I write the URL in address bar, there is displayed nothing on web browser. It says Applet is started, however no content is displayed. What is wrong with my code? Any ideas??..
My knowledge of Java is really limited..I really need help..Thanks..
 
Old 05-20-2007, 03:49 PM   #2
Alien_Hominid
Senior Member
 
Registered: Oct 2005
Location: Lithuania
Distribution: Hybrid
Posts: 2,247

Rep: Reputation: 53
Frame in applet is browser's window.
You can directly add any component to applet, because it extends panel.

Code:
import java.awt.*;
import java.applet.*;

public class RunApplet extends Applet {
  public void init() {
	add(new Button("Hello!"));
	setVisible(true);
  }
}
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
, won't appear in Java applets JussiKp Linux - General 3 12-08-2006 03:51 AM
Need Help In Oragainzing The Java Applets mema_UAE Programming 3 05-01-2006 12:56 PM
How do I use java applets? brooks_45 Linux - Newbie 6 02-01-2006 05:47 PM
java applets nOOb1kanobee Linux - Newbie 1 02-25-2004 02:47 AM
java applets not working... siva_bhavani General 4 09-29-2003 10:08 PM


All times are GMT -5. The time now is 06:39 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration