Showing posts with label programming. Show all posts

Showing posts with label programming. Show all posts

Java Swing Layout made extremely easy

on Monday, 14 January 2008
If you're a Java developer working on desktop applications that require you to code the interfaces (especially the really complex ones), you'll love what I found.

First, take a look at this page. See that complex looking list? It's made with a custom ListCellRenderer which was created using GroupLayout. Really nice-looking doesn't it? (see the layout tutorial here)

GroupLayout was specifically designed for use with Project Matisse, the GUI builder for the Netbeans IDE, which by the way, is extremely impressive.

Unfortunately, GroupLayout is complex to use and difficult to read if you do not have access to Netbeans and do not wish to use/learn Netbeans solely for the purpose of designing the GUIs. Or maybe you're just old school and prefer to build GUIs by hand (I know, some of the generated code can be icky). What do you do?

You go and download MigLayout of course! Why? Well, go back and look at that fancy list above again and try to estimate how many nested panels you might need should you use the standard layouts, or how many lines of code and the calculations you need for GridBagLayout. Finished? Guess how many lines it takes for MigLayout... seven. Yes, you read it right, just seven simple lines:
cell.setLayout(new MigLayout("nogrid, fillx"));
cell.add(pic,   "dock west");
cell.add(title, "growx");
cell.add(count, "wrap");
cell.add(line1, "growx, wrap");
cell.add(line2, "growx");
cell.add(email);

Impressive, no? Check out the website for guides and Java Web Start demos.

The Daily WTF

on Friday, 13 January 2006
Here's a fun little blog I found out about while reading the comments on a post on a friend's blog posted by another friend. It's called The Daily WTF - Curious Perversions in Information Technology. A really funny read regarding the weirdos and "smart" people that happen to be in the same line of work I'm in. Technical, but classic, stuff.

Java anyone?

on Friday, 23 July 2004
I'm a programmer. Work day after day is churning out lines of code. But it's fun sometimes, as you wrack your brain trying to solve an elusive bug or producing just the right algorithm. The triumphant feeling you get sometimes justifies the previous scalp-scratching exercise. Ha! Don't let me scare you off though. I program mainly in Java, though I know alot others, just rusty in them by now.

As all programmers know, the tool with which you use to program is very important. My recommendation? vi. Yes, that Unix/Linux editor with an extremely steep learning curve. But once you get the hang of it, learning its nuances and secrets known only to the hardcores, it's a wonderful editor, not just for programming. Don't have Unix/Linux? Try gvim, the Windows version! vi (or vim) can do just about everything a sophisticated IDE can do, but at a much much much smaller size and faster speed. And there are several things it can do that modern IDE can't. vi has syntax highlighting (for dozens of syntactical stuff, even some obscure ones), text replacement, macros, hundreds of quick shortcuts to accomplish editing needs, code folding, method browser, method traversal, registers for copying, window splitting, sorting, aliases, key mappings, visual selection, regular expressions for just about anything, save options, encryption, initiating compilation within the editor, color schemes, allows plugins, and quite a few more I can't think of right now. Phew. Yes, it's that good.

But of course, you sometimes just can't beat the visual look of an integrated IDE. My favourite at the moment is NetBeans, which is a free open source development platform that supports just about anything about Java. It has official Sun support too! Of course, for those who do not prefer NetBeans, they usually prefer Eclipse, which appears more flexible as it is not limited to Java. Put in the right plugin, and you can start writing code in some other programming language. NetBeans is now version 3.6, while Eclipse is 3.0.

Download quick links: gvim, NetBeans, Eclipse.