0

I'm using code:

main.setContentPane(new JLabel(new ImageIcon(ImageIO.read(new File("4.jpg")).getScaledInstance(main.getContentPane().getWidth(), main.getContentPane().getHeight(), Image.SCALE_SMOOTH))));

to set the image.problem is,it's not on the full frame

enter image description here

and having 1 more problem when I'm designing GUI in the NetBeans IDE,the picture is overlapping the components. enter image description here

plz suggest some solution.

Sameer Azeem
  • 548
  • 2
  • 9
  • 22

1 Answers1

0

You need to use layout manager. Without layout manager it will be difficult to resize components manually. Check these links Resize the components of the frame in full-screen mode & Visual Guide to Layouts. IMHO what you need is either Grid Layout or Border Layout.

Community
  • 1
  • 1
bprasanna
  • 2,423
  • 3
  • 27
  • 39
  • i'm using main.setContentPane and default layout by netbeans ide is free layout or some thing like that then why do i need to set Grid Layout or Border Layout. – Sameer Azeem Nov 17 '14 at 14:31