How to Create a Typing Program

How to Create a Typing Program thumbnail
Typing programs are used for word processing.

Typing programs, or word processors, are useful programs both for the purposes of actually using them for creating text documents and learning about programming. Regardless of which reason you are looking to create a typing program, the basic mechanics of establishing the program's structure are not difficult to employ. Java, a workhorse language that is often used as a first language to teach programming, comes with many tools that you can use for this project.

Instructions

    • 1

      Open a text file, or the development environment of your choice. If you have not already, download the Java development kit (SDK) from Oracle's website. The link is in the "Resources" section below. Run the installer after you have finished downloading it.

    • 2

      Import the "javax.awt.*" library. You will also need the"javax.swing.*" and "java.awt.event.*" libraries. Use the "import" command for this purpose.

    • 3

      Declare a "String" variable before you write any functions. This variable will hold your user's input. Also declare the objects you intend to to add to your interface, including at least a "JTextField" object and a "JButton" object.

    • 4

      Create your main() function within your program's public class. Add the objects you feel relevant to the way you want the screen to look, but make sure to include at least the text field and button you declared in the previous step. Remember to use the basic formula of "JTextField [your-custom-name] = new JTextField();" to create new objects.

    • 5

      Create a separate "actionPerformed" function that takes a parameter of "(ActionEvent e)." The syntax will look like "public void actionPerformed(ActionEvent e)" followed by your function brackets.

    • 6

      Create an "if" statement within the "actionPerformed" function to execute if the variable "e" equals the custom name you gave your button in Step 4. Within that "if" statement, set the string variable you declared in step three to "[the-custom-name-you-gave-your-text-field].getText()" to store the text your user has typed in that string variable.

    • 7

      Add the extra functions for your typing program to manipulate your user's text input, that is stored in the text string.

    • 8

      Compile your source code into an executable file. Use your development environment's "compile" function, or use the "javac [your source-code-file]" command in the command line.

Related Searches:

References

  • Photo Credit typing image by Dariusz Urbanczyk from Fotolia.com

Comments

You May Also Like

  • How to Make a Program

    No night at the theater would be complete without a program which gives the audience some information about the show they are...

  • How to Program an RCA Universal Remote Control

    It takes just a few steps to program an RCA Universal Remote Control using the Automatic Code Search method. While there may...

  • How to Make a Wedding Program

    Wedding programs are wonderful keepsakes for your guests, and they fulfill practical needs as well. They show the order of your service...

  • How to Create an Input Box in Excel VBA

    There's no way around it: If you want to add interactivity to your Excel VBA programs, you have to use input boxes....

  • How to Create an Invoice

    Invoices are effective tools to use to record sales transactions. At the start of a new year when you sit down to...

  • How to Make Java Games

    Java games are computer games written in the computer programming language "Java." Java games can be as complex as the shoot-'em-up three...

  • How to Make a JAVA Applet

    A Java applet is a small program written in Java source code. Java is an object-oriented programming language suited to client-server architectures,...

  • How To Write Java Programs

    Java is an object-oriented programming language originally developed and released by Sun Microsystems in the mid-1990s. Java was developed from the start...

  • How to Make a Flowchart for a Program With an Array

    In your computer science class, you may be required to draw a flowchart to represent the flow of logic for your assigned...

Related Ads

Featured