Home » Blog » Java » Web Applications » Applets / Webstart

Applets / Webstart

Handling Keyboard Input and Mouse Events

Keyboard Input and Mouse Events In this example, I show you some simple input examples using Applets. Later I might add Web Start or even Swing Desktop examples. Here we get keyboard input (typing) as keyDown event. And we get mouse positions and clicks. We demonstrated mouse input as move, clicks and mouse drag and drop with a more complex example using a vector sprite stickman. See also Sound Effects and Music Keyboard Input Here I give you sample HTML needed. Put the source and HTML in the same folder and compile the source with 'javac KeyTest.java' Save this as 'keyboard.html' then run it at the console with 'appletviewer keyboard.html' . Note that you will have to give the window focus by clicking it, then when you press a key, output in the console will show which key was pressed. It...

Applets Webstart: Java Applets and Webstart

Java Applets and Webstart Java Applets Java applets are mini-applications which run within another application. Applets actually could be run as a desktop application with Java's appletviewer.exe program. And actually, that may be the only way to make an applet run at the current day and time. Well, a better way to run an applet is to convert it to Web Start application which I talk about later on in this article. Applets lost popularity Java applets were quite the rage when Java first appeared on the scene. Applets are primarily run on a web page. However over time they lost popularity. Reasons for this might include applets being slow to startup. Another was applets not starting up at all which usually had a fix but was frustrating enough from the end user point of view to cause a loss i...