else
else{
    public void paintComponent(Graphics g) {        if (image != null)        {            if (getHeight()!=imageHeight){                if (getHeight()>=minImageHeight){                    int newImageHeight = getHeight();                    Image image2 = new BufferedImage(width, newImageHeight, BufferedImage.TYPE_INT_ARGB);                    Graphics g2 = image2.getGraphics();                    g2.setColor(Color.BLACK);                    g2.fillRect(0, 0 , width, newImageHeight);                    g2.drawImage(image, 0, newImageHeight-imageHeight, null);                    imageHeight = newImageHeight;                    image = image2;                    setPreferredSize(new Dimension(width, imageHeight));                }            }            if (getWidth()>width){                int oldWidth = width;                width = getWidth();                Image image2 = new BufferedImage(width, imageHeight, BufferedImage.TYPE_INT_ARGB);                Graphics g2 = image2.getGraphics();                g2.setColor(Color.BLACK);                g2.fillRect(0, 0 , width, imageHeight);                g2.drawImage(image, 0, 0, null);                g2.setColor(Color.WHITE);                g2.drawLine(oldWidth, imageHeight - bottomHeight, width, imageHeight - bottomHeight);                g2.drawLine(oldWidth, imageHeight - bottomHeight - 21, width, imageHeight - bottomHeight - 21);                g2.drawLine(oldWidth, imageHeight - bottomHeight - 41, width, imageHeight - bottomHeight - 41);                g2.drawLine(oldWidth, imageHeight - bottomHeight - 61, width, imageHeight - bottomHeight - 61);                g2.drawLine(oldWidth, imageHeight - bottomHeight - 81, width, imageHeight - bottomHeight - 81);                g2.drawLine(oldWidth, imageHeight - bottomHeight - 101, width, imageHeight - bottomHeight - 101);                g2.drawLine(oldWidth, imageHeight - bottomHeight - 121, width, imageHeight - bottomHeight - 121);                g2.drawLine(oldWidth, imageHeight - bottomHeight - 141, width, imageHeight - bottomHeight - 141);                g2.drawLine(oldWidth, imageHeight - bottomHeight - 161, width, imageHeight - bottomHeight - 161);                g2.drawLine(oldWidth, imageHeight - bottomHeight - 181, width, imageHeight - bottomHeight - 181);                g2.drawLine(oldWidth, imageHeight - bottomHeight - 201, width, imageHeight - bottomHeight - 201);                g2.drawLine(oldWidth, imageHeight - bottomHeight - 221, width, imageHeight - bottomHeight - 221);                g2.drawLine(oldWidth, imageHeight - bottomHeight - 241, width, imageHeight - bottomHeight - 241);                image = image2;                setPreferredSize(new Dimension(width, imageHeight));            }            g.drawImage(image, 0, 0, null);        }        else            super.paintComponent(g);    }