예제 #1
0
 @Override
 public Dimension getPreferredSize() {
   if (img == null) {
     return new Dimension(100, 100);
   } else {
     return new Dimension(img.getWidth(), img.getHeight());
   }
 }
예제 #2
0
 @Override
 public void paint(Graphics g) {
   g.drawImage(img.getImage(), 0, 0, null);
 }
예제 #3
0
 public ImagePanel(String imagePath) {
   img = Image.loadImage(imagePath);
 }