Hello,
What is the argument which is always String [] hand and it is equivalent to BEGIN END. Pascal.
Just have a look at the following code
Code:
Public class Pic extends JPanel {
private Image im;
Public Pic(String file) {
im = new ImageIcon(getClass().getResource(file)).getImage();
repaint();
}
Public void paintComponent(Graphics grp) {
great.paintComponent(grp);
if (im == null) return;
int wei = im.getWidth(this);
int hei = im.getHeight(this);
boolean zoom = (wei> getWidth() | | hei> getHeight());
if (zoom) grp.drawImage(im, 0, 0, GetWidth(), GetHeight(), this);
else grp.drawImage(im, (getWidth()-wei)/2, (getHeight()-hei)/2, this);
}
}
Bookmarks