src/de/uapcore/sudoku/ButtonPanel.java

changeset 2
5179eff8a9b6
child 3
ed931970b4ac
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/de/uapcore/sudoku/ButtonPanel.java	Sat Jan 26 17:42:07 2013 +0100
     1.3 @@ -0,0 +1,46 @@
     1.4 +package de.uapcore.sudoku;
     1.5 +
     1.6 +import java.awt.Color;
     1.7 +import java.awt.GridBagConstraints;
     1.8 +import java.awt.GridBagLayout;
     1.9 +import java.awt.Insets;
    1.10 +import javax.swing.JButton;
    1.11 +import javax.swing.JPanel;
    1.12 +
    1.13 +/**
    1.14 + *
    1.15 + * @author mike
    1.16 + */
    1.17 +public final class ButtonPanel extends JPanel {
    1.18 +    
    1.19 +    private JButton save, check, solve;
    1.20 +
    1.21 +    public ButtonPanel(ActionHandler l) {
    1.22 +        setLayout(new GridBagLayout());
    1.23 +        
    1.24 +        GridBagConstraints c = new GridBagConstraints();
    1.25 +        c.insets = new Insets(10, 10, 10, 10);
    1.26 +        c.fill = GridBagConstraints.HORIZONTAL;
    1.27 +        c.weightx = 1;
    1.28 +        
    1.29 +        c.gridx = 0;
    1.30 +        c.gridy = 0;
    1.31 +        save = new JButton("Speichern");
    1.32 +        add(save, c);
    1.33 +        c.gridx++;
    1.34 +        check = new JButton("Prüfen");
    1.35 +        add(check, c);
    1.36 +        solve = new JButton("Lösen");
    1.37 +        c.gridx++;
    1.38 +        add(solve, c);
    1.39 +        
    1.40 +        save.setActionCommand(ActionHandler.SAVE);
    1.41 +        save.addActionListener(l);
    1.42 +        check.setActionCommand(ActionHandler.CHECK);
    1.43 +        check.addActionListener(l);
    1.44 +        solve.setActionCommand(ActionHandler.SOLVE);
    1.45 +        solve.addActionListener(l);
    1.46 +        
    1.47 +        setBackground(Color.WHITE);
    1.48 +    }
    1.49 +}

mercurial