Archive for the ‘Java’ Category

Customize single cells in JTable

JTables are very useful for develop desktop applications but when it comes to customize properties at cell level it can be a little tricky. The key concept here is that we have to deal with Cell Renderers for each column. TableCellRenderer is an interface that forces to implement the following method: Component getTableCellRendererComponent(JTable table, Object value, boolean isSelected, […]

Posted on February 11, 2012 at 12:14 by Samuel · Permalink · Leave a comment
In: Java, Languages · Tagged with: ,

Unsupported major.minor version 51.0

The other day I was trying to compile and run some swing example code using the command line and when I tried to execute I got the following error: Exception in thread "main" java.lang.UnsupportedClassVersionError: Main : Unsupported major.minor version 51.0 I found on the Internet that version 51.0 corresponds to java 1.7 and then I […]

Posted on February 9, 2012 at 09:27 by Samuel · Permalink · Leave a comment
In: Java, Languages · Tagged with: 

Working with Java in the console (terminal)

I think this is very useful. I know there are powerful script languages like python or ruby which, by the way, I strongly recommend you to learn. But maybe you feel comfortable (like me) using Java for simple and not so simple programs or scripts. I'm writing this post because the other day I wanted […]

Posted on December 28, 2011 at 12:36 by Samuel · Permalink · Leave a comment
In: Backtrack, Debian, Java, Languages, Linux · Tagged with: 

Using resources from inside .jar package.

When we pack all our java classes, libraries and resources in a single .jar in order to share our application, if our code has references to resources using absolute or relative paths to the files in our working directory like for example: ImageIcon image = new ImageIcon('/gui/images/logo.png');ImageIcon image = new ImageIcon('/gui/images/logo.png'); We won't be able […]

Posted on October 28, 2011 at 10:54 by Samuel · Permalink · Leave a comment
In: Java, Languages · Tagged with: ,