View (Model m, Model m2) {
        model = m;
        model2 =m2;
        model.addObserver(this);
        model2.addObserver(this);
        sp = new ImageIcon(getClass().getResource("pic/start.png"));
        rp = new ImageIcon(getClass().getResource("pic/replay.png"));
        quit = new ImageIcon(getClass().getResource("pic/cross.png"));
        Image img = sp.getImage() ;
        Image newimg = img.getScaledInstance(100,100,java.awt.Image.SCALE_SMOOTH ) ;
        sp = new ImageIcon( newimg );
        img = rp.getImage() ;
        newimg = img.getScaledInstance(100,100,java.awt.Image.SCALE_SMOOTH ) ;
        rp = new ImageIcon( newimg );
        img = quit.getImage() ;
        newimg = img.getScaledInstance(100,100,java.awt.Image.SCALE_SMOOTH ) ;
        quit = new ImageIcon( newimg );
        hit=false;
        missed=0;

        start= new JButton(sp);
        this.add(start);

        //layout.putConstraint(SpringLayout.NORTH, start, 50, SpringLayout.NORTH, this);
        //layout.putConstraint(SpringLayout.EAST, start, 50, SpringLayout.EAST, this);

        JButton exit = new JButton(quit);
        JButton replay= new JButton(rp);
        exitP = new JPanel();
        exitP.setLayout(new BoxLayout(exitP,BoxLayout.LINE_AXIS));
        exitP.setPreferredSize(new Dimension(231,110));
        exitP.add(replay);
        exitP.add(exit);
        this.add(exitP);
        exitP.setVisible(false);
        /*
        start.setPreferredSize(new Dimension(50,50));
        JPanel exitP = new JPanel();
        exitP.setPreferredSize(new Dimension(50,50));
        exitP.setLayout(new BorderLayout());
        exitP.add(exit, BorderLayout.CENTER);
        this.add(start,BorderLayout.CENTER);*/

        setBackground(Color.WHITE);
        try {
            backG = ImageIO.read(new File("pic/bg.png"));
            hitI = ImageIO.read(new File("pic/hit.png"));
            bk = ImageIO.read(new File("pic/bk.png"));
            bk2 = ImageIO.read(new File("pic/bk2.png"));
            go = ImageIO.read(new File("pic/go.png"));
            miss = ImageIO.read(new File("pic/miss.png"));

        } catch (IOException ex) {
            System.out.print("cant find pic");
        }






        // drag represents the last drag performed, which we will need to calculate the angle of the slice
        drag = new MouseDrag();
        // add mouse listener
        addMouseListener(mouseListener);

        atimer = new Timer(50, new ActionListener() {
            @Override

            public void actionPerformed(ActionEvent e) {
                model.P();
                if (counter==0)
                    model.checkTimer();
                //System.out.print(counter%10==0);
                start.setVisible(false);
                if(missed==5)
                {
                    atimer.stop();
                    exitP.setVisible(true);
                    model.checkTimer();
                    repaint();

                }
                if(counter%30==0)
                    hit=false;

                if(counter%20==0){
                    int temp=randomWithRange(50,70);
                Fruit f = new Fruit(new Area(new Ellipse2D.Double(0, 0, temp,temp)));
                f.translate(0.5*getWidth(),getHeight());
                model2.add(f);

                }
                for(Fruit f: model2.getShapes())
                {
                    f.move();
                    if(f.getTransformedShape().getBounds().getY()>800)
                    {
                        model2.removeF(f);
                        missed++;
                    }

                }

                for(Fruit f: model.getShapes())
                {
                f.translate(f.expandNumber*0.7,f.droppingNumber*1.5);
                  if(f.getTransformedShape().getBounds().getY()>800)
                     model.removeF(f);


                }
                counter++;
                repaint();
            }
        });

        start.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                atimer.start();
            }
        });
        exit.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                System.exit(0);
            }
        });
        replay.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                model.removeALL();
                model2.removeALL();
                atimer.start();
                missed=0;
                exitP.setVisible(false);
                model.checkTimer();
            }
        });
    }