0

ファイルを入力する必要があるゲーム アプリケーションがあり、ファイルが解析された後、[開始] ボタンをクリックすると、ゲーム (中央パネルに配置) が開始されます。私はトップパネル(ファイルのファイルシステムを参照するfileBrowserPanel)を持っており、そのパネルにはBrowse、Startボタンがあります。[開始] をクリックすると、ゲームが起動するはずです。これが私のコードです:

public BallWorld() 
    {
        setLayout(new BorderLayout());

        //File browser for INI file
        JPanel fileBrowserPanel = new fileBrowserPanel();
        add(fileBrowserPanel,BorderLayout.NORTH);
        fileBrowserPanel.add(jbtStart);

        //Ball container
        if(filePathField.getText().equals(" "))
        {
            JOptionPane.showMessageDialog(null, "Please input the XML file","Information", JOptionPane.INFORMATION_MESSAGE);        
        }

        jbtStart.addActionListener(new ActionListener()
        {public void actionPerformed(ActionEvent e)
        {
            if(filePathField.getText().equals(" "))
            {
                JOptionPane.showMessageDialog(null, "Please input the XML file","Information", JOptionPane.INFORMATION_MESSAGE);        
            }

            else
            {
                JPanel ballContainer = new BallContainer(filePathField.getText());
                add(ballContainer,BorderLayout.CENTER);
            }

        }
        });


    }

問題は、中央パネルのゲームが表示されるのは、ウィンドウのサイズを変更したときだけだということです。私はそれを理解することはできません。助言がありますか?

4

1 に答える 1