Studyon Minte9.com
Netbeans




App embeded image



Right click on project / Properties / Sources / Add Foulder (data/images)
Clean and Build


package testexample; import java.awt.*; import javax.swing.*; import sun.applet.Main; public class Test extends JFrame { public static void main(String[] args) { Test frame = new Test(); frame.setBounds(200, 200, 300, 300); frame.setDefaultCloseOperation(EXIT_ON_CLOSE); frame.setLayout(new FlowLayout()); // not BorderLayout ! frame.setVisible(true); } public Test() { try { // --- Look Here --- // JLabel imageLabel = new JLabel(new ImageIcon(Main.class.getResource("/green.png"))); add(imageLabel); } catch (Exception e) {} } }
  Clean and Build testexample.jar (will contain green.png image)


http://stackoverflow.com/questions/2273040/how-to-bundle-images-in-jar-file