"write once, run anywhere." this has been the mantra of java developers since day one. the philosophy has given us great flexibility and power, but always with trade-offs. certain types of programming have effectively been off-limits to java developers because of the speed requirements or access to native services. now, finally, things are looking better. jit virtual machines and moores law have taken care of the speed improvements and the new java.net/">jdesktop integration components finally let java developers write programs that tie closely to the native operating system. java.net/pub/a/today/2004/10/14/jdic1.html">part one of this series covered the desktop, file, browser, and system tray components. in this article, we will explore an entirely new area, the java.net/documentation/incubator/screensaver/index.html">saverbeans sdk, which lets us write screen savers entirely in java. we will go from a simple example to adapting a particle simulator with user-supplied configuration.
a screensaver seems like a simple thing: just fill the screen with a pretty animation and youre done. sadly, nothing in the world of computers is that simple. a screensaver must be packaged in a certain way for the host operating system to recognize it and launch it at the correct time. and, of course, every operating system has its own way of doing this. since jdic was already doing such a great job of unifying disparate platform-specific apis, it was only logical to tackle this one as well. the saverbeans sdk is an incubator project that provides a cross-platform api for accessing the screen, along with a packager tool to produce platform-specific executables. saverbeans doesnt come with any screensavers, but there is java.net/">a secondary project where various java.net citizens have posted their own creations. 【程序编程相关:Java Tech: Acquire I】
what is the saverbeans sdk? 【推荐阅读:The Java Extension M】i should mention at this point that saverbeans supports windows, linux, and solaris, but not the mac. the saverbeans api uses native code underneath to do its magic, and no one has written a hook into the os x screensaver api yet. if you know a little bit about native os x programming, then please join the java.net/">jdic project and help out. 【扩展信息:Using the Strategy D】
in this article, you will learn how to build a simple countdown screensaver; what to download, how to create your classes, and how to package it all up. you will also see how to take an existing program and convert it into a screensaver, including user configuration.
a simple example... 下一页