|
|
@ -0,0 +1,63 @@ |
|
|
|
package de.tims.fleetstorm.gui; |
|
|
|
|
|
|
|
import java.awt.Color; |
|
|
|
import java.awt.Font; |
|
|
|
import java.util.ArrayList; |
|
|
|
|
|
|
|
import javax.swing.JFrame; |
|
|
|
import javax.swing.JLabel; |
|
|
|
import javax.swing.JPanel; |
|
|
|
import javax.swing.border.MatteBorder; |
|
|
|
|
|
|
|
public class GUI extends JPanel { |
|
|
|
|
|
|
|
private ArrayList<JPanel> fields; |
|
|
|
|
|
|
|
public GUI() { |
|
|
|
this.fields = new ArrayList<>(); |
|
|
|
setSize(640, 480); |
|
|
|
|
|
|
|
JPanel fieldWrapper = new JPanel(); |
|
|
|
fieldWrapper.setBounds(10, 11, 362, 458); |
|
|
|
fieldWrapper.setLayout(null); |
|
|
|
|
|
|
|
JPanel infoWrapper = new JPanel(); |
|
|
|
infoWrapper.setBounds(382, 11, 248, 458); |
|
|
|
|
|
|
|
JLabel hasMoveLabel = new JLabel("Am Zug:"); |
|
|
|
hasMoveLabel.setFont(new Font("Tahoma", Font.BOLD, 11)); |
|
|
|
infoWrapper.add(hasMoveLabel); |
|
|
|
|
|
|
|
JLabel hasMove = new JLabel("Spieler"); |
|
|
|
infoWrapper.add(hasMove); |
|
|
|
setLayout(null); |
|
|
|
add(fieldWrapper); |
|
|
|
add(infoWrapper); |
|
|
|
|
|
|
|
int gap = 30; |
|
|
|
int width = 28; |
|
|
|
|
|
|
|
for (int x = 0; x < 10; x++) { |
|
|
|
for (int y = 0; y < 10; y++) { |
|
|
|
JPanel field = new JPanel(); |
|
|
|
field.setBounds(gap + x * width, gap + y * width, width, width); |
|
|
|
field.setBorder(new MatteBorder(1, 1, 1, 1, (Color) new Color(0, 0, 0))); |
|
|
|
fields.add(field); |
|
|
|
fieldWrapper.add(field); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* This function is only for testing |
|
|
|
*/ |
|
|
|
public static void main(String[] args) { |
|
|
|
JFrame frame = new JFrame("Test GUI"); |
|
|
|
GUI gui = new GUI(); |
|
|
|
frame.setContentPane(gui); |
|
|
|
frame.setSize(640, 480); |
|
|
|
frame.setResizable(true); |
|
|
|
frame.setVisible(true); |
|
|
|
} |
|
|
|
} |