Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Fenetre {
- Panneau pano;
- public Fenetre() {
- JFrame frame = new JFrame();
- frame.setTitle("ma fenetre");
- frame.setSize(300, 300);
- frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
- frame.setVisible(true);
- pano = new Panneau();
- JPanel pan = new JPanel();
- pan.setBackground(Color.PINK);
- frame.getContentPane().add(pano);
- }
- public static void main(String[] args) throws InterruptedException {
- Fenetre fenetre = new Fenetre();
- fenetre.go();
- }
- public void go() throws InterruptedException {
- for (int i = 0; i < 120; i++) {
- int a = pano.getX();
- int b = pano.getY();
- a++;
- b++;
- pano.setX(a);
- pano.setY(b);
- System.out.println(a);
- pano.repaint();
- Thread.sleep(50);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment