java

recent posts related to java, jdbc, spring, etc.

Options to put your Java application name on the Mac menubar

If you don't do anything to your Java application on a Mac OS X system, your Java class name will appear in the Mac menubar. Of course, this isn't a good thing. There are a couple of things you can do to get the name of your Java application on the Mac menu bar, and I'll share all of the ways I know how to do this. I've listed these techniques in order here from "easiest" to "best".

A Java Extract Interface refactoring example

Java Refactoring FAQ: Can you provide an example of the Extract Interface refactoring process?

While working on a Java Swing development project recently, I had written a couple of controllers (as in controllers from the Model/View/Controller pattern), and I was about to write some more, when I realized that if I refactored my Java source code I would have a much better design -- source code I code more easily maintain.

The pattern I saw repeated in my Java controller classes was that they all had similar method names, something like this:

A Java JScrollBar example

I took a little time today to add some new features to my "JustWrite" text editor, and one of the features I'm experimenting with is an animation similar to the current horizontal scrolling area shown at the top of Apple's Mac web page. When you first hit that page the scrolling area is offset a little bit, and then in an animation the scrollbar moves more to the center of the scrolling display area.

Java stack and heap definitions

I just read a couple of emails about the concepts of a Java stack and heap, and thinking that their descriptions weren't exactly right, I decided to do a little research. There's no better source than the source, so directly from Sun's Java website, here are definitions for the Java stack and Java heap.

Java stack definition

Here's the definition of a Java stack, with a few pieces removed for clarity:

Chain of Responsibility Pattern in Java

The Chain of Responsibility Pattern is a design pattern whose intent is to avoid coupling the sender of a request to its receivers by giving more than one object a chance to handle a request. The Chain of Responsibility works like this:

A Java "extract method" refactoring example

If you don't own a copy of Martin Fowler's Refactoring book, I highly recommend it. The basic idea of refactoring source code is that the code "smells" in one way or another, and there are a variety of ways to improve smelly code. More specifically, Mr. Fowler describes refactoring as this:

Refactoring is the process of changing a software system in such a way that it does not alter the external behavior of the code, yet improves its internal structure.

Java concurrency classes, utilities, and tutorials

Just some quick note here today as I dig into the Java 5 concurrency classes and utilities. Mostly, I just wanted to save a few good links I've found related to Java concurrency and multi-core programming:

Command Design Pattern in Java

Design Patterns FAQ: Can you provide some examples of the Command Pattern in Java?

If you've ever seen Java source code that looks like this:

A Java Action, ActionListener, and AbstractAction example

Java Swing FAQ: Can you provide a complete example of how to use the Java Action interface and the Java AbstractAction class?

The Java Action interface and AbstractAction class are terrific ways of encapsulating behaviors (logic), especially when an action can be triggered from more than one place in your Java/Swing application.

Design Patterns in Java

I've recently started writing a series of articles on Design Patterns, specifically Design Patterns using Java examples. Although it will take me a little while to create examples of each design pattern in Java, this page will eventually contain links to all of my Java design pattern examples.

If you're not familiar with software design patterns, they're described on Wikipedia like this:

Syndicate content