bookmark - Where Can I Learn To Make Java Applets ? Where can I learn to make java applets ?

Where Can I Learn To Make Java Applets ? - Where can I learn to make java applets ?

 
 Discussion by mongos with 5 Replies.
 Last Update: May 3, 2005, 12:47 am
 
bookmark - Where Can I Learn To Make Java Applets ? Where can I learn to make java applets ?  
    
free web hosting
 
I would like to learn making java applets. But I don't know where I can learn it ! Could you help me ?

Sat Feb 5, 2005    Reply    New Discussion   


Did you look at SUN's tutorial page? I'm not into creating java or java applets but there should be some good tutorials here.
http://java.sun.com/developer/onlineTraining/

Enjoy

Nils

Sat Feb 5, 2005    Reply    New Discussion   

Probably the best way to do it is to take a class or to learn from a sibling or parent A book would be useful, too.
After that, it'd be good to try online tutorials.
I really have found learning Java to be very difficult. My best luck has come from looking at examples from Freewarejava.com that has something to do with what I want to do.

Sun Feb 6, 2005    Reply    New Discussion   

How much do you understand about Java? basicly an applet is the same as a regular java program except for some key things

The general form of an applet is

CODE

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

public class Example extends Applet
{
   
    public void paint(Graphics page)
    {
         //code for creating graphics go here
    }
    //any additional methods or code go here
}


You will also need a HTML launch page to launch the applet in a web browser. here is a simple one:

CODE

<APPLET CODE="Example.class" WIDTH=500 HEIGHT=500></APPLET>

"WIDTH=500" sets the width of the functioning area for the applet
"HEIGHT=500" does the same thing for the height
"APPLET CODE="Example.class" tells the brower to use the code in the class file Example.class to run the applet once it is open


to create this HTML just open notepad write that line of code as it applies to your applet and save it as a .html file this needs to be in the same folder as the class file.

heres some example code of an applet I wrote for a class

CODE

// Program: Bouncing Ball
// Author:  Michael Kurelja
// Date:    1/31/05
// Email:
// IDNUM:
// File ends with "End-of-File"
// This applet draws an animated bouncing ball with uniform speed.
// The ball starts at the center of the graphics page and bounces off
// the top and bottom.

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

public class BouncingBall extends Applet
{
[tab][/tab]// Dimensions of Applet:
[tab][/tab]public final int width = 500;
[tab][/tab]public final int height = 500;
[tab][/tab]// Size and speed of ball:
[tab][/tab]public final int diameter = 20;
[tab][/tab]public final int speed = 5;
[tab][/tab]// Milliseconds to pause between frames:
[tab][/tab]public final int pause = 20;
[tab][/tab]public void paint (Graphics page)
[tab][/tab]{
 //position1 controls the position of the ball, increment controls the direction:
 int position1 = 0, increment = 1;
 setBackground(Color.blue);
 page.setColor(Color.red);
 page.fillOval((width/2)-(diameter/2),(height/2)-(diameter/2),diameter, diameter);
 //sets the position1 int to the center of the screen for the height variable:
 position1 = (height/2) - (diameter/2);
     // Loop forever:
 while (true)
   
 {
    [tab][/tab] //sets the color of the ball to red:
[tab][/tab] page.setColor(Color.red);
    [tab][/tab] //moves the ball up or down:
[tab][/tab] if (position1 <= (500 - diameter) && position1 > 0)
    [tab][/tab] {
   if (increment == 1)
   {      
  [tab][/tab] position1 = position1 - speed;
  [tab][/tab] page.fillOval((width/2)-(diameter/2), position1, diameter, diameter);
   }  
   else if (increment == 0)
   {
  [tab][/tab] position1 = position1 + speed;
  [tab][/tab] page.fillOval((width/2)-(diameter/2), position1, diameter, diameter);
   }        
     
[tab][/tab] }
     
[tab][/tab] // the following 2 "else if ()" statements switch the direction of the ball:
[tab][/tab] else if (position1 <= 0)
[tab][/tab] {
       
   increment = 0;
   position1 = 1;
[tab][/tab] }
[tab][/tab] else if (position1 >= (500-diameter))
[tab][/tab] {
   increment = 1;
   position1 = (499-diameter);
[tab][/tab] }
     
[tab][/tab] // Pause between frames:
     
[tab][/tab] try {Thread.sleep(pause);}
     
[tab][/tab] catch (Exception e) { };
     
[tab][/tab] //erases the previous ball:
[tab][/tab] page.setColor(Color.blue);
     
[tab][/tab] page.fillOval((width/2)-(diameter/2), position1, diameter, diameter);
   
 }
 
[tab][/tab]}


}


// End-of-File

Fri Apr 22, 2005    Reply    New Discussion   


Also, if you ahve any specific questions, you can ask at YouLikeJava.tk. But those forums aren't close to being as established as the Java forums at java.sun.com.

To get a taste of aplets (open source) try javaboutique.com

HOpe you get going with Applets soon.

Mon Apr 25, 2005    Reply    New Discussion   

Hi mongos,

I think you already have starded learning Applet. I hope you are enjoying the power of Java.

Before going further, it's important for you to understand something about Java. I think you should already have read about it .... but if not, it's time.

When talking about Java, you will often ear about Java 1 and Java 2. I'm not going in the details. Java 2 introduced the Swing which is a set of classes (API-Application Programming Interface) for gui building. Beforce, java coders used to work with AWT (you should read about all this).

AWT use heavy components (heavy to draw) and Swing came with light weight components. You will often see 'J' before some classes like Applet end JApplet. That's where i wanted to come.

Applet is not longer used. Instead, you will have to use JApplet. So if you are still working with Applet, update your code and read about differences.

One thing is very important also when you use Applet (JApplet). The security side. If you dont "sign" your applet, the browser can block its running.

http://java.sun.com/docs/books/tutorial/applet/index.html

It's so cool to code and most of time we don't take enough time to read before coding.
Read first, design all you wan to do on this cool and so usefull white paper, then start coding.

Good luck with the coffee!

Tue May 3, 2005    Reply    New Discussion   

Quickly Post to Where Can I Learn To Make Java Applets ? Where can I learn to make java applets ? w/o signup Share Info about Where Can I Learn To Make Java Applets ? Where can I learn to make java applets ? using Facebook, Twitter etc. email your friend about Where Can I Learn To Make Java Applets ? Where can I learn to make java applets ? Print
Reply / Comment Ask a Question? Share / Bookmark E-Mail a Friend Print

Jhotdraw JHOTDRAW  Jhotdraw JHOTDRAW (6) (21) Array Sorting Does anyone hava a decent JAVA method  Array Sorting Does anyone hava a decent JAVA method