JScrollPane scrollPane = new JScrollPane(txt,JScrollPane.VERTICAL_SCROLLBAR_AS_NEEDED,
JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
f.setContentPane(scrollPane);
我得到的错误:
Exception in thread "main" java.lang.IllegalArgumentException: adding container's parent to itself
有人可以帮助我?
也许'f.setContentPane(scrollPane);'但没有太多的代码依赖。 – laune 2014-12-27 18:19:05
我使用jtextpane和文我添加这些scrollpane它它给我错误! – dawl 2014-12-27 18:20:25
你将不得不显示更多的代码。 txt是如何创建的,f是如何创建的 - 都在良好的环境中。 – laune 2014-12-27 18:22:30