hi, i am a totally new programmer here and i have something to ask, i have uploaded a picture into my GUI which displays on a Label, but the label dimension is set only 100,100 while the picture is much bigger so when i upload it into the label it expands , is there anyway to make it auto resize to the label size? below is the action listener for the Upload Picture JButton
class UploadHandler implements ActionListener
{
public void actionPerformed(ActionEvent e)
{
int returnVal = fc.showOpenDialog(frame2);
file = fc.getSelectedFile();
pathname = file.getPath();
icon = new ImageIcon(pathname);
lblDisPic.setIcon(icon);
}
}
btnUpload = new JButton("Upload Picture");
lblDisPic = new JLabel();
lblDisPic.setBorder(raisedetched);
lblDisPic.setPreferredSize(d);
btnUpload.addActionListener(new UploadHandler());