Sat, 26 Jan 2013 18:38:12 +0100
added license and main menu
universe@3 | 1 | /* |
universe@3 | 2 | * Copyright 2013 Mike Becker. All rights reserved. |
universe@3 | 3 | * |
universe@3 | 4 | * Redistribution and use in source and binary forms, with or without |
universe@3 | 5 | * modification, are permitted provided that the following conditions are met: |
universe@3 | 6 | * |
universe@3 | 7 | * 1. Redistributions of source code must retain the above copyright |
universe@3 | 8 | * notice, this list of conditions and the following disclaimer. |
universe@3 | 9 | * |
universe@3 | 10 | * 2. Redistributions in binary form must reproduce the above copyright |
universe@3 | 11 | * notice, this list of conditions and the following disclaimer in the |
universe@3 | 12 | * documentation and/or other materials provided with the distribution. |
universe@3 | 13 | * |
universe@3 | 14 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" |
universe@3 | 15 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
universe@3 | 16 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
universe@3 | 17 | * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE |
universe@3 | 18 | * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
universe@3 | 19 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
universe@3 | 20 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
universe@3 | 21 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
universe@3 | 22 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
universe@3 | 23 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
universe@3 | 24 | * POSSIBILITY OF SUCH DAMAGE. |
universe@3 | 25 | */ |
universe@3 | 26 | |
universe@1 | 27 | package de.uapcore.sudoku; |
universe@1 | 28 | |
universe@1 | 29 | import java.awt.Color; |
universe@3 | 30 | import java.awt.Container; |
universe@1 | 31 | import java.awt.GridBagConstraints; |
universe@1 | 32 | import java.awt.GridBagLayout; |
universe@1 | 33 | import java.awt.Insets; |
universe@1 | 34 | import javax.swing.JFrame; |
universe@1 | 35 | |
universe@1 | 36 | /** |
universe@1 | 37 | * |
universe@1 | 38 | * @author mike |
universe@1 | 39 | */ |
universe@2 | 40 | public final class Sudoku extends JFrame { |
universe@1 | 41 | |
universe@1 | 42 | public Sudoku() { |
universe@1 | 43 | super("Sudoku"); |
universe@1 | 44 | |
universe@2 | 45 | Field f = new Field(); |
universe@2 | 46 | ActionHandler h = new ActionHandler(f); |
universe@3 | 47 | setJMenuBar(new MainMenu(h).getMenuBar()); |
universe@2 | 48 | |
universe@3 | 49 | Container content = getContentPane(); |
universe@1 | 50 | |
universe@3 | 51 | content.setLayout(new GridBagLayout()); |
universe@1 | 52 | GridBagConstraints c = new GridBagConstraints(); |
universe@1 | 53 | c.insets = new Insets(20, 20, 20, 20); |
universe@2 | 54 | c.fill = GridBagConstraints.HORIZONTAL; |
universe@1 | 55 | |
universe@1 | 56 | c.gridx = 0; c.gridy = 0; |
universe@3 | 57 | content.add(f, c); |
universe@2 | 58 | c.gridy++; |
universe@3 | 59 | content.add(new ButtonPanel(h), c); |
universe@1 | 60 | |
universe@1 | 61 | pack(); |
universe@3 | 62 | content.setBackground(Color.WHITE); |
universe@1 | 63 | setLocationByPlatform(true); |
universe@1 | 64 | setDefaultCloseOperation(EXIT_ON_CLOSE); |
universe@1 | 65 | } |
universe@1 | 66 | |
universe@1 | 67 | /** |
universe@1 | 68 | * @param args the command line arguments |
universe@1 | 69 | */ |
universe@1 | 70 | public static void main(String[] args) { |
universe@1 | 71 | new Sudoku().setVisible(true); |
universe@1 | 72 | } |
universe@1 | 73 | } |