Nie widać komponentów w JScrollPane
Używam JScrollPane do przechowywania JTextArea dla dużego obszaru tekstu. Dodam TextArea bezpośrednio do JFrame, działa dobrze. Ale dodaję go do przewijania i dodaję przewijanie, nie widzę pola tekstowego. Oto moja SSCCE:
public class foo extends JFrame{
//gui elements
JTextArea chatMonitor = new JTextArea();
JScrollPane textPane = new JScrollPane();
ChatFrame(final String nickname, final String login, final String server, final String channel){
setSize(500,500);
chatMonitor.setEditable(false);
chatMonitor.setVisible(true);
textPane.add(chatMonitor);
textPane.setAutoscrolls(true);
textPane.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
textPane.setVisible(true);
add(textPane);
}
}