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 加到这个滚动面板内。
解决方案 »
- 问个关于继承的问题,基础。。。。
- 新手~一个计算某日是星期几的函数~请大家帮忙改进改进~
- 求助,两天没有解决的问题,请大家帮忙!
- 使用java如何修改某个xml文件中的某项内容
- 怎么使用代码启动另外一个java application?
- 怎么提出自己想要的字符
- 哪位高手知道如何使用Servlet实现打印功能----高分回报
- 卖到英文版thinking in java (2),共同学习,留下qq
- 请大家介绍一下写SQL语句的经验!!!!!!!!!!(一定加分)!!!!
- 怎样用dos命令执行以下代码?这段代码放在一个java文件,编译后产生两个class文件,但执行时却报错,为什么?编译看父类,执行看子类是怎样理解的?
- 向大家请教一个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