I am creating a JFrame with background image. My JFrame is extended in full size of my screen by using setExtendedState() method,
but when i place an image in the Frame , it appears small related to the Frame.
Please help me, is there any way to stretch the image to the size of the JFrame.
Thanks sir, its working now.
But now im facing a new problem that i have placed some components on a JPanel
and im not able to see those components except TextFields.
It seems that the image is overlapping the components.
The layout is BorderLayout.CENTER, but the TextFields appears on the top of the JFrame.
How can I get those components Visible and at the center of the screen.
Since you got the code ready made, you might as well find out and let us know
1) Why does the code use the SwingUtilities#invokeLater
2) Why does the code use getClass().getResource()
Joined: Oct 10, 2010
Well, now there is no problem. thanks sir.
1) I think that SwingUtilities is a class and invokeLater is its method. i have not much idea about the class, its is simply related to Threading.
But invokeLater() method is used it schedule the task in the Thread.
2) getClass() is used to get Image and also used to get information about the Image.
getResource() checks the image in the directory with the help of Class Loader, it returns the URL of the Image.