내 수업은 JFrame의 setTitle 메서드를 변경하여 정수를 매개 변수로 허용합니다. 그렇게하는 방법? 그 방법 과부하가 필요해, 그렇지? setTitle 메서드에서 시도한 모든 것이 스택 오버플로에서 끝납니다.JFrame setTitle (String) to setTitle (int)
public void setTitle(String title)
Sets the title for this frame to the specified string.
import javax.swing.*;
public class MyFrame extends JFrame
{
MyFrame()
{
super();
setSize(400, 400); // Standard initial size
setVisible(true);
setDefaultCloseOperation(MyFrame.EXIT_ON_CLOSE);
}
MyFrame(int size)
{
this();
setSize(size, size);
}
public void setTitle(int title)
{
}
}
public class MainClass
{
public static void main(String[] args)
{
MyFrame frame = new MyFrame();
frame.setTitle(1000);
}
}
당신이 스택 트레이스를 게시 할 수 ... 왜 변경 일반적으로 제목 문자열이기 때문에이 ... 약간 이상하고 인위적인 예입니다 로빈과 동의, 그래서? – rainkinz