我自己的项目没什么问题。我有两节课。其中一个是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类时,我遇到了这个问题。我该如何解决这个问题?
发布于 2018-04-23 04:41:43
建议
中
https://stackoverflow.com/questions/49970508
复制相似问题