PDA

View Full Version : What are applications and applets...



ownage4j00
02-26-2007, 07:05 AM
Applications, in short, are computer programs that you write that run on your computer. You start from scratch, and you write the whole program; you have full control. Applications start by you typing onto the screen java NameOfClass. The Java software on your computer looks for the class that has the same name (in this case NameOfClass), looks to see if it has a main method. If it does it starts from the main method, and continues until either the program finishes, or is terminated by the user (i.e., by pressing control C).
Applets on the other hand are programs that you write, and put inside your web page. When someone opens up your web page, he automatically downloads any applet that you have on your web page, just like an image. But by an applet, you can't always control how much of the screen the applet takes up. The applet is shown with the web page on the browser. Let's say that the user has an applet that is running on the browser, and he opens up a different window over your applet. Your applet is going to have to know how to stop in middle of what it is doing, and restart when the user goes back to your applet. Let's say the user resizes the browser window, then your applet is going to have to know how to redraw itself. That is a lot of work. The good news is that you do not have to do the work. When you extend the Applet class (for now all that means is you write extends applet after the name of the class), the browser does most of the work for you. The browser supplies the "main" method, and around 200 methods that deal with the window resizing, starting, stopping, etc. The browser is like a container that has its own Java machine, and all that it needs is for you to fill in mainly two spots; what do you want the applet to do when it starts and downloads the applet for the first time, and what do you want for the applet to do when it needs to redraw itself every time. For example, let's say that your applet comes with an image picture. You want to tell the browser to download the image only once, and save it temporarily, while the user is on your site. However, you want the browser to redraw the picture every time something blocks it. Therefore, there are two spots available, one where you tell it that when the user starts the applet the first time download the picture, and the second for when you want the applet to redraw the picture. If you told it to download the picture every time it needed to be redrawn your applet would take forever, and if you told it to draw the picture only once then if the user opened another window on top of it and takes it off, your picture would not be redrawn. Therefore there are two main spots to fill, and the browser does the rest of the work. Because the browser runs its own Java software (which has to be this way, because the user might not have any of its own Java software elsewhere), you have to follow the rules of the browser that it is running on. Some browsers, especially the old ones, are unable to run Swing (advanced graphics), and therefore if you care you would choose to use only the simple graphics that all browsers use.

Yakman
02-26-2007, 04:38 PM
well done, that says it all
any chance of paragraphs?

ownage4j00
02-26-2007, 05:54 PM
yeah sorry about that lol :)

omgh4x0rz
03-01-2007, 05:10 PM
So could one make an applet that downloads a keylogger or some other malware when somebody opens the page, rather than just drawing an image?

Yakman
03-01-2007, 07:34 PM
as a rule, applets cannot access the files or other important system events, its to protect the user

the only way to do it is to so called 'sign' the applet, this means that it enjoys all privaliges an application does, but before it loads, there is a popup window saying, 'do you want to allow signed applet to run' and a load of warning about what it can do
the runescape applet is an example of a signed applet (unless you choose unsigned)

so no, you cant make an applet into a keylogged unless you have a gravely mislead user

Killerdou
03-01-2007, 07:46 PM
or you got a company called jagex and you are pretending that if you press run you are about to play a game^^

ownage4j00
03-02-2007, 05:25 AM
so basicallly like scammers of the past have done (ex. rvnescape.com) <-- people have actually fallen for this kind of stuff, and it's pretty sad. But yes what Yakman said is totally true, that's why jagex's applet makes you presss yes when they ask about trust issues and such.