Commit 11e0dc1c authored by YuFan Jia's avatar YuFan Jia 💤
Browse files

feat(update):

parent d224f155
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -22,7 +22,7 @@ public class ChessBoardPanel extends JPanel {
        this.setVisible(true);
        this.setFocusable(true);
        this.setLayout(new GridLayout(this.boardRows, this.boardCols));
        // this.setBackground(Color.yellow);// todo: choose a beautiful color
        this.setBackground(Color.PINK);// todo: choose a beautiful color
        this.boardRows = boardRows;
        this.boardCols = boardCols;
        chessBoard = new ChessPanel[boardRows][boardCols];
+43 −0
Original line number Diff line number Diff line
package GameUI;

import java.awt.*;
import javax.swing.*;

/**
 * @author uint44t
 */
public class BasicBackground extends JFrame {
	public static ChessGameUI thisChessGameUI;
	public static StartMenuUI thisStartMenuUI;

	public BasicBackground() {
		initComponents();
		thisChessGameUI = new ChessGameUI();
		thisStartMenuUI = new StartMenuUI();
		changePanel(thisChessGameUI);
	}

	public void changePanel(JPanel o) {
		this.add(o);
		o.updateUI();
	}

	private void initComponents() {
		// JFormDesigner - Component initialization - DO NOT MODIFY
		// //GEN-BEGIN:initComponents

		// ======== basic ========
		{
			this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
			this.setVisible(true);
			this.setTitle("Othello");
			this.setName("backFrame");
			Container basicContentPane = this.getContentPane();
			basicContentPane.setPreferredSize(new Dimension(700, 500));
			this.pack();
			this.setLocationRelativeTo(null);
		}
		// JFormDesigner - End of component initialization //GEN-END:initComponents
	}

}
+22 −0
Original line number Diff line number Diff line
JFDML JFormDesigner: "7.0.4.0.360" Java: "15.0.1" encoding: "UTF-8"

new FormModel {
	contentType: "form/swing"
	root: new FormRoot {
		"$setComponentNames": true
		add( new FormWindow( "javax.swing.JFrame", new FormLayoutManager( class java.awt.BorderLayout ) {
			"hgap": 500
			"vgap": 450
		} ) {
			name: "basic"
			"defaultCloseOperation": 3
			"$locationPolicy": 1
			"visible": true
			"title": "Othello"
			"name": "backFrame"
		}, new FormLayoutConstraints( null ) {
			"size": new java.awt.Dimension( 500, 500 )
			"location": new java.awt.Point( 180, 0 )
		} )
	}
}
+11 −18
Original line number Diff line number Diff line
@@ -15,7 +15,7 @@ import Model.CheatStatus;
/**
 * @author uint44t
 */
public class ChessGameUI {
public class ChessGameUI extends JPanel {

	public ChessGameUI() {
		initComponents();
@@ -77,7 +77,7 @@ public class ChessGameUI {
		System.out.println(select);
	}

	JFrame background = new JFrame();
	// JFrame background = new JFrame();
	JPanel bottomButtons = new JPanel();
	JButton importButton = new JButton();
	JButton exportButton = new JButton();
@@ -96,18 +96,13 @@ public class ChessGameUI {

		// ======== background ========
		{
			background.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
			background.setVisible(true);
			background.setTitle("Othello");
			background.setName("backFrame");
			Container bcakgroundContentPane = background.getContentPane();
			bcakgroundContentPane.setLayout(new BorderLayout(10, 10));
			background.setPreferredSize(new Dimension(700, 500));
			background.addComponentListener(new ComponentAdapter() {
			this.setVisible(true);
			this.setLayout(new BorderLayout(10, 5));
			this.setPreferredSize(new Dimension(700, 500));
			this.addComponentListener(new ComponentAdapter() {
				@Override
				public void componentResized(ComponentEvent e) {
					thisGameCore.zoom(bcakgroundContentPane.getWidth(),
							bcakgroundContentPane.getHeight());
					thisGameCore.zoom(getWidth(), getHeight());
					thisGameCore.getGamePanel().updateUI();
					// System.out.println(background.getWidth() + "\t" + background.getHeight());
				}
@@ -116,9 +111,9 @@ public class ChessGameUI {
			center.add(thisGameCore.getGamePanel());
			// background.add(new JPanel().add(thisGameCore.getGamePanel()),
			// BorderLayout.CENTER);
			bcakgroundContentPane.add(center, BorderLayout.CENTER);
			bcakgroundContentPane.add(thisStatus, BorderLayout.WEST);
			bcakgroundContentPane.add(thisPlayerName, BorderLayout.EAST);
			this.add(center, BorderLayout.CENTER);
			this.add(thisStatus, BorderLayout.WEST);
			this.add(thisPlayerName, BorderLayout.EAST);

			// ======== bottomButtons ========
			{
@@ -158,11 +153,9 @@ public class ChessGameUI {
				bottomButtons.add(cheat);

			}
			bcakgroundContentPane.add(bottomButtons, BorderLayout.SOUTH);
			this.add(bottomButtons, BorderLayout.SOUTH);
		}

		background.pack();
		background.setLocationRelativeTo(null);
		// JFormDesigner - End of component initialization //GEN-END:initComponents
	}
	// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables

GameUI/SetPlayer.java

0 → 100644
+32 −0
Original line number Diff line number Diff line
package GameUI;

import java.awt.*;
import javax.swing.*;
/*
 * Created by JFormDesigner on Sun Dec 19 15:58:27 CST 2021
 */

/**
 * @author uint44t
 */
public class SetPlayer extends JFrame {
	public SetPlayer() {
		initComponents();
	}

	private void initComponents() {
		// JFormDesigner - Component initialization - DO NOT MODIFY
		// //GEN-BEGIN:initComponents

		// ======== this ========
		setTitle("Othello");
		Container contentPane = getContentPane();
		contentPane.setLayout(new FlowLayout());
		pack();
		setLocationRelativeTo(getOwner());
		// JFormDesigner - End of component initialization //GEN-END:initComponents
	}

	// JFormDesigner - Variables declaration - DO NOT MODIFY //GEN-BEGIN:variables
	// JFormDesigner - End of variables declaration //GEN-END:variables
}
Loading