38 lines
1.2 KiB
Java
38 lines
1.2 KiB
Java
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);
|
|
}
|
|
}
|