valleytech
asked on
quick question.
hi,
after i click and drag a TextArea to Jframe. Please help me on how to load an image from a specific directory to that TextArea. Thanks.
after i click and drag a TextArea to Jframe. Please help me on how to load an image from a specific directory to that TextArea. Thanks.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
here is how you load image to JLabel,
http://www.java2s.com/Tutorial/Java/0240__Swing/AddIcontoJLabel.htm
http://www.java2s.com/Tutorial/Java/0240__Swing/AddIcontoJLabel.htm
ASKER
one quick question.
when i set the path to the image, it's my computer path. However, when i move the project to different systm, that path will be invalid. So it can't load image. What should i do to overcome this problem? thanks.
when i set the path to the image, it's my computer path. However, when i move the project to different systm, that path will be invalid. So it can't load image. What should i do to overcome this problem? thanks.
either use JEdtiorPane or JLable if you just want to display the image in the screen!