JScrollPane的视图
//Create a JEditorPane to view HTML fileprivate JEditorPane jep=new JEditorPane();
//Create a JScrollPane to hold JEditorPane
JScrollPane jScrollPane=new JScrollPane();
jScrollPane.getViewPort().add(jep,null);
===============1==========================
//Create a JTextArea ;
private JTextArea jTextArea=new JTextArea();
//Create a JScrollPane to hold JTextArea
JScrollPane jScrollPane=new JScrollPane(jTextArea);
================2==========================
请教一下问题:
1 ,最上面一段代码中的jScrollPane.getViewPort()是返回ScrollPane的视图
,请问视图是什么意思?
2,下面的那段代码可以用jScrollPane.getViewPort().add(jTextArea,null)这种方法吗?
3,两段代码间有什么区别?
搜索更多相关的解决方案:
视图 JScrollPane
----------------解决方案--------------------------------------------------------
视图可能就是垂直和水平方向的滚动条设置 自己返回下不就知道了
两个方法就是add的东西不一样 肯定是通用的
----------------解决方案--------------------------------------------------------
一般用构造函数的那个,就是JScrollPane jScrollPane=new JScrollPane(jTextArea);
----------------解决方案--------------------------------------------------------