ConnectN GUI error how do I change my Grid or Frame to fix the problem

this is the error im getting i have tried to rebuild it multiple times but i cant seem to pick out what the error is. if anyone can help me out that would be great

java.lang.Error: no ComponentUI class for: edu.wm.cs.cs301.connectn.view.ConnectNGridPanel[,0,0,0×0,invalid,layout=java.awt.FlowLayout,alignmentX=0.0,alignmentY=0.0,border=,flags=9,maximumSize=,minimumSize=,preferredSize=

package edu.wm.cs.cs301.connectn.view;

import java.awt.BorderLayout;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.KeyEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.swing.AbstractAction;
import javax.swing.ActionMap;
import javax.swing.BorderFactory;
import javax.swing.InputMap;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JMenu;
import javax.swing.JMenuBar;
import javax.swing.JMenuItem;
import javax.swing.JPanel;
import javax.swing.KeyStroke;
import javax.swing.SwingUtilities;

import edu.wm.cs.cs301.connectn.model.ConnectNModel;
/**
 * The ConnectNFrame class represents the main from of the game
 * contains user interface elements like grid panel, column panel, and menu bar
 */
public class ConnectNFrame {
    
    private final JFrame frame;
    
    private final ConnectNModel model;
    
    public final ConnectNGridPanel connectNGridPanel;
    
    private JLabel turnCountLabel;

    /**
     * Constructs a ConnectNFrame object with the given ConnectNModel
     * @param model The ConnectNModel instance representing the game model
     */
    public ConnectNFrame(ConnectNModel model) {
        this.model = model;
        this.connectNGridPanel = new ConnectNGridPanel(model.getGameBoard().getBoard());
        this.frame = createAndShowGUI();
        this.showInstructionsDialog();
    }
    /**
     * Creates and displays the main GUI for the ConnectN game
     * @return The JFrame object for the main frame
     */
    private JFrame createAndShowGUI() {
        JFrame frame = new JFrame("ConnectN");
        frame.setDefaultCloseOperation(JFrame.DO_NOTHING_ON_CLOSE);
        frame.setJMenuBar(createMenuBar());
        frame.setResizable(false);
        frame.addWindowListener(new WindowAdapter() {
            @Override
            public void windowClosing(WindowEvent event) {
                shutdown();
            }
        });

        // Creates panel to hold columnPanel and hintButton

        SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                frame.add(createTitlePanel(), BorderLayout.NORTH);
                JPanel turnCountPanel = createTurnCountPanel();
                frame.add(turnCountPanel, BorderLayout.CENTER);
                JPanel centerPanel = new JPanel(new FlowLayout(FlowLayout.CENTER));
                centerPanel.add(connectNGridPanel);
                frame.add(centerPanel, BorderLayout.SOUTH);
                frame.pack();
                int minFrameWidth = connectNGridPanel.getPreferredSize().width + 20; // Add a buffer
                int minFrameHeight = connectNGridPanel.getPreferredSize().height + 100;
                frame.setMinimumSize(new Dimension(minFrameWidth, minFrameHeight));
                frame.setLocationByPlatform(true);
                frame.setVisible(true);

        System.out.println("Frame size: " + frame.getSize());

            }
        });
        return frame;
    }
    
    private void showInstructionsDialog() {
        new InstructionsDialog(this);
    }
    /**
     * Creates the menu bar for the ConnectN game
     * @return the JMenuBar object for the menu bar
     */
    private JMenuBar createMenuBar() {
        JMenuBar menuBar = new JMenuBar();
        
        // Menu for mode
        JMenu modeMenu = new JMenu("Mode");
        menuBar.add(modeMenu);
        
        // Kids mode
        JMenuItem kidsModeItem = new JMenuItem("Small");
        modeMenu.add(kidsModeItem);
        
        // Normal mode
        JMenuItem normalModeItem = new JMenuItem("Medium");
        modeMenu.add(normalModeItem);
        
        // Hard mode
        JMenuItem hardModeItem = new JMenuItem("Large");
        modeMenu.add(hardModeItem);
        
        JMenuItem instructionsMenuItem = new JMenuItem("Instructions...");
        instructionsMenuItem.addActionListener(new ActionListener() {
            @Override
            public void actionPerformed(ActionEvent e) {
                showInstructionsDialog();
            }
        });
        menuBar.add(instructionsMenuItem);
        
        return menuBar;
    }
    
    /**
     * Creates the title panel for the ConnectN game
     * @return the JPanel object representing the title panel
     */
    private JPanel createTitlePanel() {
        JPanel panel = new JPanel(new FlowLayout());
        panel.setBorder(BorderFactory.createEmptyBorder(0, 5, 5, 5));
        
        InputMap inputMap = panel.getInputMap(JPanel.WHEN_IN_FOCUSED_WINDOW);
        inputMap.put(KeyStroke.getKeyStroke(KeyEvent.VK_ESCAPE, 0), "cancelAction");
        ActionMap actionMap = panel.getActionMap();
        actionMap.put("cancelAction", new CancelAction());
        
        JLabel label = new JLabel("ConnectN");
        label.setFont(AppFonts.getTitleFont());
        panel.add(label);
        
        return panel;
    }
    
    private JPanel createTurnCountPanel() {
        JPanel panel = new JPanel(new FlowLayout());
        panel.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));

        turnCountLabel = new JLabel("Turn: " + model.getTurnCount());
        turnCountLabel.setFont(turnCountLabel.getFont().deriveFont(Font.BOLD, 16)); // Set font size to 16
        panel.add(turnCountLabel);

        return panel;
    }
    
    public void updateTurnCountLabel() {
        turnCountLabel.setText("Turn: " + model.getTurnCount());
    }
    
    /**
     * Shuts down the game, saves stats
     */
    public void shutdown() {
        frame.dispose();
        System.exit(0);
    }
    
    /**
     * resets the default colors of column panel
     */
    
    /**
     * sets the color of a specific letter button on the column
     * @param letter The letter associated with the button
     * @param backgroundColor The background color to set for the button
     * @param foregroundColor The foreground color to set for the button
     */
    
    
    /**
     * Repaints the grid panel
     */
    public void repaintConnectNGridPanel() {
        connectNGridPanel.repaint();
        
    }
    
    /**
     * repaints the hint button
     */
    /**
     * Returns JFrame object for the main frame
     * @return The JFrame object
     */
    public JFrame getFrame() {
        return frame;
    }
    /**
     * Performed when cancel action is triggered
     */
    private class CancelAction extends AbstractAction {

        private static final long serialVersionUID = 1L;

        @Override
        public void actionPerformed(ActionEvent event) {
            shutdown();
        }
        
    }

}

package edu.wm.cs.cs301.connectn.view;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.GridLayout;
import java.awt.Rectangle;

import javax.swing.BorderFactory;
import javax.swing.JPanel;
import edu.wm.cs.cs301.connectn.model.Location;

public class ConnectNGridPanel extends JPanel {
    private static final long serialVersionUID = 1L;

    private Location[][] board; // Representation of the game board
    private int rows;
    private int columns;

    public ConnectNGridPanel(Location[][] board) {
        this.board = board;
        this.rows = board.length;
        this.columns = board[0].length;
        // Initialize the grid panel
        initializeGridPanel();
        // Set preferred size
        setPreferredSize(new Dimension(columns * 60, rows * 60)); // Adjust the multiplier based on your preference
    }

    private void initializeGridPanel() {
        setLayout(new GridLayout(rows, columns));
        for (int i = 0; i < rows; i++) {
            for (int j = 0; j < columns; j++) {
                JPanel cellPanel = new JPanel() {
                    private static final long serialVersionUID = 1L;

                    @Override
                    protected void paintComponent(Graphics g) {
                        super.paintComponent(g);
                        // No need to draw anything initially
                    }
                };
                cellPanel.setBorder(BorderFactory.createLineBorder(Color.BLACK));
                add(cellPanel);
            }
        }
    }

    @Override
    protected void paintComponent(Graphics g) {
        super.paintComponent(g);

        int cellWidth = getWidth() / columns;
        int cellHeight = getHeight() / rows;

        // Loop through each location in the board
        for (int i = 0; i < rows; i++) {
            for (int j = 0; j < columns; j++) {
                // Determine the position and size of the circle
                int x = j * cellWidth;
                int y = i * cellHeight;
                int diameter = Math.min(cellWidth, cellHeight) - 10;

                // Get the token from the Location object
                char token = board[i][j].getToken();

                // Draw blue or green circle based on the token
                if (token == 'B') {
                    g.setColor(Color.BLUE);
                } else if (token == 'G') {
                    g.setColor(Color.GREEN);
                } else {
                    // Handle other cases if necessary
                    g.setColor(Color.WHITE);
                }

                // Draw the circle
                g.fillOval(x + (cellWidth - diameter) / 2, y + (cellHeight - diameter) / 2, diameter, diameter);
            }
        }
    }

    private void drawConnectNResponse(Graphics2D g2d, Location location, Rectangle r) {
        char token = location.getToken();

        // Adjust the circle's position and size
        int diameter = Math.min(r.width, r.height) - 10;
        int x = r.x + (r.width - diameter) / 2;
        int y = r.y + (r.height - diameter) / 2;

        // Draw red or blue circle based on the token
        if (token == 'R') {
            g2d.setColor(Color.RED);
        } else if (token == 'B') {
            g2d.setColor(Color.BLUE);
        } else {
            // Handle other cases if necessary
            g2d.setColor(Color.WHITE);
        }

        // Draw the circle
        g2d.fillOval(x, y, diameter, diameter);
    }

}

New contributor

val is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật