JTextArea没有ScrollBar有什么好处?不是比TextArea烂吗?

liangkandy2002 2005-10-14 05:09:47
new 一个JTextArea,可就是没有滚动条,AWT包的TextArea就不会没有滚动条了,Swing包是怎么搞的,再用JTextArea的setAutoscrolls(true),问题仍旧,add(JScrollPane),add(JScrollBar),都不行。。。。
...全文
108 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
liangkandy2002 2005-10-17
  • 打赏
  • 举报
回复
回复人: zhouqi724(猛男)
JScrollPane scrollPane = new JScrollPane();
scrollPane .setViewPortView(textArea);
行不通,类型不同。
setViewPortView(),request"JViewport",but textArea is JTextArea.

------------------------------------------------------------------
回复人: gtlang78()
JTextArea textArea = new JTextArea();
JScrollPane scrollPane = new JScrollPane(textArea);
panel.add(scrollPane, ...

Thank you ,run!!!!!!!!!!!


liangkandy2002 2005-10-16
  • 打赏
  • 举报
回复
谢谢以上两位的意见,等测试一下再关注.
zhouqi724 2005-10-15
  • 打赏
  • 举报
回复
JScrollPane scrollPane = new JScrollPane();
scrollPane .setViewPortView(textArea);
gtlang78 2005-10-14
  • 打赏
  • 举报
回复
JTextArea textArea = new JTextArea();
JScrollPane scrollPane = new JScrollPane(textArea);
panel.add(scrollPane, ...

62,628

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧