swing - Java: Ball Collision with Frame -
How to not know how to kill it I have to kill I currently have a ball that moves diagonally downwards and on the right, When it is collided with the edge of the frame, it needs to bounce. Main: Class controlled bottle JPanel {Private int x = 70; Private int y = 30; Private bullion yes = true; Public Zero Paint Component (Graphics G) {SuperpactConant (G); Graphics 2DG2 = (Graphics 2D) G; G2.setColor (Color.BLUE); Oval 2D Double ball = new oval 2D Double (X, Y, 50,50); g2.draw (ball); g2.fill (ball); } Public Zero Step: Wright (int d) {x = x + d}} Public Zero Step Down (int d) {y = y + d;} public void gogo () {yes = true;} Public zero nono () {Yes = false;} public static zero main (string [] args) {JFrame frame = new viewer (); Frame.setSize (500, 500); Frame.setTitle ("bouncing ball"); Frame.setDefaultCloseOperation ((JFrame.EXIT_ON_CLOSE)); Frame.setVisible (true); }} Viewer category: public class viewer JFrame {JButton go = new JButton ("GO"); Jebton...