Scala, Java, Unix, MacOS tutorials (page 371)

Java file utilities FAQ: Do you have any Java file utilities you can share?

As I was working on another Java/Swing application this weekend, I ran across my "Java file utilities" class, and I thought I'd share that class here today. It's nothing too major, but it does include Java methods that let you open, read, write, and copy files using Java.

Java file-reading FAQ: Can you share some off-the-shelf Java methods I can use to open and read files in Java?

Sure. Taken directly from my Java file utilities article (Java file utilities to open, read, write, and copy files), here is the source code for two Java methods that let you read a text file.

I had a problem this weekend with the JEditorPane line wrap (word wrap), where it was wrapping lines on the right margin right in the middle of words. Wherever my sentence hit the right margin, that's where the line wrapped (with no consideration for word boundaries), leaving me with lines that looked like this:

At the moment I can't remember why I wrote this method to read a Java properties file and return it as a Map of key/value pairs ... but if for some reason you happen to need a Java method that reads a properties file and returns the contents as a Map, here's some free source code for you:

In an earlier Java Properties file example I showed how to load a Java Properties file and then access the elements in the Properties object, but for today, if you just need a method to read a Java Properties file, I hope the following source code will be helpful to you:

I'm intrigued by the Apple A4 processor that powers the iPad. I've been looking around for decent articles on the A4 chip design, and so far the best article I can find is this PC World article.

Here's a brief look at several news stories related to Oracle's purchase of Sun, along with direct links to Oracle documents detailing their plans for Sun technologies like Java and MySQL on the Oracle website.

Oracle plans for Java

Looking at various Oracle/Sun news stories, it looks like Java is safe for the time being. As one reporter at ZDNet says it, Oracle's Java strategy is 'business as usual'".

In this tutorial I look at how to create a splash screen in a Java application. At the end of the discussion I'll share all of the Java classes that are needed to implement your own Java splash screen.

<< Back to "Java splash screen with progress bar, part 1"

Initializing our Java splash screen

Initializing the splash screen should be simple. We need to get an image to display on our Java splash screen, construct the splash screen, and then display it. Here's what a "splash screen initialization" method might look like:

<< Back to "Java splash screen with progress bar, part 3"

My Java splash screen source code

Next up we'll dig into our Java SplashScreen class to see how I've actually implemented the desired behavior.

Apple iPad Design: I know, forty million people are writing about the new Apple iPad tablet device, but how many of those people owned a tablet PC six years ago like I did? Given those walloping credentials :) here's my take on the Apple iPad design.

To me the iPad design is an evolutionary -- not revolutionary -- product, basically a big iPod Touch w/ updated software, less the camera. (Which led to this very funny iPad image.)

Model View Controller pattern FAQ: Can you provide some examples and definitions of MVC objects?

Earlier today I shared a Model View Controller (MVC) diagram that I think really simplifies the MVC design pattern. It lays out the interaction rules between MVC elements, i.e., which objects can communicate with each other in a proper MVC design.

<< Return to Part 1 of our Java MVC Example

MVC Controller - our MainController class

As its name implies, the MainController is the main controller/coordinator of our MVC application. It creates the other controllers, and in many ways then turns control over to these other controllers. One of the controllers it creates is the ProcessController.

<< Back to Part 2 of our Java MVC Example

MVC - Handling data-changing events

Whenever the user adds, edits, or deletes data, such as our Process data, all the proper GUI components need to be notified of this event so they can properly update their displays. In this application, when a user adds a new Process, this means that we need to update our MainProcessTable. We implement this as follows:

Java Swing FAQ: How do I create a menubar (and menu and menuitems) in Java?

As I was working on a Java/Swing problem last week, I was scouring through the Mac OS X Java-Dev mailing list, and along the way I ran into some really nice source code I thought I could modify into a decent Java Menubar example. After a little rewriting, here is that "Java Menubar" example.

A few days ago I wrote about Java UIManager colors (color keys), and as a quick follow-up to that article, I thought I'd share a few "Java color palette" screen shots from the wonderful JFormDesigner application, which first got me to explore this topic.

The screen shots below come directly from JFormDesigner, and I like them because they show (a) the names of the UIManager colors keys and (b) the actual color corresponding to each color key value.

I don't have much to add to this discussion today, but if you're looking for good information on why the Java Thread class stop, suspend, and resume methods are deprecated, here's a link to a terrific Thread method deprecation article on Sun's website. The article discusses both (a) why these methods are deprecated, and (b) how you should write code to stop most Java threads.

In the latest news regarding Sun and Oracle -- which is pretty important to my Java and MySQL life -- Oracle has finally won EU approval for their purchase of Sun, and they are also planning to provide a "Sun Road Map " next week.

Java Swing FAQ: How do I create a wait cursor in a Java application?

I was going to write a nice, complicated Java “wait cursor” example today, showing you how to create an animated wait cursor in Java using threads, but after looking at a much simpler approach, I've decided to show that instead.