|
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 */ |
|
26 |
1 package de.uapcore.sudoku; |
27 package de.uapcore.sudoku; |
2 |
28 |
3 import java.awt.Color; |
29 import java.awt.Color; |
|
30 import java.awt.Container; |
4 import java.awt.GridBagConstraints; |
31 import java.awt.GridBagConstraints; |
5 import java.awt.GridBagLayout; |
32 import java.awt.GridBagLayout; |
6 import java.awt.Insets; |
33 import java.awt.Insets; |
7 import javax.swing.JFrame; |
34 import javax.swing.JFrame; |
8 import javax.swing.JRootPane; |
|
9 |
35 |
10 /** |
36 /** |
11 * |
37 * |
12 * @author mike |
38 * @author mike |
13 */ |
39 */ |
16 public Sudoku() { |
42 public Sudoku() { |
17 super("Sudoku"); |
43 super("Sudoku"); |
18 |
44 |
19 Field f = new Field(); |
45 Field f = new Field(); |
20 ActionHandler h = new ActionHandler(f); |
46 ActionHandler h = new ActionHandler(f); |
|
47 setJMenuBar(new MainMenu(h).getMenuBar()); |
21 |
48 |
22 JRootPane root = getRootPane(); |
49 Container content = getContentPane(); |
23 |
50 |
24 root.setLayout(new GridBagLayout()); |
51 content.setLayout(new GridBagLayout()); |
25 GridBagConstraints c = new GridBagConstraints(); |
52 GridBagConstraints c = new GridBagConstraints(); |
26 c.insets = new Insets(20, 20, 20, 20); |
53 c.insets = new Insets(20, 20, 20, 20); |
27 c.fill = GridBagConstraints.HORIZONTAL; |
54 c.fill = GridBagConstraints.HORIZONTAL; |
28 |
55 |
29 c.gridx = 0; c.gridy = 0; |
56 c.gridx = 0; c.gridy = 0; |
30 root.add(f, c); |
57 content.add(f, c); |
31 c.gridy++; |
58 c.gridy++; |
32 root.add(new ButtonPanel(h), c); |
59 content.add(new ButtonPanel(h), c); |
33 |
60 |
34 pack(); |
61 pack(); |
35 root.setBackground(Color.WHITE); |
62 content.setBackground(Color.WHITE); |
36 setLocationByPlatform(true); |
63 setLocationByPlatform(true); |
37 setDefaultCloseOperation(EXIT_ON_CLOSE); |
64 setDefaultCloseOperation(EXIT_ON_CLOSE); |
38 } |
65 } |
39 |
66 |
40 /** |
67 /** |