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

Sat, 25 Jul 2020 14:01:28 +0200

author
Mike Becker <universe@uap-core.de>
date
Sat, 25 Jul 2020 14:01:28 +0200
changeset 9
576e7a2861ae
parent 3
src/de/uapcore/sudoku/ButtonPanel.java@ed931970b4ac
child 10
369903afbb29
permissions
-rw-r--r--

converts to maven project

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 /**
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
33 *
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
34 * @author mike
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
35 */
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
36 public final class ButtonPanel extends JPanel {
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
37
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
38 private JButton save, check, solve;
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
39
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
40 public ButtonPanel(ActionHandler l) {
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
41 setLayout(new GridBagLayout());
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
42
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
43 GridBagConstraints c = new GridBagConstraints();
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
44 c.insets = new Insets(10, 10, 10, 10);
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
45 c.fill = GridBagConstraints.HORIZONTAL;
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
46 c.weightx = 1;
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
47
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
48 c.gridx = 0;
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
49 c.gridy = 0;
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
50 save = new JButton("Speichern");
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
51 add(save, c);
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
52 c.gridx++;
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
53 check = new JButton("Prüfen");
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
54 add(check, c);
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
55 solve = new JButton("Lösen");
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
56 c.gridx++;
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
57 add(solve, c);
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
58
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
59 save.setActionCommand(ActionHandler.SAVE);
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
60 save.addActionListener(l);
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
61 check.setActionCommand(ActionHandler.CHECK);
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
62 check.addActionListener(l);
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
63 solve.setActionCommand(ActionHandler.SOLVE);
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
64 solve.addActionListener(l);
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
65
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
66 setBackground(Color.WHITE);
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
67 }
5179eff8a9b6 check functions
Mike Becker <universe@uap-core.de>
parents:
diff changeset
68 }

mercurial