简体   繁体   English

Java:JProgressBar

[英]Java: JProgressBar

Is it possible to make a progressbar in Java like displayed on this page? 是否可以像在此页面上显示的那样用Java创建进度条? Image . 图片
So, not the default progressbar "filling-way". 因此,不是默认的进度条“填充方式”。

If so, how? 如果是这样,怎么办?

Thanks 谢谢

I found it self. 我发现自己。 Just call setIndeterminate(true); 只需调用setIndeterminate(true); !! !!
I found it on java2s 我在java2s找到的

You'd have to do some wicked overriding of either the paint or paintComponent methods (I forget which one exactly), but yeah it's possible. 您必须对paint或paintComponent方法进行一些邪恶的覆盖(我确切地忘记了哪一个),但是是可以的。 The best way is to look at existing tutorials on custom swing components: h ttp://today.java.net/pub/a/today/2007/02/22/how-to-write-custom-swing-component.html 最好的方法是查看有关自定义挥杆组件的现有教程:h ttp://today.java.net/pub/a/today/2007/02/22/how-to-write-custom-swing-component.html

They're pretty old, but still applicable. 它们很旧,但仍然适用。

I think the easiest way would be to write your own custom component. 我认为最简单的方法是编写自己的自定义组件。 The alternative would be a custom look and feel (there's a lot of work involved in that), but it shouldn't be too difficult to write a custom component with your own indeterminate animation very similar to what you see there. 另一种选择是自定义外观(涉及很多工作),但是用自己不确定的动画编写自定义组件(与在此所看到的非常相似)并不难。

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

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