Responsive Ad Area
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. Keyboard Input Here I give you sample html needed. Put the source and html in the same folder and compile the source with 'javac' Save this as say '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 will also show they key you p...

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. Java applets were quit 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 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 in popularity. Applets may have...

Skip to toolbar