JTextArea outputArea = new JTextArea( 17, 20 );
创建一个JTextArea 的实例,大小是17行,20列
JScrollPane scroller = new JScrollPane( outputArea );
创建一个JScrollPane得实例,并把哪个JTextArea 加到这个滚动面板内。
创建一个JTextArea 的实例,大小是17行,20列
JScrollPane scroller = new JScrollPane( outputArea );
创建一个JScrollPane得实例,并把哪个JTextArea 加到这个滚动面板内。
解决方案 »
- 继承protected成员变量到底需不需要在同一个PACKAGE中啊 !!!
- 变态公司的上机测试,40分钟你行吗?
- 建立一个mypg目录 里面的方法怎么写?
- 在ms jvm下,为什么我自己写的applet刚初始化结束,IE就自动关闭????请指教
- 求 Java 2 图形设计卷Ⅱ:SWING 电子书 (中文版)
- window.open()或者是applet的问题,请高手进来指导
- JAVA开发环境的问题
- 难道是参数传递问题?
- 正则表达式问题。
- 共享软件的加密方法或是介绍此方法的地方呀!!!!100分,在线等待
- 向大家请教一个JAVA使用ORACLE的一个问题,困惑中
- 请问各位高手,getImage(URL url)中的URL url参数是怎么用的?
补充的是下一句是为一个文本域加一个滚动条!
帮你up!
JTextArea outputArea = new JTextArea( 17, 20 );
JScrollPane scroller = new JScrollPane( outputArea );应该这样来解释:(这样详细些我才明白.老外们不都是这样详细吗?)JTextArea 声明一个对象 outputArea 并用new 创建,然后初始化(在它的参数中)为17行,20列的JTextArea的一个实例. 只是第二行中的参数:outputArea 我不明白放它在这里的意义,它对于JScrollPane 实例化的 scroller 有什么影响,这样的一种初始化的格式或着说方式是不是可以分开写,分开怎么写呢? 具体每一步的步骤.还有做这步的含义是什么?详细,详细,再详细. 因为我很菜,被笑话我.谢谢各位啦 :)
Creates a JScrollPane that displays the contents of the specified component, where both horizontal and vertical scrollbars appear whenever the component's contents are larger than the view.
Constructs a new empty TextArea with the specified number of rows and columns.
Creates a JScrollPane that displays the contents of the specified component, where both horizontal and vertical scrollbars appear whenever the component's contents are larger than the view. Parameters:
view - the component to display in the scrollpane's viewport
生成一个JTextArea的实例,实例名叫outputArea,实例属性是17行高,20列宽。
JScrollPane scroller = new JScrollPane(outputArea);
生成一个JScrollPane的实例,实例名叫scroller,实例里面放的是outputArea。
这只是一种构造方法,还可以用下面代码进行编写: JTextArea outputArea = new JTextArea();
outputArea.setRows(17);
outputArea.setColumns(20);
JScrollPane scroller = new JScrollPane();
scroller.setViewportView(outputArea);可能象上边这样写更清楚一点。试着看看吧
================================================================
AllForOne.freejacky