Update Git

This commit is contained in:
HORVILLE 2022-09-14 11:09:51 +02:00
parent 781fda9f71
commit b6569352fc
4 changed files with 41 additions and 46 deletions

3
.gitignore vendored
View File

@ -75,3 +75,6 @@ tags
#Visual Studio COde #Visual Studio COde
*.vscode *.vscode
#Java
*.class

View File

@ -23,7 +23,7 @@ public class Confirmation {
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
window.setSize(700, 700); window.setSize(700, 700);
window.setLocation(200, 200); window.setLocation(200, 200);
window.addWindowListener(new ConfirmationWListener()); window.addWindowListener(new ConfirmationListener());
window.setVisible(true); window.setVisible(true);
contentPane = window.getContentPane(); contentPane = window.getContentPane();
@ -32,7 +32,7 @@ public class Confirmation {
for (String path : paths) { for (String path : paths) {
JLabel label = new JLabel(new ImageIcon("./images/" + path + ".png")); JLabel label = new JLabel(new ImageIcon("./images/" + path + ".png"));
label.addMouseListener(new ConfirmationMListener()); label.addMouseListener(new ConfirmationListener());
contentPane.add(label, path); contentPane.add(label, path);
} }
} }

View File

@ -5,7 +5,7 @@ import java.awt.event.*;
/** /**
* GalleryWListener * GalleryWListener
*/ */
public class ConfirmationWListener implements WindowListener { public class ConfirmationListener implements WindowListener, MouseListener {
@Override @Override
public void windowActivated(WindowEvent e) { 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
}
} }

View File

@ -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
}
}