hello, iam making a game on java, its a speed typing game, random words appear on the screen and u should type them before they go to the end of screen, for example if 10 words crossed the screen u will lose :D 
so my problem is i wanna put words in a file, and  this file send these words to drawstring fuction, i made a class that read file and everything and make an object in the main and it gives me error , i want to send the words from the file to be displayed on the screen using the drawstring built in method , thank you in advance and here is my code :) 
the main:
 package projectt;

import java.awt.Color;
import java.awt.DisplayMode;
import java.awt.Font;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.RenderingHints;

import javax.swing.JFrame;
import javax.swing.JPanel;


public class Game extends JPanel{


int x=0;
int y= (int)(Math.random()*400);

void moveWord(){
x=x+1;
}


public void Word(){

}

public void paint(Graphics g){
super.paint(g);
Graphics2D gd= (Graphics2D) g;
gd.setRenderingHint(RenderingHints.KEY_ANTIALIASING,RenderingHints.VALUE_ANTIALIAS_ON);

readFile O=new readFile();
O.readFile();
String R;
R=O.a;
O.openFile();
O.readFile();




g.drawString(O.a,x,y);

O.closeFile();
}

public void run(DisplayMode dm){
setBackground(Color.BLACK);
setForeground(Color.WHITE);
setFont(new Font("Times New Roman",Font.PLAIN,18));


}
public static void main(String[] args) throws InterruptedException {
readFile X=new readFile();
/*X.openFile();
X.readFile();
X.closeFile();*/




JFrame frame = new JFrame ("Speed Typing");
Game game= new Game();
DisplayMode dm= new DisplayMode(800,600,16,DisplayMode.REFRESH_RATE_UNKNOWN);
frame.add(game);
frame.setSize(400,400);
frame.setVisible(true);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

while(true){
game.moveWord();
game.run(dm);
Thread.sleep(10);
}
}

}


and the file class : 
package projectt;
import java.io.*;
import java.util.*;


public class readFile {
private Scanner x;
public String a;

public void openFile()
{
try {
x=new Scanner(new File("words.txt"));

}
catch (Exception e)
{
System.out.println(" you have got an error mam");
}
}
public void readFile()
{

while(x.hasNext())
{
 a=x.next();
 



}



}

public void closeFile()
{
x.close();
}
}