简体   繁体   English

如何在JLabel上从左到右滚动

[英]How to scroll from left right to left on a JLabel

I have a JLabel on which I added an RSS Feed. 我有一个JLabel,上面添加了RSS Feed。 But how can I slide the text from right to left, because the feed is too long and I want to read the whole feed. 但是,由于提要太长并且我想阅读整个提要,所以如何从右向左滑动文本。

final JLabel news = new JLabel("Loading";
news.setText(readRSSFeed("http://yourfeed.com");

Thank you in advance! 先感谢您!

Somewhere you should be adding your label to a container like this add(news) . 您应该在某个地方将标签添加到类似add(news)这样的容器中。 So if you replace it with add(new JScrollPane(news)) it will show scrolls if text overflow to visible area. 因此,如果将其替换为add(new JScrollPane(news)) ,则当文本溢出到可见区域时,它将显示滚动。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM