Applet problem

Page 1 of 1

1 Replies - 57 Views - Last Post: 04 February 2012 - 08:13 PM Rate Topic: -----

Topic Sponsor:

#1 Dankwansere  Icon User is offline

  • D.I.C Head

Reputation: 22
  • View blog
  • Posts: 103
  • Joined: 09-November 09

Applet problem

Posted 04 February 2012 - 08:09 PM

Hey guys, I'm learning Java applets in my course now. I've written a simple applet to test out how applet works. I've wrote a basic applet with a JLabel inside which says "Welcome to Java" but for some odd reason when I run the applet in Eclipse it runs fine with the JLabel showing. But when I try to run it from a web browser I see a blank applet screen with no JLabel showing :s, and also when I use the applet viewer in the terminal to run the applet, I still see a blank screen with no JLabel :s here's my code...

Applet code
import java.applet.*;  
import java.awt.*;
import javax.swing.*;
public class applet extends JApplet
{
	private JButton B1 = new JButton("Gege");
	//private JLabel L1 = new JLabel("welcome to Java");
	
	public void init()
	{
		//add(B1);
		add(new JLabel("Welcome to java", JLabel.CENTER));
		
	}
	
	

}



HTML Code
<html> 
	<head>
		<title>Java applet</title>
	</head>
	
	<body>
		<applet
		
		code = "applet.class"
		width = 350
		height = 200>
		
		</applet>
	
	</body>

</html>



Is This A Good Question/Topic? 0
  • +

Replies To: Applet problem

#2 macosxnerd101  Icon User is online

  • Self-Trained Economist
  • member icon


Reputation: 7523
  • View blog
  • Posts: 28,896
  • Joined: 27-December 08

Re: Applet problem

Posted 04 February 2012 - 08:13 PM

With 71 posts you should know the rules. Please don't open duplicate threads.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1