1

enter image description here

As you can see at the JProgressBar above I modified it pretty much. But you most probably notice the white and light blue line in it. So now my question is how do I recolor it?

4

2 回答 2

1

尝试删除边框

JProgressBar jProgressBar1 = new ProgressBar();
jProgressBar1.setBorderPainted(false);

假设您想要摆脱蓝/白线

于 2013-06-24T11:24:17.017 回答
1

这是一个老问题,但由于我刚才遇到了同样的问题,也许它会帮助别人。一个(不是很优雅)的解决方案是使用面板作为具有全宽进度条的容器并停用进度条边框:

JPanel panel = new JPanel();
panel.setLayout(new GridLayout(0, 1));

JProgressBar bar = new JProgressBar();
bar.setBorderPainted(false);
bar.setStringPainted(true);

panel.add(bar);

Border border = BorderFactory.createTitledBorder("Total progress...");
panel.setBorder(border);
于 2015-09-15T11:47:52.087 回答