Inversion des slashs

This commit is contained in:
antoine.gagneux 2025-04-04 15:55:11 +02:00
parent e5cc58a082
commit d82d562645
2 changed files with 3 additions and 4 deletions

View File

@ -33,7 +33,7 @@ public class JPanelImage extends JPanel {
private void chargerImage(){ private void chargerImage(){
if(sNomImage!=null) { if(sNomImage!=null) {
String sNomFile=".\\images\\"+sNomImage; String sNomFile=".//images//"+sNomImage;
try { try {
image = ImageIO.read(new File(sNomFile)); image = ImageIO.read(new File(sNomFile));
} catch (IOException ex) { } catch (IOException ex) {

View File

@ -26,10 +26,10 @@ public class MaJFrame extends JFrame {
contentPane.setLayout(new BorderLayout(0, 0)); contentPane.setLayout(new BorderLayout(0, 0));
setContentPane(contentPane); setContentPane(contentPane);
panel = new JPanelImage(); panel = new JPanelImage("image1.jpg");
contentPane.add(panel, BorderLayout.NORTH); contentPane.add(panel, BorderLayout.NORTH);
JButton btnNewButton = new JButton("Ne fait Rien !"); JButton btnNewButton = new JButton("Clic me !");
btnNewButton.addActionListener(new ActionListener() { btnNewButton.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) { public void actionPerformed(ActionEvent e) {
clicBouton(); clicBouton();
@ -42,7 +42,6 @@ public class MaJFrame extends JFrame {
} }
public void clicBouton() { public void clicBouton() {
panel.setImage("image1.jpg");
panel_1.setImage("image2.png"); panel_1.setImage("image2.png");
} }