What’s the best way to display an image at specific coordinates in a java JFrame?
I know there are a number of ways to do this, I just need to know the best way to display an image that I am planning on moving around the frame!
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I would suggest adding it as an ImageIcon:
EDIT (How to add it add specific coordinates):
First a note, usually (99% of the cases) it is NOT encouraged to position JComponents yourself. Use a LayoutManager to position them for you, and handle the resizing.
I will tell you how to position it yourself though:
null:setLayout(null).ImageIconto specific coordinates:image.setLocation(x, y).