Update Git
This commit is contained in:
parent
781fda9f71
commit
b6569352fc
3
.gitignore
vendored
3
.gitignore
vendored
@ -75,3 +75,6 @@ tags
|
||||
|
||||
#Visual Studio COde
|
||||
*.vscode
|
||||
|
||||
#Java
|
||||
*.class
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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
|
||||
|
||||
}
|
||||
|
||||
}
|
@ -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
|
||||
|
||||
}
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user