Which programming model are you using (Sample, Iterative, etc)?
What model of joystick are you using?
What motor controller are you using (Talon SR, Talon SRX, Jaguar...)?
Essentially, you need to declare a motor controller and a joystick axis, and do a motor.set(joystick.getX()) several times a second.
Here's a recent snapshot of our current "elevator" at github. It's built on the IterativeRobot template.