java

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

TypeAhead, a continuous predictive text editor

TypeAhead is a continuous predictive text editor. It always tries to help you auto-complete the current word by using words in (a) the current document, as well as (b) a dictionary.

This short video shows a very rough prototype of how this might work:

Improvements

A few improvements are possible and easy.

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:

How to add a keystroke to a Java Swing application

If you ever need to add a keystroke to a Java Swing application (or Scala Swing), this code may help. It shows how to add the [Command][M] keystroke on a Mac OS X system to a Swing application. It makes the keystroke available in a “Window” menu:

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:

Syndicate content