我对自己的项目没什么问题。我有两节课。其中一个是The Toolbar.java类的另一个类是NewDesktopVersion.java
NewDesktopVersion.java代码是:
public static void main(String[] args){
//Main frame initializing
final JFrame frame = new JFrame("Simple Frame");
frame.setSize(width, height);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
//Internal frame initializing
final JDesktopPane desktop = new JDesktopPane();
final JInternalFrame internalFrame = new JInternalFrame("Scene", true, true, false);
desktop.setLayout(new BorderLayout());
desktop.add(internalFrame);
internalFrame.setBounds(665, 15, internalWidth, internalHeight);
internalFrame.setVisible(true);
frame.add(desktop, BorderLayout.CENTER);
Toolbar.java代码是:
public class ToolBar {
//Toolbar initializing
final JToolBar toolBar = new JToolBar("Toolbar");
//Buttons for toolbar
JButton cube;
JButton cone;
JButton cylinder;
JButton sphere;
public ToolBar(){
super();
toolBar.setFloatable(false);
toolBar.setOrientation(1);
}
JToolBar getToolBar(){
return toolBar;
}
当我添加desktop.add(new ToolBar())
NewDesktopVersion.java类时遇到问题。我如何解决这个问题?
答案 0 :(得分:1)
建议