alvin's blog

Tame Swing examples - initial images online

Whew, getting all the images together for the Tame Swing sample applications is taking a little time and a lot of effort. I hadn't thought about how to organize it, and now that I have a better feel for what I want to do it's just a matter of time.

If you want to see the images of the running applications I do have them on a temporary page here. Please note that this page may change at any time.

How do I convert a String to a double with Java?

Question: How do I convert a String to a double with Java?

Answer: Converting a String to a double requires that you first convert the String to a Double object, then convert the Double object to a double data type (Double is an object, while double is a primitive data type).

Here's the source code for an example Java program that performs this conversion:

How to convert a Java String to a float

Java String/float FAQ: How do I convert a Java String to a float?

Converting a String to a float requires that you first convert the String to a Float object, then convert the Float object to a float data type (Float is an object, while float is a primitive data type).

An example of a simple program that performs this conversion is shown below:

Java String to number conversions

Java String to number FAQ: How do I convert a String to a number in Java?

You convert a Java String to a number using the methods of the class whose type you want to convert to. For instance, if you want to try to convert a String to an int, you use the parseInt() method of the Java Integer class, like this: 

A Java String to int conversion example

Java String to int FAQ: How do I convert a String to an int data type in Java?

Answer: You convert a String to an int using the parseInt method of the Java Integer class. The parseInt method converts the String to an int, and throws a NumberFormatException when the String can't be converted to an int type.

Let's take a look at two short examples.

The Tame Swing examples

Digging through my Mac laptop, I just found the old Tame Swing files laying around. These examples are a little old now, but I think they are great examples of the power of the Java Swing framework. Since they are hard to find on the internet I've gathered them into a little collection here.

Currently I just have the Java source code files there, but give me a couple of days and I'll see what I can do to get some of the examples running, and maybe include some screen shots there as well.

 

More Linux find command examples

The Linux find command is used to locate files and directories based on a wide variety of criteria. I'll try to cover the most common find examples here.

Basic find command examples

To find a file or directory named "foo" somewhere below your current directory use a find command like this:

find . -name foo

If the filename begins with "foo" but you can't remember the rest of it, you can use a wildcard character like this:

Syndicate content