Usability Study Script

Author: Jan Rojcek

Date: 2004/04/01


Congratulations! You've just landed a new job at Digital Toy Shop, a firm that produces entertaining and educational Java applications for kids. Along with your new computer you've been given the company's IDE: NetBeans.

Task 1:

Feel free to spend a few moments looking through the IDE. Please remember to think aloud while you browse.

Task 2:

Time to get going. Please create and run a simple "Hello World" application. The end result should be a "Hello World" message printed to the console.

Task 3:

Your manager told you that you'll be working on completing the Anagram game. The GUI of Anagram game has already been implemented and it is located here:


Open and run the GUI of Anagram game.

Task 4:

Your colleague has just finished an initial version of library for the Anagram game, which contains the core logic of Anagram game. He didn't use NetBeans IDE so he sent you the sources of library only. They are located here:


Compile the library sources and jar the classes up. Make sure that Anagram GUI and library are in two distinct JAR files.

Task 5:

Modify the Anagram GUI to use the new library. Follow // XXX comments your colleague left in Anagrams class. Finally, run the Anagram game.

Task 6:

The wordlibrary class has scrambled and unscrambled words hard coded into it. Your manager left you a list of changes she'd like made to the library:

Create a text file of unscrambled words -use the words from the class.

Have the word library read in the text file and scramble the words. To read in the file use this code:

    private void readList() throws IOException {
        URL url = getClass().getResource("/wordlist.txt");
        if (url != null) {
            BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
            String line;
            ArrayList words = new ArrayList();
            ArrayList scrambled = new ArrayList();

            while (null != (line = br.readLine())) {

            wordList = (String []) words.toArray(new String [words.size()]);
            scrambledWordList = (String []) scrambled.toArray(new String [scrambled.size()]);

        } else {
            throw new IOException("File not found!");

To scramble the words use:

    private String scramble(String word) {
        int size = word.length();
        StringBuffer buffer = new StringBuffer();
        for (int i = 0; i + 1 < size; i += 2) {
            buffer.append(word.charAt(i + 1));

        if (buffer.length() < word.length()) {
            buffer.append(word.charAt(word.length() - 1));
        return buffer.toString();

Finally, you will need to add this line to the constructor:


Create a new package called com.toy.anagrams.lib.test and add a main class to it that prints the scrambled and unscrambled word pairs to help you easily test that the new library reads in the list of words and scrambles them.

    WordLibrary lib = new WordLibrary();
    for (int i = 0; i < lib.getSize(); i++) {
        System.out.println(lib.getWord(i) + " -> " + lib.getScrambledWord(i));

Test the library using this test class when finished.

Task 7:

You realize that it would be nice to have another type of test to interactively run an Anagram game in the console -this will let you more quickly verify that it is working the way you want. In the test class, add an argument "-interactive" that will run a console Anagram game. Use this code:

    if (Arrays.asList(args).contains("-interactive")) {
        BufferedReader br = new BufferedReader(new InputStreamReader(;
        int wordIdx = 0;
        String line;
        WordLibrary lib = new WordLibrary();
        while (true) {
            System.out.println("Scrambled word: " + lib.getScrambledWord(wordIdx));
            System.out.print("Your guess (type 'end' + ENTER to quit, ENTER for next word):");
            line = br.readLine();
            if (line == null || line.equals("end")) {
            } else if (line.length() != 0) {
                if (lib.isCorrect(wordIdx, line)) {
                    wordIdx = (wordIdx + 1) % lib.getSize();
                } else {
            } else {
                wordIdx = (wordIdx + 1) % lib.getSize();
    } else {
        WordLibrary lib = new WordLibrary();

        for (int i = 0; i < lib.getSize(); i++) {
            System.out.println(lib.getWord(i) + " -> " + lib.getScrambledWord(i));

Now you'll need to execute the test class passing it the '-interactive' argument.

Task 8:

Your manager stopped by and asked you to show her the anagram game. Run the full game.

Project Features

About this Project

ui was started in November 2009, is owned by Jiří Kovalský, and has 44 members.
By use of this website, you agree to the NetBeans Policies and Terms of Use (revision 20160708.bf2ac18). © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo
Please Confirm