@Override
    public void paintComponent (Graphics page) {
        if (myBackgroundImage == null) {
            super.paintComponent(page);
        }
        else {
            super.paintComponent(page);
            Image img = null;
            try {
                img = ImageIO.read(myBackgroundImage);
            }
            catch (IOException e) {
                e.printStackTrace();
            }
            int h = img.getHeight(null);
            int w = img.getWidth(null);
            if (w > this.getWidth() || w < this.getWidth()) {
                img = img.getScaledInstance(getWidth(), -1, Image.SCALE_DEFAULT);
                h = img.getHeight(null);
            }
            if (h > this.getHeight() || h < this.getHeight()) {
                img = img.getScaledInstance(-1, getHeight(), Image.SCALE_DEFAULT);
            }
            int x = (getWidth() - img.getWidth(null)) / 2;
            int y = (getHeight() - img.getHeight(null)) / 2;
            page.drawImage(img, x, y, null);
        }
    }