Created a new chessPanel for the chess board
parent
aa28f64c4f
commit
6baea13c56
|
|
@ -1,9 +1,22 @@
|
|||
package de.hs_mannheim.informatik.chess.gui;
|
||||
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.GridBagConstraints;
|
||||
import java.awt.GridBagLayout;
|
||||
import java.awt.GridLayout;
|
||||
import java.awt.Insets;
|
||||
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JPanel;
|
||||
import javax.swing.SwingConstants;
|
||||
|
||||
public class Gui {
|
||||
|
||||
private JLabel[][] fields = new JLabel[8][8];
|
||||
|
||||
public Gui(){
|
||||
mainFrame();
|
||||
}
|
||||
|
|
@ -12,9 +25,25 @@ public class Gui {
|
|||
JFrame frame = new JFrame();
|
||||
frame.setSize(1600, 1000);
|
||||
frame.setLocationRelativeTo(null);
|
||||
frame.add(chessPanel());
|
||||
|
||||
frame.setDefaultCloseOperation(2);
|
||||
frame.setVisible(true);
|
||||
return frame;
|
||||
}
|
||||
|
||||
public JPanel chessPanel() {
|
||||
JPanel chessPanel = new JPanel(new GridBagLayout());
|
||||
GridBagConstraints board = new GridBagConstraints();
|
||||
chessPanel.setBackground(new Color(0x1b263b));
|
||||
board.gridx = 0;
|
||||
board.gridy = 0;
|
||||
board.weightx = 0.7;
|
||||
board.weighty = 1.0;
|
||||
board.insets = new Insets(0, 0, 0, 0);
|
||||
//oben, links, unten, rechts
|
||||
board.fill = GridBagConstraints.BOTH;
|
||||
return chessPanel;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue