hi-fi

Bino George's Blog: Hi-Fi Swing (or improving the native fidelity of Swing System L&Fs) User: Password: Register | Login help My pages Projects Communities java.net Get Involved java-net Project Request a Project Project Help Wanted Ads Publicize your Project Submit Content Get Informed About java.net Articles Blogs Events Also in Java Today java.net Online Books java.net Archives Get Connected java.net Forums Wiki and Javapedia People, Partners, and Jobs Java User Groups RSS Feeds Search Web and Projects: Online Books: Advanced Search Bino George's Blog Main | New AWT Features in Mustang. » Hi-Fi Swing (or improving the native fidelity of Swing System L&Fs) Posted by bino_george on November 29, 2004 at 05:07 PM | Comments (15) Hi-Fi Swing (or improving the native fidelity of Swing System L&Fs) One of the biggest strengths of Swing is the lack of a rigid coupling between the underlying platform toolkit and the Swing API. The Swing API was designed to be extensible and free from platform limitations. Other Java based GUI Toolkits have taken a different approach that is more closely bound to the platform toolkit. As always in life there are two sides to every story. The freedom from platform restrictions comes at some cost in terms of engineering the Swing Toolkit. Swing engineers have to make conscious trade-offs between native fidelity and platform independence. Over the years our users have requested that we provide the absolute best fidelity for our System Look and Feels. There is a nice list of custom L&Fs here : http://www.javootoo.com Window blinds and Windows theming Theming the Windows desktop has been very popular for many years. PC System Manufacturers like Sony or Gateway have shipped custom Windows themes to provide a branded look that identifies the desktop with the system manufacturer. Personally, I have always found this to be quite annoying and have tried to disable such customizations. I just want to have a standard Windows Desktop! But, there are many users who like the power and flexibility of customizing their desktop to look like their favorite TV show or whatever. One of the favorite Themeing applications for Windows is called WindowBlinds UxTheme API WindowBlinds and other such theming engines have traditionally used the Windows system-wide Paint hooking facilities to customize the rendering of standard windows controls. As you can imagine this is not a trivial thing to get right and there are lots of pitfalls. Window blinds was so popular in its functionality that Microsoft worked with the author of this product to develop a new API that exposes the rendering of Windows controls. This API is called UxTheme. Windows XP provides a new Look and Feel (the default XP L&F) based on UxTheme API that users can extend using the UxTheme API. Longhorn In Tiger and Mantis, we have provided support for the Windows XP look and feel. The mechanism used to provide this support was based on reading the resources embedded in the XP styles files and using those icons and colors to render our Windows Look and Feel. Unfortunately, Microsoft has changed the Styles files in Longhorn so that the resources are no longer visible using the mechanism we used in Tiger and Mantis. So naturally when we ran the current JDK under Longhorn we fell back to the Windows classic Look and Feel used in Windows 2000. Swing will fall back to this Look and Feel if it cannot load the XP L&F for some reason. This is not a desirable situation, we want the best user experience for our Longhorn users when Longhorn comes out. We wanted to make sure that the Longhorn themes work well in Swing apps. Implementing a Hi-Fi Windows Look and Feel We talked this over with engineers from Microsoft's graphics team, they suggested that the way to work with the Longhorn themes was to use the UxTheme API. So Leif Samuelsson (Swing Windows Look and Feel Author) and I prototyped a version of the Windows XP Look and Feel that uses the UxTheme engine to perform the rendering of Swing components. We then tested the prototype under Longhorn and found that indeed the rendering of Longhorn theme was pixel perfect with UxTheme. This lead us to the re-implementation of the Windows Look and Feel using UxTheme. This new implementation should be available in the latest Mustang build. Check it out and let us know how it works and especially file any bugs you find. Implementing a Hi-Fi GTK (Linux) Look and Feel So far I have focused on Windows. But dont think that we do not care about Linux. We are currently working on improving our GTK fidelity based on a similar approach. GTK provides the GTK styles API to hook into the GTK native rendering. We are looking into how best to use this API to improve the GTK rendering for Swing Apps. Mustang Mustang is the code name for the Java 6.0 project. Now that the Mustang builds are publicly posted, you can try out the latest fixes and improvements and give us feedback on the builds and the source. Please let us know what you think about Mustang at the Mustang project forum. Bino George, Staff Engineer, Swing/JDNC team. Bookmark blog post: del.icio.us Digg DZone Furl Reddit Comments Comments are listed in date ascending order (oldest first) | Post Comment It's great to see you guys at Sun becoming more concerned with L&F fidelity - it's been a big problem and it looks like you guys will finally get it right. I'll be sure to try out the Mustang builds to see how everything looks. Posted by: keithkml on November 29, 2004 at 07:43 PM do you plan to let the community help here? there are good projects that are filling in the gaps between what has been done Posted by: asjf on November 30, 2004 at 06:02 AM What would be a good way to see this in action? I've loaded the SwingSet under 5.0 and 6.0 and see no real changes. Posted by: scottdelap on November 30, 2004 at 08:54 AM The Mustang builds out there as of November 30th does not have UxTheme support. But the next build should. Also the best way to see the UxTheme impact to Windows Look And Feel is to run it under Longhorn. You should see that the "Slate" and "Jade" themes work well in SwingSet with the next build of Mustang. Posted by: bino_george on November 30, 2004 at 11:25 AM I would consider it a bug fix for Sun to back-port the UxTheme-based Windows L&F to Tiger. After all, there are dozen of bugs open against the Windows L&F. If you can fix this by backporting the UxTheme-depenedant implementation, why not do so? Posted by: cowwoc on November 30, 2004 at 12:23 PM I for one am not holding my breath. This very approach was suggested to Sun three years ago in bug #4587653, right down to the names of the API functions to use. It has even been submitted multiple times by independant posters. But it has consequently and repeatedly been turned down by reviewers in favor of the always-trailing-behind bitmap copycat approach. In the meantime, people has flocked to better-looking alternatives like SWT, Visual Basic.NET and God-knows-what. Seeing is believing, and creating a second-class user interface is a really efficient way of excluding yourself as a viable alternative. Surely, no future builds of Mustang will look any more native than the current one before the font support is fixed, too. Don't bother suggesting any APIs for this, however. That should be considered redundant as the issue will probably be talked over with some Microsoft engineers already around the end of this decade Posted by: rkaufmann on November 30, 2004 at 03:04 PM As you have referred to the list of available PLAFs on javootoo I'd (once again) like to stress that handling look and feel from an application programmers point of view is still tought wrong in many places (IMHO). I have done an article on java.net on best practices. There are approaches that fine-tune the currently available WinXP LAF and each Java application could benefit from it without adding or modifying one line of code if the programmers consider a few points that are mentioned in my article. ...just some humble thoughts... Posted by: tommi_kuenneth on November 30, 2004 at 11:56 PM Speaking of Linux, there is more than just GTK/Gnome on Linux desktop. Suse/Novell, Lycoris, Mandrake, Linspire, are all the distros targeting consumer desktop space, and all those distros are heavily KDE-based. Any plans for KDE themes support? And if not, would you guys give a community a chance, and add what we come up with into Mustang? Posted by: selendic1 on December 01, 2004 at 04:26 AM Someone talked about the broken (ugly) font support on Swing, and Bino talked about using the GTK theme API for improving fidelity with the Gnome desktop. Well, on most Gnome deslktops (and KDE ones also) the result will be very small if you do not take fonts seriouly. That means using Xft. On Linux, it would be imperative to drop the current motiff-bsed peers and use Gtk or Qt based ones. But why? Try to cut-and-paste from a Swing app to OpenOffice, Mozilla, Koffice, Eclipse or any other app on your Gnome/KDE/xfce/etc desktop. Most of the time it won't work. Besides Xft and Gtk or Qt, Swing on Linux should adhere to the freedesktop.org guide lines. They are making a terrific effort to integrate the many Linux desktops, and you can see the results on any recent release. Even PDA-based apps (Familiar Linux, OpenZaurus) are benefitting from this, although their desktops are very very different from more powerfull PCs. Posted by: flozano on December 01, 2004 at 04:57 AM JDK 5.0 doesn't use Motif peers anymore. It uses XAWT by default, and I can copy-paste just fine. Also, on GNOME, java5.0 automagically recognizes fonts, and even makes Swing text antialiased if Gnome has antialiasing settings on. But it stil uses Java rasterizer, meaning there is no subpixel AA support, and it seems to me that there is no kerning support in text layout process. Small things maybe, but very annoying. Posted by: selendic1 on December 01, 2004 at 05:33 AM uses the UxTheme engine to perform the rendering of Swing components. I'm wondering, can someone explain this a bit more. Does this mean the components will no longer be manually drawn using standard paint methods as they always have been? Is this moving to something similar to how Apple renders Aqua in Swing? Please, enlighten me. Posted by: bwy on December 01, 2004 at 06:20 AM Natively themed drawing means that you're using the toolkit's functions to perform the painting, but without having any of its structures associated with the component. This still doesn't save you from the anomalies stemming from a mock user interface, but at least it looks the same. Think of it as a house front-end akin to the ones used in Hollywood western movies. Apple's implementation of Swing uses functions like DrawThemeButton in the Appearance Manager to perform exactly this trick. It is often portrayed as the only way to achieve platform-independant user interfaces (why anyone would want that is above me), but in reality it is more like writing your own filesystem on top of the disk driver.The real reason it is done is probably because the model of custom drawing fits better with the garbage collector in Java. You still have to close your files explicitly, but nobody is complaining about that, though. If I were choose a user interface library today, I would rather go with a more pragmatically designed one like SWT. Of course, the best would have been a declarative layer like XUL on the top of it, but people appearent seems to think that parsing Java code adds more to the stability of the IDE than reading XML. Posted by: rkaufmann on December 01, 2004 at 03:45 PM Even with latest b35 I still do not get proper font rendering on Windows that comes even close to ClearType, both with and without swing.aatext set to true. When is this long awaited feature (I would say: requirement) to be expected? Posted by: fridoo on May 06, 2005 at 01:12 AM I want to second the request for KDE support. Linux is not Gnome, even if Sun has chosen Gnome for their distribution. But in my opinion, switching back to platform specific rendering of components is tricky. Why? For linux alone, admittedly the most difficult platform to support anyway, there must be dozens of window managers and theme engines. Posted by: marrs on May 11, 2005 at 07:36 AM wow power leveling wow powerleveling wow power leveling wow gold wow items feelingame.com wow tips Most Valuable WOW Power Leveling Service wow power leveling faq cheap wow power leveling wow power leveling wow powerleveling wow power lvl Posted by: rinimade on December 24, 2007 at 12:25 AM This work is licensed under a Creative Commons License. Powered by Movable Type 3.01D java.net RSS Feeds Feedback | FAQ | Press | Terms of Use Privacy | Trademarks | Site Map Your use of this web site or any of its content or software indicates your agreement to be bound by these Terms of Participation. Copyright © 1995-2008 Sun Microsystems, Inc. Powered by Sun Microsystems, Inc., O'Reilly and CollabNet разделы кислотостойкий краска корпаративные праздник прамышленый альпинизм педагогика психология купить пароварка калибровка цвет peg perego venezia планирование день видеорегистраторы рукавичка доставка медицинский перевод восстановление удаленный информация мэш билет задорнов купить пароварка бюро переводчик светлогорск скраб-пилинг пежо сервис alfa laval позитивный психология кулер бесшумный машина r-600 кулер тихий подбор холодильный камера купить ниппель перех лекарство рак промышленный аккумулятор бахила оптом зеркало вагинальный купить электроэнцефалограф регестрация пбоюл кассовый машина холодный штамповка сглаз кулер 775 бордюр kyiv apartaments rent купить nokia 8910 автоматический оповещение кайт пилотажный гидрант пазл красный площадь гум купить ниппель перех зеркало багуа дренаж эрозия шейка матка узи сделать hi-fi