I need a way to insert a picture so that it is displayed on any computer. And I know only one method through JLable. And then it works on one computer. Thank you for your reply.

  • more precisely in JPanel - Bake
  • Describe your problem in more detail. What does it mean - "how to insert a picture so that it is displayed on any computer", and - "method via JLable". At least "Paste" where and why? And also learn to formulate a thought. - Alexander du Sautoy
  • I beg your pardon. I create an application in Eclipse. I have several panels in the frame. Not the point. So I need to insert a picture into the panel. Yes, so that it was not local and displayed on any computer. - Bake
  • Alternatively, when loading a picture, you can use a relative path to it. - post_zeew
  • I mean, how is it? - Bake

1 answer 1

If you add your picture to the jar file to be launched, then you can upload it later as a resource. example:

new JLabel(new ImageIcon(ClassLoader.getSystemResource("image.png")))