Only 1/5
of each image is displayed as you're using a null
layout and and setting the bounds of the containers that paint the images to sizes smaller then the images
this.setBounds(30,50,70,80);
and
image2.setBounds(100,120,170,400);
Use a layout manager, add the JPanels
test
and test2
to the JFrame
and invoke JFrame#pack
. Ensure that both panels have a preferred size by overriding getPreferredSize
.
Aside: Java naming conventions show that class names start with uppercase letters such as Test
and Test2
.