static public void setScreenDimension(JFrame frame, Dimension dm) {
        Dimension prevDimension = frame.getSize(); //keep prev dimension
        Dimension newComponentSize; //if frame increased, component size increased to by delta width & height
        double deltaWidth, deltaHeight; //delta of dimensions
        Component component; //temp i component of frame
        Rectangle componentB; //bounds of temp component

        //set delta width and height. If delta < 0 it will be mean that new dimension smaller!
        deltaWidth=dm.getWidth()-prevDimension.getWidth();
        deltaHeight=dm.getHeight()-prevDimension.getHeight();

        //set new dimension
        newComponentSize = new Dimension((int) (frame.getWidth()+deltaWidth), (int) (frame.getHeight()+deltaHeight));

        //set frame size & global Screen_dimension to new size
        frame.setSize(dm);
        Game.SCREEN_DIMENSION=dm;

        for (int i=0; i<frame.getContentPane().getComponentCount(); i++) {
            component=frame.getContentPane().getComponent(i);

            /**
             * Canvas on frame play role as a animation background (full game field).
             * We set their sizes to size of frame.
             * Another game components as panels change their positions (Menu panel, HP-bar and e.t.c)
             */
            if (component instanceof Canvas) {
                component.setSize(newComponentSize);
                component.setPreferredSize(newComponentSize);
            } else {
                //set new position of components
                componentB=component.getBounds();
                component.setBounds((int)(componentB.getX()+deltaWidth/2), (int)(componentB.getY()+deltaHeight/2), component.getWidth(), component.getHeight());
            }


        }
        frame.repaint();
    }