public JLabel SetImage(String path) throws IOException {
ImageIcon myPicture = new ImageIcon(path);//ImageIO.read(new File(path));
JLabel picLabel = new JLabel();
picLabel.setBounds(0, 0, 2, 2);
picLabel.setIcon(myPicture);
pnlImage.setLayout(null);
pnlImage.add(picLabel);
pnlImage.repaint();
pnlImage.revalidate();
return picLabel;
}
try {
String Ref = txtRef.getText();
SetImage();
JLabel label = new JLabel();
label = SetImage("C:\\Users\\Documents");
App\\ImagesDoc_001.jpg");
pnlImage.setLayout(null);
pnlImage.add(label);
pnlImage.repaint();
pnlImage.revalidate();
} catch (IOException ex)
can anyone help me with this piece of code.. i am trying to load an image but it isnt loading