java

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

Blurry text in a Mac OS X Java Swing application (solution)

I noticed recently that a Scala/Java Swing application I am developing on Mac OS X 10.9 has blurry text when it’s run as a Mac application. The text looks fine when I run the application through SBT, but looks blurry when I package it and run it as a Mac OS X application.

A solution is to put this text in the application’s Info.plist file:

Java stack and heap definitions

Summary: This article provides definitions and descriptions of the Java stack and heap.

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:

Law of Demeter - Java examples

Summary: The Law of Demeter is discussed using Java source code examples.

Whenever you talk to a good, experienced programmer, they will tell you that "loosely coupled" classes are very important to good software design.

The Law of Demeter for functions (or methods, in Java) attempts to minimize coupling between classes in any program. In short, the intent of this "law" is to prevent you from reaching into an object to gain access to a third object's methods. The Law of Demeter is often described this way:

Java enum examples/tutorial

Java enum FAQ: Can you share some Java enum examples, such as how to declare a Java enum, and how to use a Java enum in a for loop, if then statement, and Java switch statement?

As described in Sun's Java documentation, a Java enum "is a type whose fields consist of a fixed set of constants ... you should use enum types any time you need to represent a fixed set of constants." Let's take a look at some Java enum examples to see how this works.

A Java deep clone (deep copy) example

While interviewing for computer programming positions here in the Boulder, Colorado area, I've found that most interviewers ask questions about Java serialization. After being asked about serialization for the third time recently, I suddenly remembered an old Java deep clone hack that takes advantage of serialization.

The basic idea is this:

books i've written