Archive | Development RSS feed for this section

Basic Twitter functionality

14 May

Today I finally made Twitthere useful. I added a JTextArea and posting capabilities, so now you can even post a tweet from Twitthere. Funny part is it also shows on that your tweet was posted through Twitthere. Furthermore it is now possible to reply on a tweet from your Home timeline (I’ve programmed it in such a way that the panel can show other timelines too, but for now it just shows the Home timeline), mention a user from your Home timeline or retweet a tweet in your Home timeline. All changes you make in Twitthere will be reflected upon, so it all actually works. 

The new Twitthere client, including replies / mentions & retweets


The only problem I’m having is checking whether you or someone else have retweeted a tweet (so it shows ‘retweeted by you’ and hides the retweet button on startup). If you retweet a tweet in Twitthere itself it updates the labels and buttons cleanly. I posted a screenshot again to give you an idea of how Twitthere evolved during the evening.  

I hope you enjoy reading my blog, checking out the new release and trying to understand the javadoc 😉 

— Léon

Further improvements

12 May

Welcome back to the Twitthere blog! Today I had some time left for Twitthere, so I started improving the proof of concept I posted yesterday. I added a simple colour scheme, aligned the username and the text of the tweet, added the user icon to the panels and put in the date and source of the tweet. In short, that’s just about every basic piece of information a tweet should contain. Try it yourself and see if it works (the current prealpha only shows your Home timeline).

Download the latest version of Twitthere from SourceForge:

I also added the option to remove your own tweets (because it is only possible to remove your own tweets in your Home timeline). To make sure no accidents occur and no one sues me for removing their beautiful tweets, I built in a small confirm dialog to make sure you really want to delete it. It is still kinda buggy though, because if you delete one of your own tweets, for some reason the mouse scroll stops working :S The tweet is also deleted from Twitthere but there is no animation or anything, so the other tweets just shift up immediately (which is kind of ugly).  But fixing the bug and working on the eyecandy have to wait, because it’s time to go to bed.

— Léon

Proof of concept

11 May

Finally! Tonight I had some time left before I went to bed to work on Twitthere. My hands were itching with excitement because the fun part now starts. The whole OAuth cycle is just to support the main application, and that is of course a Twitter application. So, the first things I worked on today was to make sure all tweets and timelines were correctly imported from the API, copying them to a local ArrayList to save on API calls, which are rate limited. I created a wrapper class around the Status class provided by Twitter4j to make my own customizations in the future. So, now the Tweet class exists and every tweet on Twitter is an instance of Tweet in Twitthere.

Twitthere showing my Home timeline

The second thing I wanted to work on was the main window. Because I read an interesting article on advanced GUI creation in Swing, I was sort of experimenting with several JPanels when I actually found something that looked okay. So I implemented all the new methods I created in Tweet and TwitterUser to generate the Home timeline of a user. Although I’m not impressed by the design (far from it) or the way of presenting the tweets, it is a proof of concept which shows that there is light at the end of the tunnel 😉

If you are interested in my small creation, have a look at the screenshot below or download a copy from . Of course you can also download the updated javadoc there.

Please feel free to leave any comments, let me know if it works and especially let me know when it doesn’t.

— Léon

Fight with threads (I won)

4 May

Today I made some major improvements on Twitthere. In short, I completed the OAuth authorisation cycle including serializing the user credentials and token data to a local file. This may seem simple but it is hard to get it right and to keep it that way. I must confess, I haven’t caught all exceptions sufficiently but I was so happy it all worked I’m taking the rest of the evening off 😉 Those exceptions will stay there and wait for me to solve them.

Anyway, it took me a lot of puzzling to get it all right. I’ve been working non-stop from 2 o’clock today until now (half past 10 in the evening) to get it to work. The thing that bugged me most was the loading screen I came up with to keep the user attracted to the program. The API calls to get tokens and swap the request token for an access token take some time, and the GUI would freeze while doing that. Everyone knows that’s a pain in the ass for the user, who has to stare at a frozen GUI for a couple of seconds. So, I threaded the API calls to keep the GUI interactive during the requests and at first it wouldn’t work. Finally, after some thorough puzzling and a lot of trial-and-error, it worked. The loading screen now shows a small animation with ticking dots (like ‘Loading…’, and the amount of dots changes) and it has an animated GIF showing a ‘loading’ animation. You can’t imagine how glad I was I came to the last panel, the ConfirmPanel, which shows that the user can finally start using Twitthere (so weird to put so much effort in the code to just let the user open their profile). For a small development peek, to see how and in what IDE I work, check the images below.

Of course I also updated the javadoc, so have a look at my new panels!

— Léon

First JFrame

3 May

Today I finally found some time (in college) to start creating the first JFrame with some panels. I chose to use a CardLayout JPanel with which I can show the complete login and authorization process in one JFrame. The panels I created are a login panel, shown when Twitthere is not run for the first time (so there are entires in the token file) and the loading screen shown when you log in.

Today or maybe tomorrow I will als create the other panels needed for the OAuth process, and maybe even start programming them so they actually do something!

Furthermore I updated the javadoc on SourceForge so if want the new version, go and grab it here:


Let me know if anything is wrong or you came up with a better solution!

— Léon

New logic

2 May

After giving the current (infra)structure some thought, I came to the conclusion that it didn’t suit my needs. The TwitterUser class was too complex and the OAuth authorization cycle should actually be a class by itself, so I extracted all OAuth functionality from the TwitterUser class to the newly created OAuth class. The TwitterUser class is still present, because we need it later on to make some custom methods (like asynchronous API calls) and it also stores its own access token and access token secret. Furthermore I added a constructor which makes it possible to create a TwitterUser with a token ID and token secret specified (received from the file by FileIO). The instance then automatically assigns an access token to itself using the OAuth class and the two parameters.

The basics for user authorization and registration are now complete. Twitthere can now authorize Twitter users by using OAuth and can serialize the token the users receive from the authorization cycle to a file. I hope that maybe today or else tomorrow I can start on creating the first JFrame containing the login screen.

Of course I’ll keep you posted, and check out the project summary at if you are interested in the project!

— Léon