[Solved] Java Timer : I want to fade in and out for my picture but there are some error [closed]


Screen size you cat get without using JFrame’s instance:

    screen = Toolkit.getDefaultToolkit().getScreenSize();

Also after creating JFrame, add a component listener to update width, height on any resize:

    JFrame frame = new JFrame("fade frame");
    frame.addComponentListener(new ComponentAdapter() {
        @Override
        public void componentResized(ComponentEvent e) {
            width = image.getWidth(frame);
            height = image.getHeight(frame);
        }
    });

solved Java Timer : I want to fade in and out for my picture but there are some error [closed]