src/main/java/de/uapcore/sudoku/ButtonPanel.java

Sat, 25 Jul 2020 15:56:48 +0200

author
Mike Becker <universe@uap-core.de>
date
Sat, 25 Jul 2020 15:56:48 +0200
changeset 11
f7433671fec5
parent 10
369903afbb29
child 12
1c62c6009161
permissions
-rw-r--r--

missing class documentation

3
ed931970b4ac added license and main menu
Mike Becker <universe@uap-core.de>
parents: 2
diff changeset
1 /*
ed931970b4ac added license and main menu
Mike Becker <universe@uap-core.de>
parents: 2
diff changeset
2 * Copyright 2013 Mike Becker. All rights reserved.
ed931970b4ac added license and main menu
Mike Becker <universe@uap-core.de>
parents: 2
diff changeset
3 *
ed931970b4ac added license and main menu
Mike Becker <universe@uap-core.de>
parents: 2
diff changeset
4 * Redistribution and use in source and binary forms, with or without
ed931970b4ac added license and main menu
Mike Becker <universe@uap-core.de>
parents: 2
diff changeset
5 * modification, are permitted provided that the following conditions are met:
ed931970b4ac added license and main menu
Mike Becker <universe@uap-core.de>
parents: 2
diff changeset
6 *
ed931970b4ac added license and main menu
Mike Becker <universe@uap-core.de>
parents: 2
diff changeset
7 * 1. Redistributions of source code must retain the above copyright
ed931970b4ac added license and main menu
Mike Becker <universe@uap-core.de>
parents: 2
diff changeset
8 * notice, this list of conditions and the following disclaimer.
ed931970b4ac added license and main menu
Mike Becker <universe@uap-core.de>
parents: 2
diff changeset
9 *
ed931970b4ac added license and main menu
Mike Becker <universe@uap-core.de>
parents: 2
diff changeset
10 * 2. Redistributions in binary form must reproduce the above copyright
ed931970b4ac added license and main menu
Mike Becker <universe@uap-core.de>
parents: 2
diff changeset
11 * notice, this list of conditions and the following disclaimer in the
ed931970b4ac added license and main menu
Mike Becker <universe@uap-core.de>
parents: 2
diff changeset
12 * documentation and/or other materials provided with the distribution.
ed931970b4ac added license and main menu
Mike Becker <universe@uap-core.de>
parents: 2
diff changeset
13 *
ed931970b4ac added license and main menu
Mike Becker <universe@uap-core.de>
parents: 2
diff changeset
14 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
ed931970b4ac added license and main menu
Mike Becker <universe@uap-core.de>
parents: 2
diff changeset
15 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
ed931970b4ac added license and main menu
Mike Becker <universe@uap-core.de>
parents: 2
diff changeset
16 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ed931970b4ac added license and main menu
Mike Becker <universe@uap-core.de>
parents: 2
diff changeset
17 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
ed931970b4ac added license and main menu
Mike Becker <universe@uap-core.de>
parents: 2
diff changeset
18 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
ed931970b4ac added license and main menu
Mike Becker <universe@uap-core.de>
parents: 2
diff changeset
19 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
ed931970b4ac added license and main menu
Mike Becker <universe@uap-core.de>
parents: 2
diff changeset
20 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
ed931970b4ac added license and main menu
Mike Becker <universe@uap-core.de>
parents: 2
diff changeset
21 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
ed931970b4ac added license and main menu
Mike Becker <universe@uap-core.de>
parents: 2
diff changeset
22 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
ed931970b4ac added license and main menu
Mike Becker <universe@uap-core.de>
parents: 2
diff changeset
23 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
ed931970b4ac added license and main menu
Mike Becker <universe@uap-core.de>
parents: 2
diff changeset
24 * POSSIBILITY OF SUCH DAMAGE.
ed931970b4ac added license and main menu
Mike Becker <universe@uap-core.de>
parents: 2
diff changeset
25 */
ed931970b4ac added license and main menu
Mike Becker <universe@uap-core.de>
parents: 2
diff changeset
26
2
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
27 package de.uapcore.sudoku;
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
28
9
576e7a2861ae converts to maven project
Mike Becker <universe@uap-core.de>
parents: 3
diff changeset
29 import javax.swing.*;
576e7a2861ae converts to maven project
Mike Becker <universe@uap-core.de>
parents: 3
diff changeset
30 import java.awt.*;
2
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
31
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
32 /**
10
369903afbb29 adds more javadoc
Mike Becker <universe@uap-core.de>
parents: 9
diff changeset
33 * The panel displaying some actions for the Sudoku solver.
2
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
34 */
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
35 public final class ButtonPanel extends JPanel {
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
36
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
37 private JButton save, check, solve;
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
38
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
39 public ButtonPanel(ActionHandler l) {
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
40 setLayout(new GridBagLayout());
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
41
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
42 GridBagConstraints c = new GridBagConstraints();
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
43 c.insets = new Insets(10, 10, 10, 10);
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
44 c.fill = GridBagConstraints.HORIZONTAL;
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
45 c.weightx = 1;
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
46
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
47 c.gridx = 0;
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
48 c.gridy = 0;
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
49 save = new JButton("Speichern");
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
50 add(save, c);
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
51 c.gridx++;
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
52 check = new JButton("Prüfen");
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
53 add(check, c);
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
54 solve = new JButton("Lösen");
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
55 c.gridx++;
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
56 add(solve, c);
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
57
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
58 save.setActionCommand(ActionHandler.SAVE);
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
59 save.addActionListener(l);
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
60 check.setActionCommand(ActionHandler.CHECK);
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
61 check.addActionListener(l);
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
62 solve.setActionCommand(ActionHandler.SOLVE);
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
63 solve.addActionListener(l);
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
64
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
65 setBackground(Color.WHITE);
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
66 }
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
67 }

mercurial