Add mainPanel() to arrange chess board and stats panels in GUI
parent
42bbdf3e43
commit
987bd867c8
|
|
@ -26,14 +26,40 @@ public class Gui {
|
|||
JFrame frame = new JFrame();
|
||||
frame.setSize(1600, 1000);
|
||||
frame.setLocationRelativeTo(null);
|
||||
frame.add(statsPanel());
|
||||
frame.add(chessPanel(boardPanel()));
|
||||
frame.add(mainPanel());
|
||||
|
||||
frame.setDefaultCloseOperation(2);
|
||||
frame.setVisible(true);
|
||||
return frame;
|
||||
}
|
||||
|
||||
public JPanel mainPanel() {
|
||||
JPanel mainPanel = new JPanel(new GridBagLayout());
|
||||
GridBagConstraints gbc = new GridBagConstraints();
|
||||
mainPanel.setBackground(new Color(0xe0e1dd));
|
||||
// Links (Schach)
|
||||
gbc.gridx = 0;
|
||||
gbc.gridy = 0;
|
||||
gbc.weightx = 0.6;
|
||||
gbc.weighty = 1.0;
|
||||
gbc.insets = new Insets(5, 5, 5, 0);
|
||||
//oben, links, unten, rechts
|
||||
gbc.fill = GridBagConstraints.BOTH;
|
||||
mainPanel.add(chessPanel(boardPanel()),gbc);
|
||||
|
||||
// Rechts (Stats)
|
||||
gbc.gridx = 1;
|
||||
gbc.gridy = 0;
|
||||
gbc.weightx = 0.4;
|
||||
gbc.weighty = 1.0;
|
||||
gbc.insets = new Insets(5, 0, 5, 5);
|
||||
//oben, links, unten, rechts
|
||||
gbc.fill = GridBagConstraints.BOTH;
|
||||
mainPanel.add(statsPanel(), gbc);
|
||||
|
||||
return mainPanel;
|
||||
}
|
||||
|
||||
public JPanel boardPanel() {
|
||||
JPanel boardPanel = new JPanel(new GridLayout(8, 8));
|
||||
boardPanel.setPreferredSize(new Dimension(800, 800));
|
||||
|
|
|
|||
Loading…
Reference in New Issue