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

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

mercurial