Possible Duplicate:
How to dynamically add JLabels to JPanel?
private void jXHyperlink1MouseClicked(java.awt.event.MouseEvent evt) {
NewClass n=new NewClass();
n.myf();
try{
ImageIcon ic=new ImageIcon("tmp/Photo0087.jpg");
ll=new JLabel(ic,JLabel.CENTER);
jPanel6.add(ll);
repaint();
}catch(Exception x){
System.out.println(x.getMessage());
}
}
myf()
method opens up a JFileChooser
in which on Pressing Open button of JFileChooser
the image file gets copied to a temporary folder tmp (I copied Photo0087.jpg).
I am trying to display the file Photo0087.jpg on a JLabel
for which i wrote the above code but its not working.