我找到了三种方法来填充我的JFrame框架=新JFrame("...")createContentPanel返回一个JPanel,createToolBar返回一个ToolBar。));
frame.getContentPane().add(this.createContentPanel()); //this only puts the last one into the JFrameframe.getContentPane().add(this.createToolBar())
这可能是一个非常愚蠢的错误,但是我刚刚开始学习.awt包。我严格遵循了一个教程,在视频中他的窗口的背景是红色的,在我的代码中没有错误,但它不会改变背景颜色。谢谢你的帮助!class Test {
// TODO Auto-generated method stub
JFramef = new JFra