Newsletter sign-up
View all newsletters

Enterprise Java Newsletter
Stay up to date on the latest tutorials and Java community news posted on JavaWorld

JavaWorld Daily Brew

Java Tutor

Java Tutor is my platform for teaching about Java 7+ and JavaFX 2.0+, mainly via programming projects.


All About Arrays

Arrays are one of Java's fundamental language features and are used throughout Java applications, starting with the array of java.lang.String objects containing command-line arguments that's passed to the public static void main(String[] args) entry-point method of the application's main class. Despite their familiarity, however, how much do you really know about Java's arrays?

This tutorial delves into the array feature. It first introduces this term and explores Java's one-dimensional and multidimensional array categories.

Read more ...

 

Year End Java Quiz

How well do you know the Java language? Now that 2012 is drawing to a close and a new year is about to dawn, perhaps you might resolve to learn more about Java. A perfect way to gain this knowledge is to take a quiz and rate your understanding.

The following quiz challenges you on many Java language features (and a few language-support APIs), and is organized into true/false and multiple choice questions. At the end of the quiz, I present a link to an archive that contains the answers.

Read more ...

 

Quadratic and Cubic Curves

Java 2D provides support for quadratic and cubic curves, which are generally known as parametric curves and specifically known as Bézier curves. Bézier curves are frequently used in computer graphics and related fields to model smooth curves that can be scaled indefinitely. This tutorial introduces you to Java 2D's quadratic and cubic curve support.

Read more ...

 

New Border Classes for Swing

Swing provides an infrastructure for adding borders (objects describing component boundary areas and providing code to paint these areas) to its components. This infrastructure consists of the javax.swing.BorderFactory class, the javax.swing.border package's types, and javax.swing.JComponent's void setBorder(Border border) and Border getBorder() methods.

Read more ...
 

Pixel Graphics and JavaFX

JavaFX's node-based infrastructure lets you create scenes based on geometric shapes (including scalable vector graphics), images, text, controls, and even media. You can also use this infrastructure to create complex pixel-oriented graphics such as fireworks, plasma, fractals, and fire. In the latter case, you either manipulate object-based pixels or work directly with Prism.

This tutorial shows you how to create pixel-oriented graphics in JavaFX. You first learn how to accomplish this task at a high object-based pixel level that is portable from one JavaFX version to another.

Read more ...

 

Working with Zip Files

Java provides extensive support for zip archives (archived sequences of stored files, which are known as zip entries) via the types located in the java.util.zip package. According to this package’s description, you can use these types to write/read content in the standard Zip and GZip (GNU Zip) file formats, compress and decompress data via the DEFLATE compression algorithm that these formats use, and compute the CRC-32 and Adler-32 checksums of arbitrary input streams.

Read more ...
 

When is a Character not a Character?

Just when you thought you knew everything there is to know about the Java language, along comes something new to challenge your sense of complete mastery. For example, did you know that Java lets you declare a class within an interface, as in interface A { class B {} }? Also, were you aware that you can “add” cast operators together in an assignment statement such as byte i = (byte)+(short)+(double) 2000;? (You’re not really adding cast operators.) Neither of these oddities is the subject of this post.

Read more ...
 

The Passage of Time

I introduced my Java Tutor blog last February, to teach about various Java technologies. Starting in July, I suspended this blog for several months to focus exclusively on Beginning Java 7, a beginner-oriented book on Java 7 that I wrote for Apress.

Read more ...
 

Rebooting JavaFX, Part 2

In the first part, of this two-part tutorial series on JavaFX 2.0, I showed you how to install the JavaFX 2.0.2 SDK, presented JavaFX's architecture, and revealed a rich "Hello, World"-style application that introduced you to JavaFX application architecture and JavaFX APIs.

Part 2 continues to explore JavaFX 2.0, but does so in the context of a Slideshow application.

Read more ...

 

Rebooting JavaFX, Part 1

JavaFX is a platform for delivering Rich Internet Applications (RIAs). Sun Microsystems introduced this platform at its JavaOne Worldwide Java Developer Conference in May 2007.

Read more ...
 

Event-Dispatch Thread Rules for Swing UIs

The event-dispatch thread (EDT) is a special background thread for processing events that originate from the Abstract Window Toolkit's event queue. Update events cause user interface (UI) components to redraw themselves, and input events originate from input devices such as the mouse and keyboard.

Swing is a single-threaded UI toolkit that uses the EDT to update and send input events to components.

Read more ...

 

Attributed Strings

An attributed string is a string that's associated with attributes (style information, such as colors, underlining, and so on). Attributed strings are useful in code editors (to achieve syntax highlighting, for example), HTML page viewers, and other contexts.

Attributed strings are implemented as instances of the java.text.AttributedString class.

Read more ...

 

A Simple Data Binding Framework

Data binding is a technique for binding two data sources together and keeping these data sources synchronized. A subset of data binding is UI data binding, in which an application's domain model is synchronized with its UI elements.

Read more ...

 

Exceptional Java SE 7

More than four years have passed since Java SE 6's December 2006 release. Its Java SE 7 successor, which Oracle expects to reach General Availability status on July 28, includes several language enhancements.

Three of Java SE 7's language enhancements improve Java's exception-handling mechanism.

Read more ...

 

Multiple Key Press Detection

You're designing a Java-based side-scrolling game where your character moves from left to right. The character moves to the right when the right arrow key is pressed, and jumps up in the air when the up arrow key is pressed.

As the character moves to the right, it encounters dangerous obstacles (such as crocodiles) that will kill it (and end the game) if they make contact with the character.

Read more ...

 
Syndicate content