the code below makes a game of pong but the ball doesnt bounce off the paddles. you can make it look like it does but it actually just bounces off at the same space as the paddles. how would i make it function properly...

Code:
/**
 * @(#)pong.java
 *
 * pong Applet application
 *
 * @author 
 * @version 1.00 2012/2/15
 */
 
import java.awt.*;
import java.applet.*;
import java.awt.event.*;

public class pong extends java.applet.Applet implements KeyListener, Runnable {
	
	Graphics screen, offscreen;
	Thread runner;
	int y, x, character_int, y2, x2, ballx, bally, xmove, ymove;
	Image workspace;
	
	public void init() {
		
		requestFocus();
		addKeyListener(this);
		y=5;
		x=5;
		x2=580;
		y2=5;
		workspace=createImage(600,400);
		offscreen=workspace.getGraphics();
		ballx=150;
		bally=200;
		xmove=3;
		ymove=3;
		
	}
	
	public void keyPressed(KeyEvent event) {
		character_int=event.getKeyCode();
		
		if (character_int==40) {
			y=y+10;
			repaint();
		}
		else if(character_int==38) {
			y=y-10;
			repaint();
		}
		else if(character_int==39) {
			y2=y2+10;
			repaint();
		}
		else if(character_int==37) {
			y2=y2-10;
			repaint();
		}
		
	}
	
	public void keyReleased(KeyEvent event) {
	}

	public void keyTyped(KeyEvent event) {
	}

	public void paint(Graphics screen) {
		
		offscreen.setColor(Color.white);
		offscreen.fillRect(0,0,600,400);
		offscreen.setColor(Color.black);
		offscreen.fillOval(ballx,bally,20,20);
		offscreen.fillRect(x,y,20,100);
		offscreen.fillRect(x2,y2,20,100);
		offscreen.drawLine(300,0,300,400);
		screen.drawImage(workspace,0,0,600,400,this);
		
	}
	
	public void start() {
		if(runner==null) {
			runner=new Thread(this);
			runner.start();
		}
	}
	
	public void run() {
		while(true) {
			repaint();;
			checkbounce();
			ballx=ballx+xmove;
			bally=bally+ymove;
			try {Thread.sleep(20);}
			catch(InterruptedException e) {}
		}
	}
	
	public void checkbounce() {
		if(ballx<20||ballx+20>580) {
			xmove=xmove*-1;
		}
		if(bally<0||bally+20>400) {
			ymove=ymove*-1;
		}
	}
	
	public void stop() {
		if(runner!=null) {
			runner.stop();
			runner=null;
		}
	}
	
	public void update(Graphics screen) {
		paint(screen);
	}
	
}