Get component from a JScrollPane

后端 未结 2 1130
说谎
说谎 2021-01-17 09:21

If there is a JEditorPane in a JScrollPane, how can you get the editor from the scrollpane?

I tried scrollPane.getComponents()

2条回答
  •  萌比男神i
    2021-01-17 09:45

    JViewport viewport = scrollPane.getViewport(); 
    JEditorPane editorPane = (JEditorPane)viewport.getView(); 
    

提交回复
热议问题