I am sorry, for not providing the coding. I have the following code, but I want the image covers only the halves of my JFrame .. what should I change it to fit as I want?
Since, you have mentioned that you have tried to do lot of changes in your coding, I am sure that you are having sample of it. It would be easy for us to explain you according to your coding.
Please help me as soon as possible.
(public class ImageTest
public static void main (String  args) (
ImagePanel panel = new ImagePanel (new ImageIcon ("images / background.png"). GetImage ());
JFrame frame = new JFrame ();
frame.getContentPane (). add (panel);
ImagePanel class extends JPanel (
private Image img;
Public ImagePanel (String img) (
this (new ImageIcon (img). getImage ());
Public ImagePanel (Image img) (
this.img = img;
Dimension size = new Dimension (img.getWidth (null), img.getHeight (null));
public void paintComponent (Graphics g) (
g.drawImage (img, 0, 0, null);