setFocusable() should only allow you to focus a component, not transfer the focus to that component.
I'm not positive on the focus system in Java, but I believe calling requestFocusInWindow() will...
Type: Posts; User: helloworld922
setFocusable() should only allow you to focus a component, not transfer the focus to that component.
I'm not positive on the focus system in Java, but I believe calling requestFocusInWindow() will...
You're keeping track of the projectile's position, correct? At a given time step, simply keep updating it's position (this is a numerical integration).
position.x = position.x + velX * time_step...
It really boils down to a few equations:
The ball's initial x and y velocity is this:
Vx_0 = V * cos(theta)
Vy_0 = V * sin(theta)
where theta is the angle in radians and V is the magnitude...
There is a simple trigonometric relationship between the angle and the x/y velocity of the projectile. I would suggest reading Projectile motion - Wikipedia, the free encyclopedia.