1 package capocalGUI;
2
3 import java.awt.BorderLayout;
4 import java.awt.FlowLayout;
5
6 import javax.swing.JButton;
7 import javax.swing.JDialog;
8 import javax.swing.JPanel;
9 import javax.swing.border.EmptyBorder;
10 import java.awt.Component;
11 import javax.swing.JLabel;
12 import javax.swing.SwingConstants;
13 import java.awt.Font;
14
15
19 public class Ck_confirmremoval extends JDialog {
20
21
24 private static final long serialVersionUID = 1L;
25 private final JPanel contentPanel = new JPanel();
26
27
31 @SuppressWarnings("static-access")
32 public static void main(String[] args) {
33 try {
34 Ck_confirmremoval dialog = new Ck_confirmremoval();
35 dialog.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE);
36 dialog.setVisible(true);
37 } catch (Exception e) {
38 e.printStackTrace();
39 }
40 }
41
42
45 public Ck_confirmremoval() {
46 setTitle("Varmistetaan poisto");
47 setBounds(100, 100, 300, 150);
48 getContentPane().setLayout(new BorderLayout());
49 contentPanel.setBorder(new EmptyBorder(5, 5, 5, 5));
50 getContentPane().add(contentPanel, BorderLayout.CENTER);
51 contentPanel.setLayout(new BorderLayout(0, 0));
52 {
53 JLabel lblPoistetaankoHarjoitus = new JLabel("Poistetaanko harjoitus: <harjPvm> ?");
54 lblPoistetaankoHarjoitus.setFont(new Font("Tahoma", Font.PLAIN, 11));
55 lblPoistetaankoHarjoitus.setHorizontalAlignment(SwingConstants.CENTER);
56 contentPanel.add(lblPoistetaankoHarjoitus, BorderLayout.CENTER);
57 }
58 {
59 JPanel buttonPane = new JPanel();
60 buttonPane.setLayout(new FlowLayout(FlowLayout.RIGHT));
61 getContentPane().add(buttonPane, BorderLayout.SOUTH);
62 {
63 JButton okButton = new JButton("Kyll\u00E4");
64 okButton.setAlignmentX(Component.CENTER_ALIGNMENT);
65 okButton.setActionCommand("OK");
66 buttonPane.add(okButton);
67 getRootPane().setDefaultButton(okButton);
68 }
69 {
70 JButton cancelButton = new JButton("Ei");
71 cancelButton.setActionCommand("Cancel");
72 buttonPane.add(cancelButton);
73 }
74 }
75 }
76
77 }
78