DEV TP02
This commit is contained in:
37
DEV/DEV3.1/TP02/Part2/CloseVerificationWindow.java
Normal file
37
DEV/DEV3.1/TP02/Part2/CloseVerificationWindow.java
Normal file
@@ -0,0 +1,37 @@
|
||||
import java.awt.BorderLayout;
|
||||
import java.awt.GridLayout;
|
||||
|
||||
import javax.swing.JButton;
|
||||
import javax.swing.JDialog;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
|
||||
public class CloseVerificationWindow extends JDialog {
|
||||
|
||||
public CloseVerificationWindow(ImageWindow parent) {
|
||||
super(parent, true);
|
||||
|
||||
this.setSize(parent.getWidth() / 3, parent.getHeight() / 3);
|
||||
this.setLocationRelativeTo(parent);
|
||||
this.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
|
||||
this.setLayout(new GridLayout(2, 1));
|
||||
|
||||
JLabel text = new JLabel("Are you sure you want to close the window?");
|
||||
text.setVerticalAlignment(JLabel.CENTER);
|
||||
text.setHorizontalAlignment(JLabel.CENTER);
|
||||
this.add(text);
|
||||
|
||||
JPanel panel = new JPanel();
|
||||
panel.setLayout(new BorderLayout());
|
||||
|
||||
JButton approveButton = new JButton("Yes");
|
||||
approveButton.addActionListener(new ApprovedButtonPressedEvent(this));
|
||||
panel.add(approveButton, BorderLayout.WEST);
|
||||
|
||||
JButton cancelButton = new JButton("No");
|
||||
cancelButton.addActionListener(new CancelButtonPressedEvent(this));
|
||||
panel.add(cancelButton, BorderLayout.EAST);
|
||||
|
||||
this.add(panel);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user