So. I am making a hangman game. I am using the following code to pick a word.
Java Code:
package Hangman;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.IOException;
import java.io.File;
import java.util.ArrayList;
import java.util.Random;
public class WordBank 
	{

	public WordBank
		{
		/*declare an array list which doesn't have a set size and eliminates
		the need to know the size ahead of time. Meaning you can use any sized
		txt file*/
		
	    try 
	    	{
	         File words = new File("words.txt");
	         FileReader reader = new FileReader(words);
	         BufferedReader in = new BufferedReader(reader);
	         String string;
	         while ((string = in.readLine()) != null) {
	         wordlist.add(string);
	         }
	           in.close();
	         } catch (IOException e) {
	           e.printStackTrace();
	         }
	      
	        
	}
	//return a random element of the array. Although,java's random generator
	//is not really as random as it could be. Def work on this later if time
	//allows
		private String WordPick(ArrayList<Object> x)
			{
			String word;
			Random generator = new Random();
			int randomIndex = generator.nextInt(x.size());
			word = (String) x.get(randomIndex);
		
			return word;
			}
		
		public String getAnswer()
			{
			String x = WordPick(wordlist);
			return x;
			}
	}
Although, I'm really not quite sure the best implementation for this particular code.

Any suggestions on how I could maybe make this a bit better because, at the moment I'm unable to really do much with it..

I was thinking that I could have a single class which outputs a word

From there have the word split up into individual letters and placed on JPanels with a - on them. As the user guessed the right word the program would go in and change the - to the letter or display the hangman panel and increase a counter.