-1
I have a project in JAVA, which has a graphical interface with a screen, developed with the Swing.
I have 2 images, background and favicon, which are in the package: [code]br with drsolutions monitor images[/code]
Structure of the Project: br with drsolutions monitor images Background. png icon. br with drsolutions monitor network Testaricmp.java br with drsolutions monitor ux Interfacegrafica.java br with drsolutions monitor Java application.
In the archive Interfacegrafica.java, add the images in Jframe as follows:
...
jFrame = new JFrame("Monitorar");
jFrame.setSize(246, 410);
jFrame.setResizable(false);
jFrame.setLayout(null);
jFrame.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
/* Colocar a imagem no background e o ícone na janela */
try {
jFrame.setContentPane(new JLabel(new ImageIcon(
ImageIO.read(new File("src\\br\\com\\drsolutions\\monitorar\\imagens\\Fundo.jpg")))
));
jFrame.setIconImage(new ImageIcon("src\\br\\com\\drsolutions\\monitorar\\imagens\\icone.png")
.getImage()
);
} catch (IOException e) {
return false;
}
...
How can I add the images without having to pass the full path this way?
How to make the images work in the JAR file I Gero?
Thank you, Diego M. Rodrigues