mirror of
https://github.com/lov3b/Schack.git
synced 2025-01-18 12:50:10 +01:00
Förbättring av logpanel
This commit is contained in:
parent
be59f829c5
commit
d499280b25
@ -1,6 +1,7 @@
|
|||||||
package com.billenius.schack;
|
package com.billenius.schack;
|
||||||
|
|
||||||
import java.awt.Dimension;
|
import java.awt.Dimension;
|
||||||
|
import java.awt.Font;
|
||||||
import java.awt.HeadlessException;
|
import java.awt.HeadlessException;
|
||||||
import java.awt.event.ActionEvent;
|
import java.awt.event.ActionEvent;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
@ -9,14 +10,17 @@ import java.net.UnknownHostException;
|
|||||||
|
|
||||||
import javax.swing.DefaultListModel;
|
import javax.swing.DefaultListModel;
|
||||||
import javax.swing.JFrame;
|
import javax.swing.JFrame;
|
||||||
|
import javax.swing.JLabel;
|
||||||
import javax.swing.JList;
|
import javax.swing.JList;
|
||||||
import javax.swing.JMenu;
|
import javax.swing.JMenu;
|
||||||
import javax.swing.JMenuBar;
|
import javax.swing.JMenuBar;
|
||||||
import javax.swing.JMenuItem;
|
import javax.swing.JMenuItem;
|
||||||
import javax.swing.JOptionPane;
|
import javax.swing.JOptionPane;
|
||||||
|
import javax.swing.JPanel;
|
||||||
import javax.swing.JScrollPane;
|
import javax.swing.JScrollPane;
|
||||||
import javax.swing.JSplitPane;
|
import javax.swing.JSplitPane;
|
||||||
import javax.swing.UIManager;
|
import javax.swing.UIManager;
|
||||||
|
import java.awt.BorderLayout;
|
||||||
|
|
||||||
import com.billenius.schack.MoveLogging.Move;
|
import com.billenius.schack.MoveLogging.Move;
|
||||||
import com.billenius.schack.MoveLogging.PieceRenderer;
|
import com.billenius.schack.MoveLogging.PieceRenderer;
|
||||||
@ -51,16 +55,26 @@ public class Schack {
|
|||||||
// Might throw an IOException if the icon of the Pieces isn't embedded correctly
|
// Might throw an IOException if the icon of the Pieces isn't embedded correctly
|
||||||
final Board board = new Board(listModel);
|
final Board board = new Board(listModel);
|
||||||
|
|
||||||
|
// Logger
|
||||||
final JList<Move> jlist = new JList<>(listModel);
|
final JList<Move> jlist = new JList<>(listModel);
|
||||||
jlist.setVisible(true);
|
jlist.setVisible(true);
|
||||||
jlist.setCellRenderer(new PieceRenderer());
|
jlist.setCellRenderer(new PieceRenderer());
|
||||||
|
JScrollPane scrollPane = new JScrollPane(jlist);
|
||||||
|
// scrollPane.setPreferredSize(new Dimension(120, 700));
|
||||||
|
JPanel logPanel = new JPanel(new BorderLayout());
|
||||||
|
logPanel.setPreferredSize(new Dimension(120, 800));
|
||||||
|
|
||||||
|
JLabel infoText = new JLabel("Moves");
|
||||||
|
infoText.setFont(new Font("Cantarell", Font.PLAIN, 18));
|
||||||
|
|
||||||
|
infoText.setHorizontalAlignment(JLabel.CENTER);
|
||||||
|
logPanel.add(infoText, BorderLayout.NORTH);
|
||||||
|
logPanel.add(scrollPane, BorderLayout.CENTER);
|
||||||
|
|
||||||
JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
|
JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
|
||||||
splitPane.setDividerLocation(800);
|
splitPane.setDividerLocation(800);
|
||||||
board.setMinimumSize(new Dimension(800, 800));
|
|
||||||
jlist.setMinimumSize(new Dimension(200, 800));
|
|
||||||
splitPane.setLeftComponent(board);
|
splitPane.setLeftComponent(board);
|
||||||
splitPane.setRightComponent(new JScrollPane(jlist));
|
splitPane.setRightComponent(logPanel);
|
||||||
|
|
||||||
frame.setContentPane(splitPane);
|
frame.setContentPane(splitPane);
|
||||||
frame.getContentPane().addMouseListener(board);
|
frame.getContentPane().addMouseListener(board);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user