Java:按钮不是';他没有出现

Java:按钮不是';他没有出现,java,swing,Java,Swing,因此,我正在使用Java和JFrame,我希望最终用户能够单击“登录”按钮,它应该显示另一个“编辑”字样。出于某种奇怪的原因,当最终用户单击“登录”时,它不会显示“编辑”框,而是显示“System.out.println” 在ActionListener public void actionPerformed(ActionEvent e) { //Execute when button is pressed fixtureList();

因此,我正在使用Java和JFrame,我希望最终用户能够单击“登录”按钮,它应该显示另一个“编辑”字样。出于某种奇怪的原因,当最终用户单击“登录”时,它不会显示“编辑”框,而是显示“System.out.println”


ActionListener

    public void actionPerformed(ActionEvent e)
    {
        //Execute when button is pressed
        fixtureList();
        System.out.println("Loading the fixtures screen");
        repaint();
    }

在添加按钮后是否尝试添加
revalidate()
?我在public void fixtureList()下面添加了它{JButton editButton;editButton=new JButton(“Edit”);editButton.setBounds(100200100100);add(editButton);记住使用
SwingUtilities.invokeLater()
总而言之。非常感谢,伙计。@user3255328很高兴我能帮上忙!
    public void actionPerformed(ActionEvent e)
    {
        //Execute when button is pressed
        fixtureList();
        System.out.println("Loading the fixtures screen");
        repaint();
    }