javafx中的textarea有问题吗?
我在 javafx 2.0 中使用了 textarea,但我需要将其添加到 scrolpane。我该怎么做?
Scrolllpane s = new Scrollpane();
s.setnode(textarea);
但是当我点击滚动条时它没有移动。 有什么问题吗?
I used textarea in javafx 2.0 but i need to add it scrolpane.how can i do that?
Scrolllpane s = new Scrollpane();
s.setnode(textarea);
but when i click on scroll pnane it has doesn't move.
what is problem?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
setNode() 是调用来设置 ScrollPane 将滚动的节点的正确方法。我在 2.0 应用程序中广泛使用了 ScrollPane,但我还没有在文本区域上尝试过。根据 TextArea 的 API 文档(http://download.oracle.com/javafx/2.0/api/com/javafx/preview/control/TextArea.html),听起来它有自己的内置滚动条?我会尝试设置 TextArea 的宽度/高度,并设置最大宽度/高度,看看当文本区域中的行超出可用空间时是否可以触发滚动条自动显示。
如果您仍然想将其放在 ScrollPane 中,也许与其他一些节点一起,您应该使用容器节点(例如 VBox 或其他东西)来包装 TextArea,然后将 VBox 设置为 ScrollPane 上的滚动节点。
另外,请记住,TextArea 还不是 FX 2.0 的专用控件,因此不如其他 FX 控件那么坚固。
setNode() is the right method to call to set the node that the ScrollPane will scroll over. I've used ScrollPane extensively in my 2.0 app, but I have not tried it on Text Area. Based on the API documentation for TextArea (http://download.oracle.com/javafx/2.0/api/com/javafx/preview/control/TextArea.html) it sounds like it has its own built in scroll bars? I would try setting the width/height of the TextArea, and also set the max width/height, and see if you can trigger scrollbars to appear automatically when the lines in the text area exceed the available space.
If you still want to put it in a ScrollPane, perhaps with some other nodes, you should use a container node such as VBox or something to wrap the TextArea, then set the VBox to be your scroll node on ScrollPane.
Also, bear in mind that TextArea is not a committed control for FX 2.0 yet and is therefore less hardened than the other FX controls.
当我们创建一个文本区域时,超出t时会自动出现滚动条
When we create a text area, scroll bar automatically appears when it goes beyond t