2 시간 동안 Scrollbar를 사용하여 JEditorPane을 만들려고 시도했지만 나는 포기할 것입니다!왜 프레임이 비어 있습니까?
이 내 코드의 일부입니다
JEditorPane editorPane = new JEditorPane();
URL helpURL = GUIMain.class
.getResource("/resources/einleitungstext1.html");
this.setLayout(new GridBagLayout());
GridBagConstraints c = new GridBagConstraints();
try {
editorPane.setPage(helpURL);
} catch (IOException e) {
System.err.println("Attempted to read a bad URL: " + helpURL);
}
editorPane.setEditable(false);
JScrollPane editorScrollPane = new JScrollPane(editorPane);
editorScrollPane.setVerticalScrollBarPolicy(JScrollPane.VERTICAL_SCROLLBAR_ALWAYS);
editorScrollPane.setMinimumSize(new Dimension(100, 100));
editorScrollPane.setPreferredSize(new Dimension(main.screenWidth-200, main.screenHeight-200));
c.gridx = 0;
c.gridy = 0;
this.add(editorScrollPane, c);
this.setVisible(true);
내가 this.add 할 때 (editorScrollPane를, C) 프레임이 비어있는,하지만 난 this.add 할 때 (editorPane를, C) 패널이 표시되어 . this.add (새 JLabel ("test"), c) 프레임도 비어 있습니다.
어디에서 오류가 있습니까?
감사합니다.
P. 꽤 큰 코드이므로 전체 코드를 게시 할 수 없습니다.
어떤 수업이 있나요? 그것은 무엇으로부터 물려 받습니까? – matts