Wednesday, June 27, 2007

Enabling/Disabling Swing Containers

(From Alexander Potochkin's Blog)

The fact that disabling a Swing container doesn't mean disabling its child component has always been surprising for Swing beginners...

Read...

Be worry with PixelGrabber

Recently my friend Fran (that is working on an amazing project) talk me about the perils of PixelGrabber. I use it in my Balloon project and after looking up for a while I found this post:
PixelGrabber is too slow and has memory problems!

You can read some example using BufferedImage instead PixelGrabber and, at the end, an explanation post about the old 1.0 Java image API.

Wednesday, June 20, 2007

Managing volatility

(From developerWorlks)

The Java™ language contains two intrinsic synchronization mechanisms: synchronized blocks (and methods) and volatile variables. Both are provided for the purpose of rendering code thread-safe. Volatile variables are the weaker (but sometimes simpler or less expensive) of the two -- but also easier to use incorrectly. In this installment of Java theory and practice, Brian Goetz explores some patterns for using volatile variables correctly and offers some warnings about the limits of its applicability.

Read...

Thursday, June 07, 2007

Native libraries in NetBeans modules

The NB wiki and documentation says you can put your dll or so files in the 'lib' directory of your module, but I think a little example can be a more good explanation.

Supose you need a module wrapper for your new NB platform based application. Imagine you want to use the JAI API and distribute your application for Windows and Linux.
Right, after create the module wrapper (with the NB wizard) you'll can see a directory named (see the file view):

jai-wrapper\release\modules\ext

containing the JAR files, but what about the dll/so files?
The answer is put it in the:

jai-wrapper\release\modules\lib

See the previous links to the documentation if you have equal names for diferents SO's in your dll/so files.

Wednesday, June 06, 2007

A note on class loaders

Today I read this post on Nabble about Loading class from an external module.
I think the hierarchy of class loaders is not a common thing for a great number of Java programmers, at least in their every day work.

Although it is for specific for NetBeans, you can find useful information how class loaders works in Java, following the final links.

Tuesday, June 05, 2007

Extending the DataProvider API with VisualWebPack

Until the coming version of NetBeans+VisualWebPack arrive and we can bind a WebService or EJB to a table or other component, here is a little idea to know how to do it in a correct way.

First of all, here are a couple of blogs that can help us in our search:
http://blogs.sun.com/winston
http://jkook.blogspot.com

If the VWP components are enough for your application, I think VWP is a grat tool that helps you top spend much more less time to create an application. The separation of request, session and application beans, the set of components, drag&drop and binding component to data sources: like a DB table.

However, what happens when you want to bind a component to the result of a web service or EJB. For the moment, you can extend the DataProvider API and play requesting data on request or session bean.

ObjectListData Provider work around - Sample Project
Creator Tip: Work around for Object List Data Provider design time problem