我试图从另一个类调用构造函数。 主要课程:
package com.southerland.Tutorial;
import com.southerland.Tutorial.display.Display;
public class Launcher {
public static void main(String[] args){
new Display("Title!", 300, 300);
}
}
第二课:
package com.southerland.Tutorial.display;
import javax.swing.JFrame;
public class Display{
private JFrame frame;
private String title;
private int width, height;
public Display(String title, int width, int height){
this.title = title;
this.width = width;
this.height = height;
createDisplay();
}
private void createDisplay(){
frame = new JFrame(title);
frame.setSize(width, height);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setResizable(false);
frame.setLocationRelativeTo(null);
frame.setVisible(true);
}
}
错误是"新显示("标题!",300,300);" part&it说"构造函数Display(String,int,int)未定义"关于如何解决的任何想法?