从JScrollPane获取组件 [英] Get component from a JScrollPane
本文介绍了从JScrollPane获取组件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果 JScrollPane
中有 JEditorPane
,如何从滚动窗格中获取编辑器?
If there is a JEditorPane
in a JScrollPane
, how can you get the editor from the scrollpane?
我试过 scrollPane.getComponents()
但编辑器不在列表中。
I tried scrollPane.getComponents()
but the editor wasn't in the list.
推荐答案
JViewport viewport = scrollPane.getViewport();
JEditorPane editorPane = (JEditorPane)viewport.getView();
这篇关于从JScrollPane获取组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文