텍스트로 JFrame을 설정하려고했지만 문제가 있습니다. JFrame을 만들 수는 있지만 배경색이나 텍스트를 사용할 수 없습니다.JFrame을 만들고 텍스트를 추가하는 데 문제가 있습니다.
import java.awt.Color;
import javax.swing.JFrame;
import javax.swing.JLabel;
import javax.swing.JPanel;
class FundManager {
JFrame window;
JPanel panel;
JLabel text;
public void createWindow()
{
//Create the window
window = new JFrame();
window.setVisible(true);
window.setSize(960, 540);
window.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
window.setLocationRelativeTo(null);
//Create the panel
panel = new JPanel();
panel.setBackground(Color.RED);
//Create the label
text = new JLabel("test");
}
public static void main(String args[]) {
FundManager.createWindow();
}
}
내 createWindow()
방법은 실행되지 않고, 나는 오류를 얻을 :
cannot make a static reference to to the non-static method.
을하지만, 나는 그것이 전체 프로그램 나누기를 정적으로 할 때.