Thanks Justin and David!
David, I think your solution could well work. In the end though, I completed the program by implementing the interfaces MouseInputListener and MouseWheelListener on the class with the variables I needed to access. I'm so new to Java that I wasn't aware you could implement two interfaces on the same class, before I did some research.
In fact the cube does rotate and translate. It doesn't just translate the 2D image, it translates the representation of the cube in 3D space and draws it exactly as you would see it, in perspective. It assumes the viewer's eye is in the middle of the window according to the original window size (and 2200 pixels distance from the screen), so if you resize the window your eye is probably in the wrong place. I'm quite proud of the program so I'm posting the full source code below. It's made up of four classes, so it's probably best if you save them in four separate files, called respectively MyFrame.java, MyComponent.java, Point3D.java and PlanePoint.java. Look for the comments in caps to see where to separate the files. Most of the code isn't properly commented though I'm afraid. I'm sorry if this isn't the accepted place to post long source code. I'm very new here!
I think there are bits of code here that aren't needed (used for testing purposes). I could also save memory by cutting down on variables (lots of variables helped to get it clear in my head), and it may not be the most efficient way of doing things, but the vector maths is pretty sound (I'm a mathematician). You can't beat that feeling you get when you try a piece of code and it works! I'd be interested to see what people think. Please post comments or questions.
Finally here's how you get it to work:
Originally you see just the face of the cube that is nearest you.
Click and drag anywhere on the cube (or window) to translate it.
Roll the mouse wheel to translate the cube towards or away from you.
But best of all, click and drag on any of the vertices to rotate the cube. That's the bit that took the most thought and effort!