diff --git a/.gitignore b/.gitignore index 26ccfe4..c90cc0b 100644 --- a/.gitignore +++ b/.gitignore @@ -75,3 +75,6 @@ tags #Visual Studio COde *.vscode + +#Java +*.class diff --git a/DEV 3.1/TP2/Confirmation/Confirmation.java b/DEV 3.1/TP2/Confirmation/Confirmation.java index d007018..fee10cb 100644 --- a/DEV 3.1/TP2/Confirmation/Confirmation.java +++ b/DEV 3.1/TP2/Confirmation/Confirmation.java @@ -23,7 +23,7 @@ public class Confirmation { window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); window.setSize(700, 700); window.setLocation(200, 200); - window.addWindowListener(new ConfirmationWListener()); + window.addWindowListener(new ConfirmationListener()); window.setVisible(true); contentPane = window.getContentPane(); @@ -32,7 +32,7 @@ public class Confirmation { for (String path : paths) { JLabel label = new JLabel(new ImageIcon("./images/" + path + ".png")); - label.addMouseListener(new ConfirmationMListener()); + label.addMouseListener(new ConfirmationListener()); contentPane.add(label, path); } } diff --git a/DEV 3.1/TP2/Confirmation/ConfirmationWListener.java b/DEV 3.1/TP2/Confirmation/ConfirmationListener.java similarity index 67% rename from DEV 3.1/TP2/Confirmation/ConfirmationWListener.java rename to DEV 3.1/TP2/Confirmation/ConfirmationListener.java index 8755fa9..3daa724 100644 --- a/DEV 3.1/TP2/Confirmation/ConfirmationWListener.java +++ b/DEV 3.1/TP2/Confirmation/ConfirmationListener.java @@ -5,7 +5,7 @@ import java.awt.event.*; /** * GalleryWListener */ -public class ConfirmationWListener implements WindowListener { +public class ConfirmationListener implements WindowListener, MouseListener { @Override public void windowActivated(WindowEvent e) { @@ -71,5 +71,40 @@ public class ConfirmationWListener implements WindowListener { } + @Override + public void mouseClicked(MouseEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void mouseEntered(MouseEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void mouseExited(MouseEvent e) { + // TODO Auto-generated method stub + + } + + @Override + public void mousePressed(MouseEvent e) { + JLabel source = (JLabel)e.getSource(); + int x = e.getX(); + + if (x > source.getWidth() / 2) { + Confirmation.next(); + } else { + Confirmation.previous(); + } + } + + @Override + public void mouseReleased(MouseEvent e) { + // TODO Auto-generated method stub + + } } \ No newline at end of file diff --git a/DEV 3.1/TP2/Confirmation/ConfirmationMListener.java b/DEV 3.1/TP2/Confirmation/ConfirmationMListener.java deleted file mode 100644 index fd7362d..0000000 --- a/DEV 3.1/TP2/Confirmation/ConfirmationMListener.java +++ /dev/null @@ -1,43 +0,0 @@ -import javax.swing.*; -import java.awt.*; -import java.awt.event.*; - -public class ConfirmationMListener implements MouseListener { - - @Override - public void mouseClicked(MouseEvent e) { - // TODO Auto-generated method stub - - } - - @Override - public void mouseEntered(MouseEvent e) { - // TODO Auto-generated method stub - - } - - @Override - public void mouseExited(MouseEvent e) { - // TODO Auto-generated method stub - - } - - @Override - public void mousePressed(MouseEvent e) { - JLabel source = (JLabel)e.getSource(); - int x = e.getX(); - - if (x > source.getWidth() / 2) { - Confirmation.next(); - } else { - Confirmation.previous(); - } - } - - @Override - public void mouseReleased(MouseEvent e) { - // TODO Auto-generated method stub - - } - -}