Saturday, November 14, 2009

Google Presents Go Language

Go Language is a new programming language produced by Google. The FAQ section of its website says that it compiles faster than other languages. It supports garbage collection and has ability to handle concurrency.

The only problem I see is that it currently does not support Windows-based system. It's a good thing that I'm running in Ubuntu so I could give it a try. :)

Maybe this will become more popular in the future since Google is behind it. For all the people interested, you could visit their home page by clicking here. It has different how-to's to help you get started.

Cheers!

Wednesday, November 11, 2009

Turning on the Java Web Start Console

If you are working on a Java Web Start Project. It will really be useful if you could see the console. This will help you to easily find bugs or see logs in your code as it is running.

To enable the console in your system whenever a Java Web Start Application is running you just need to follow these steps. These steps are applicable regardless whether your machine is running on Ubuntu or Windows.
  1. Open a Terminal if you are using Ubuntu (or any Unix-based system). If you are running on Windows, you need to fire up the command prompt.
  2. Once it is running, type in: javaws -viewer and press Enter.
  3. The Java Control Panel will then appear in your system.
  4. Navigate to Advanced Tab.
  5. Under Settings > Java Console, just select the Show console option.
  6. Click on the Apply  button.
The next time you open a Java Web Start Application, the console will appear. You will be able to see if there are exceptions or logs in your project.

Sunday, November 8, 2009

JTextField, JColorChooser, JTextPane

Lately, I've been assigned a module of the system our team is currently developing. This part of the system uses Java Swing. One of the tasks I had to do concerns asking the user to choose a color and assigning this to the user's profile. Being a Java Swing Noob, I had to research everything first.

I found out that using JColorChooser is an easy way to let the user pick a color he wants.
All you have to do is to call a static method which opens a dialog and returns the color the user chooses.

Then after this, I wanted to have a JTextField with a background which will change together with the color the user chose. Now, I tried using

textField.setbackground();
and
textField.setForeground();

and found out that only the text color will change and not the background inside the JTextField. So, I did a few more searches and found out that a good alternative for this is a JTextPane.

You could check out the following links to help you get started:
JFileChooser
JTextPane
 
Free Hit Counter