0
내가 뭘 하려는지 정말 간단하지만, 그것에 대한 해결책을 찾을 수 없습니다.리사이즈 JTextArea
JPanel에 JTextArea가 추가되어 있고 JPanel의 크기를 조정할 때 JTexArea에서 크기를 조정하려고합니다. JFrame의 크기를 조정할 때 JPanel의 크기를 조정할 수 있었지만 JTextArea와 같은 방식으로 작동하지 않는 것 같습니다. 어떤 아이디어? 여기에 제가 사용한 코드가 있습니다.
public HelpPanel(Map<ComponentType, String> compMap) {
super();
this.componentMap = compMap;
compDescription = new JTextArea();
setSize(300, 300);
JScrollPane scroll = new JScrollPane(compDescription);
add(scroll);
compDescription.setPreferredSize(new Dimension(getSize()));
compDescription.setLineWrap(true); //Wrap the text when it reaches the end of the TextArea.
compDescription.setWrapStyleWord(true); //Wrap at every word rather than every letter.
compDescription.setEditable(false); //Text cannot be edited.
displayDescription();
}
그랬습니다, 감사합니다. – Shaun