A C++ programmer walks into a Usenet newsgroup, "I don't see the point of Java!" he announces.
"It allows your code to work on many different platforms...", replies a local Java programmer.
The C++ programmer is unconvinced, "I can already do that with C++", he blusters.
"...without re-compiling your code for each platform", adds the Java programmer with a smile.
"What?!", shouts the C++ guy, "...
on Nov 26, 2008
There must be a name for that particular form of programming masochism which involves wringing the maximum effect out of the minimum of code. If not, someone should invent one!
I first began coding when the Apple II and Commodore 64 (et al...) opened up computing to the masses. By modern standards their 32 or 64k of RAM is an impossibly small amount — I'd love to report it was more than...
on Sep 30, 2008
As you probably know, a few weeks ago I became the new specification lead for the Swing Application Framework project (JSR-296). This project has been fairly silent for the last little while, so it is high time to continue with working on this framework and complete it timely.
The main goal of this project is quite ambitious: create a Swing framework which allows to quickly create a simple...
on Aug 6, 2008
This one tripped me up, and I thought I'd post it here. I have a case where I need to pour text into a JTextField, but have that JTextField look like a JLabel. So as I type in one field, I need this "gray" second field to update, live, before the user's eyes. I also need the ability for the user to cut-and-paste values out of it. This sort of thing is reasonably common in properties panels...
on Jul 31, 2008
One of the biggest advantage of JXLayer 3.0 over the previous version is the ability to catch input events of its subcomponents. I started to think about this feature when I was asked if it was possible to implement the auto-scrolling feature with jxlayer. With JXLayer 2.0 you can easily paint a scrolling indicator on top of the wrapped component, but how to catch a mouse press event to activate...
on Jul 27, 2008
The JXLayer's functionality consists of two parts: painting issues and input event processing.
In this entry I'll describe painting in details, the second part will come shortly.
With the JXLayer you can easily customize the visual appearance of your component and the most trivial example is painting on top of a component. However you should know some details to implement it...
on Jul 17, 2008
LockableUI is definitely one of the most challenging feature in the JXLayer library. I have already written about why it was difficult and suggested several solutions and discuss the potential problems.
So it was a long way to make it right and now I am satisfied with the result.
In this entry I compiled all up-to-date information about this feature, so forget about the blocking glassPanes,...
on Jul 13, 2008
The mouse auto-scrolling is very popular these days for modern applications. I usually use this feature in the Firefox browser - you click the mouse wheel somewhere on the page and can immediately start scrolling.
A few months ago Kirill wrote an great review of the "auto-scrolling feature" implementation in Swing. I'd like to add one more item to the list.
Suppose you create a JTable, wrap it...
on Jun 24, 2008
It is my pleasure to announce a major update of JXLayer component.
The new version is hosted on its own java.net project jxlayer.dev.java.net, where I will also provide links to all my blogs about this component.
So, why I encourage everybody to try out the new JXLayer?
Actually to answer this question I am going to write several more blogs, here is a short answer:
more consistent and efficient...
on Jun 5, 2008
When I worked on the lightweight disabling of compound Swing components for my JXLayer project, I tried different approaches to workaround the problems with the custom painting of double-buffered components.
The last try was using the JComponent.print() method instead of JComponent.paint(), which effectively disables the double-buffering for the whole hierarchy of components. While it seems to...
on Apr 13, 2008
Splines project now has its first incarnation within swash and the example chosen is the perfect one.
In a previous blog, Tim Bourdreau asked for the difference between splines project and java.awt.GeneralPath. Here i show some of the main reasons why generalPath could not be used:
Path can be changed anytime and displayers update themselves upon modification. No hassle.
Modifications on paths...
on Mar 2, 2008
JDK 6 introduced plenty of cool desktop features, like famous gray-rect fix or advanced drag and drop support,
all of them made java much closer to the desktop application market and I am very exited about them.
There have been many blogs how useful new features are,
and I don't want to repeat them. Among all successful and well-designed features there is one which actually has not been completed...
on Feb 14, 2008
A bug corrected in latest netbeans 6.1 enables swash to display its animations realtime while you edit withing matisse. Great effect and good step ahead in productivity.
Thanks goes to Tomas Pavek for that. Even if the bug report was a bit old, he fixed it as soon as he got his eyes on it and i admit i really waited for it.
So, here is a little swik capture that shows how animated components are...
on Feb 13, 2008
In Microsoft Outlook, along with probably dozens of other desktop applications, pressing ESC just about anywhere will cause the current window you're in to be cancelled. In the case of dialogs, it is as though the Cancel button were pressed; in the case of root windows, it is as though you tried to exit the application (and you usually get a warning dialog that asks you if you're sure).
on Dec 17, 2007
Last week I told you we had a secret new open source project to release. Think of it as an early Christmas present. A project that you've never heard of and has nothing to do with JavaFX (which is partially untrue, but I'll get to that in a second). Well, it's almost the end of the week so here is the secret. You can listen to MP3 announcement (played on stage at the JavaPosse's JavaPolis...
on Dec 13, 2007
Few weeks ago I submitted a session for the next JavaOne and it reminded me the previous session which we presented with Kirill
Before J1, he published a nice teaser with links to blogs about his famous ghost effects and transition layout, so it's hight time for me drop a few lines about implementing a spotLight effect. You can test the whole application on the main page of the Rainbow project,...
on Nov 29, 2007
It's a creepy thought, but hidden amidst the garish flickering displays and eternal night of some far flung casino there may still stand a Video Poker machine running code written by yours truly. It's been the best part of a decade and half, but the industry as I recall it was never fond of re-inventing the wheel. Y'see for Poker machines 'unit testing' (as we now know it) didn't result in...
on Nov 21, 2007
As everybody knows if you need to repaint a Swing component you should call Component.repaint() method,
another well-known tip for the fast painting is:
If only part of your component needs to be updated, make paint requests using a version of repaint that specifies the painting region.
It is very simple piece of advice - not to paint more than you need,
but sometimes this situation is not...
on Nov 6, 2007
In one of my previous blogs I answered to Kirill's comment that some of techniques he described in his Swing painting pipeline overview are "not good enough for me",
here I want to explain my point by brifely commenting some of the techinques he covered.
Implementing validation overlays
First of all I want to mention my requirements to the validation overlays implementation:
on Oct 9, 2007
One of the big part of my work is fixing bugs in Swing but not all of them are to be fixed, some of them are closed because they describe the situations when someone uses Swing in undocumented way or trying to make Swing do something which it doesn't support.
My favourite example is so-called "Blocking GlassPane". If you file a bug with a description that you implemented a GlassPane to block...
on Sep 27, 2007