Tuesday, June 22, 2010

Doing things the hard way



I hate doing things the hard way. This is the very reason I have clung to NetBeans like crazy. This dawn I wanted to get a schema for a JavaDB database so that I migrate it to MySQL. I have beein migrating data from one database to another for more than 2 years. It could be from MSSQL Server, Oracle, JavaDB, MySQL blablabla. I am able to migrate from any database to another. When I was trying to establish connection with NetBeans 6.8 it reported that the database was created in version 10.4 and is not supported in the JavaDB version of NetBeans 6.8. I have not really searched for the JavaDB version used by NetBeans 6.8. I installed NetBeans 6.0 and tried to connect but the same error was given. I think I would have to do my homework well before trying it out again.
I went through the features on NetBeans 6.0 and was glad to see the Visual Web JSF Developer feature. I wonder why it was uprooted in NetBeans 6.8. I have already downloaded the NetBeans 6.9 but have not installed it yet. I wonder if the Visual Web JSF Developer feature will be ressurected in this new version.

Monday, June 21, 2010

Images in NetBeans Swing Applications



I was trying to create a setup package for a software created by someone with NetBeans yesterday. The guy put the images in the NetBeans project directory but not in a package. Everything run fine on his system since the images were created on the various JPanels and JLabels using absolute path. I run it on my machine and booom. The images were not showing. I went back to correct the problem. Absolute paths are the worst thing a programmer should do in development. NetBeans has made our lives so easy we just click, drag-and-drop and everything happens.
The moral of the story - Adding images for platform independence in NetBeans should be done in packages. The best thing in my opinion is to put all the images in an images folder, copy and paste in NetBeans default package for the project in question. Just click the component with which you seek to add images and look up for its Icon property in NetBeans. Use Image Within Project option to browse for images in the project's directory.
If you want to use an External Image it is best to Import to Project for easy accessibility. Note either is a programmer's choice.
What I do most often is create a package for images so that when I package the software, I need not copy a single image. They get embedded in the jar file.