universe@3: /* universe@3: * Copyright 2013 Mike Becker. All rights reserved. universe@3: * universe@3: * Redistribution and use in source and binary forms, with or without universe@3: * modification, are permitted provided that the following conditions are met: universe@3: * universe@3: * 1. Redistributions of source code must retain the above copyright universe@3: * notice, this list of conditions and the following disclaimer. universe@3: * universe@3: * 2. Redistributions in binary form must reproduce the above copyright universe@3: * notice, this list of conditions and the following disclaimer in the universe@3: * documentation and/or other materials provided with the distribution. universe@3: * universe@3: * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" universe@3: * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE universe@3: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE universe@3: * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE universe@3: * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR universe@3: * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF universe@3: * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS universe@3: * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN universe@3: * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) universe@3: * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE universe@3: * POSSIBILITY OF SUCH DAMAGE. universe@3: */ universe@3: universe@2: package de.uapcore.sudoku; universe@2: universe@9: import javax.swing.*; universe@9: import java.awt.*; universe@2: universe@2: /** universe@2: * universe@2: * @author mike universe@2: */ universe@2: public final class ButtonPanel extends JPanel { universe@2: universe@2: private JButton save, check, solve; universe@2: universe@2: public ButtonPanel(ActionHandler l) { universe@2: setLayout(new GridBagLayout()); universe@2: universe@2: GridBagConstraints c = new GridBagConstraints(); universe@2: c.insets = new Insets(10, 10, 10, 10); universe@2: c.fill = GridBagConstraints.HORIZONTAL; universe@2: c.weightx = 1; universe@2: universe@2: c.gridx = 0; universe@2: c.gridy = 0; universe@2: save = new JButton("Speichern"); universe@2: add(save, c); universe@2: c.gridx++; universe@2: check = new JButton("Prüfen"); universe@2: add(check, c); universe@2: solve = new JButton("Lösen"); universe@2: c.gridx++; universe@2: add(solve, c); universe@2: universe@2: save.setActionCommand(ActionHandler.SAVE); universe@2: save.addActionListener(l); universe@2: check.setActionCommand(ActionHandler.CHECK); universe@2: check.addActionListener(l); universe@2: solve.setActionCommand(ActionHandler.SOLVE); universe@2: solve.addActionListener(l); universe@2: universe@2: setBackground(Color.WHITE); universe@2: } universe@2: }