Posted by editor
on February 28, 2008 at 7:42 AM PST
AWT and Swing windows get opacity options other than 1.0 and 0.0. Also:
Weblogs: Shaped and translucent AWT windows, closure syntax concerns, and Project Royal Jelly
Java Today: Google Summer of Code 2008, Open eHealth initiative, and easy web site creation with NetBeans
Forum Posts: When to use wizards, Unicode escapes in properties files, and pure Java input methods
AWT and Swing windows get opacity options other than 1.0 and 0.0
Befitting the title, Josh Marinacci had a very hacky approach to providing transparent/shaped windows in our book Swing Hacks . Basically, what he did was to use the AWT
Robot class to snap a picture of the screen right before showing the window, calculate the portion of the screen overlaid by the soon-to-appear window, and then use those pixels as the background of the window, for the parts that were to appear transparent. This served to make parts of the window transparent, which can also be used to provide shaped windows (in which case the transparent pixels are just around the corners and edges of the window, which itself is still rectangular).
As you might imagine, this was more a cute trick than a practical approach. We did say it was a "hacks" book after all.
But now, we're getting the real deal, as reported in a blog by KirillÂ Grouchnikov, Translucent and shaped windows in core Java . His blog shows off some screenshots of the various effects supported by build 12 of JDK 6.0u10, and links to his personal blog to describe the code required to achieve these effects.
So, you might be asking, is this just eye-candy, something that lets developers get cute with their GUIs? Well, the test of that will be in how it's put to use, but it's worth noting that these techniques will allow AWT and Swing apps to provide the "HUD Window" that has become all the rage in Mac OS X apps. Like this:
Blogger Austin Heller describes them as "those semi-transparent black windows you see occasionally in applications," and goes on to say:
Over the past couple of years, they've been showing up as pleasant-looking replacements for palettes, and, when implemented properly, can be useful when you have a lot of data to manage -- after all, it's a lot easier to see through a semi-transparent window than a totally opaque one.
They must be pretty intuitive, because while I keep bringing up the opaque DVD controls on the Mac with the ESC key, my five year old son has figured out that just swooping the mouse over the movie brings up a translucent, self-dismissing HUD with basic playback controls (like the QuickTime Player image above), and mousing to the top of the screen brings up a HUD of illustrated chapter stops, something completely unavailable to my old-fashioned, opaque GUI widget. I'm so 2002.
Translucent and shaped windows used to be the vain playground of WinAmp skins, but it turns out they can be quite useful. And now they're available to AWT and Swing. This should be fun...
Also in today's Weblogs , AlexÂ Winston expresses concerns over Closure Syntax in the various Java 7 closure proposals.
"I appreciate the effort put forth in both the BGGA and FCM proposals to add closures to the Java language but I have a concern regarding the apparent disregard for a syntax that is within the spirit of the language."
Finally, Mark A.Â Carlson points out a new project in
Introducing Project Royal Jelly - Java for Fixed Content .
"Project Royal Jelly is a new project to add interfaces which allow Java to be used in the Data Path of storage devices. One of the standards we will be leveraging is the storage industry standard XAM (http://snia.org/xam ) interface for fixed content. An initial code drop has been made at the project web site."
In Java Today ,
Google has posted details of this year's Summer of Code program. The FSoC is a program that offers student developers stipends to write code for various open source projects. Last year, the program worked with 130 organizations to fund about 900 projects. Several java.net projects have participated in previous years, including JXTA , SIP Communicator , and Project Looking Glass . The program will begin accepting applications from mentoring organizations on Monday, March 3, 2008, and student applications on Monday, March 24th; more details are available in a program FAQ .
From The Aquarium : "Afga ,
Sun have launched the
Open eHealth initiative to leverage
Open Source in the Health industry.
Open eHealth's goal is to create a
community-driven software development platform to speed up the digitization of the healthcare industry,
with emphasis on delivering interoperable, standards-based solutions.
The service components will extend existing open source projects such as
More details in
Press Release and at the
Open eHealth WebSite ."
The SDN has published a new article for beginners, Easy Web Site Creation in the NetBeans IDE , in which Dana Nourie shows "how incredibly easy it is to create a web site in NetBeans through drag-and-drop without writing code, and how you can gradually learn Java programming by adding to your JavaServer Pages (JSP), and creating other features or programs that may be added to your site."
In today's Forums ,
discusses UI appropriateness in
Re: UI Design Standards: Hiding "Not Applicable Fields"
"It depends, but I think the most user friendly one would be a wizard. At the first page you pick what to build (and some common input like name etc). The next page changes based on what is picked (car -> wheels config page, boat -> sails config page). However, if the type specific options are only one or two, I usually hide the non relevant input fields. But they are at the end of the input panel (the common fields stay in the same place), but do not make the panel smaller dynamically (I personally would not like size jumping dialogs). I disable inputs when the user is allowed to edit it, but boats with wheels do not make sense, so better to hide it."
explains how to get 16-bit characters into properties files in
Re: Corrupt unicode characters
"1) .properties file can contain only ASCII characters, always use native2ascii to encode non-ascii ones/. 2) When using native2ascii, don't forget to specify input encoding. In your case, you supplied UTF-8 input file, but native2ascii read it using some latin variant (probably windows-1250 or iso-8859-2). Use: native2ascii -encoding UTF8 input.utf8.file output.properties"
bhamail explains the thinking that kicked off the thread
Re: Pure Java IME / Input Method .
"The main thing I'm trying to do is to avoid any dependence on Windows features or Windows setup. I'm aware of the native Windows IME/Keyboard LangPack features, but they vary too much from Win OS version to Win OS version. All I need to do is make sure the font I use can display the characters for the Locale used by a java IME and I should be good to go."
Current and upcoming Java
Registered users can submit event listings for the
href="http://www.java.net/events">java.net Events Page using our
href="http://today.java.net/cs/user/create/e">events submission form.
All submissions go through an editorial review before being posted to the
Archives and Subscriptions: This blog is delivered weekdays as
Today RSS feed . Also, once this page is no longer featured as the
front page of java.net it will be
archived along with other past issues in the
AWT and Swing windows get opacity options other than 1.0 and 0.0