Archive for the ‘Twitter4J’ Category

JavaFX 1.3 + Twitter4J * Twitter API = Basic JavaFX Twitter Client and Tweet Cloud Generator

May 25, 2010

This is a word cloud, well I have renamed it to Tweet Cloud, based on the search of Twitter for the term Danny Macaskill.

The usual rules apply, the larger the text the more frequent the term has been made.

To explain, I was recently playing with the Twitter API for a php project I am working on. I was really impressed by how easy it was to code up php code with Twitter. I decided I would see if I could code something in JavaFX, and I have been playing around with word clouds recently and so decided I would create a Tweet Cloud!

I used Twitter4J to interact with the Twitter API, and JavaFX to build the front end, I also utilised the CSS styling within JavaFX, and of course multi-threading for the login process and generation of the Tweet Cloud.

Ok, so how to use this? First of you will be prompted for your Twitter username and password, don’t have one well you can create one! Once authenticated you will be presented with your timeline, your followers, and two input boxes.

The first is the search input, simply enter a term and select Find (in this case I entered Danny Macaskill), this will generate a tweet cloud based on the results from the Twitter search.

The other input box is for you to type your exciting Tweet telling all your followers, and the rest of the world, of this wonderful JavaFX tool!!

Once you have your Tweet cloud, and you managed to stop admiring it 🙂 You will notice there is more!!! You can select the Settings button, this then allows you to:

– Specify words you want excluded, I have hard coded an initial list, by entering words that do not exist. Alternatively you can un-select words to have them included in the tweet cloud.
– Specify words you want highlighted, imagine I was searching for the term brilliant included in people’s tweets about my Tweet Cloud. I might want to highlight this word in Red (colour choice from the pull down list) to help it to stand out.

Once you have configured this, you select process and it rebuilds your Tweet cloud. All good fun!

Now I am not a big Tweeter or user of Twitter (please excuse my Twitter ignorance), anyhow I think it would be interesting to see how many people Tweet to the hashtag I have set up “#JavaFXTweetCloud” and some other word (perhaps your thoughts on the app), and then we can generate a Tweet Cloud on the Tweets of the JavaFX Tweet Cloud app 🙂

The Tweet cloud (as of 25th May) looks like this:

What will it look like in a few weeks time?

All in all I found working with Twitter4J, the Twitter API and JavaFX 1.3’s new features really easy and rewarding. I plan to put together a basic tutorial on JavaFX and Twitter4J in the next couple of weeks (time allowing), really liking 1.3. I hope you don’t find the interface/layout too basic.

As ever, let me know your thoughts. I just built it thinking it would be fun (and it was!)..