JProgressBar 能够隐藏“bar"而不是“fluid" [英] JProgressBar Capable of hiding the 'bar' and not the 'fluid'

查看:40
本文介绍了JProgressBar 能够隐藏“bar"而不是“fluid"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道流体"不是最好的描述,但这就是我想象的进度条内的绿色.

I understand that 'fluid' isn't the best description, but that's how I imagine the green that lays inside a progress bar.

我只是想知道是否可以从进度条中看到绿色的流体",而不是装有流体"的容器.

I was just wondering if it was possible to just see the green 'fluid' from the progress bar, and not the container that hold the 'fluid'.

这样做的目的是在进度条下制作包含绿色流体"的图稿,而不是系统的默认 UI 包含此流体.

The purpose of this is to make artwork under the progress bar that would hold the green 'fluid', rather then the system's default UI holding this fluid.

这是当前进度条的照片:

This is a photo of the current progress bar in question:

JFrameINVISIBLE,所以你只能看到这个栏.我想知道是否可以从 JProgressBar 周围删除 GREY 并只显示绿色.

The JFrame this is on is INVISIBLE, so all you can see is this bar. I would like to know if it is possible to remove the GREY from around the JProgressBar and just display the green.

推荐答案

fluid,您可能指的是 BasicProgressBarUI 在其 的实现中使用的绘制PaintDeterminate().UI 委托用 ProgressBar.background 填充所有 boxRect,用 ProgressBar.foreground 填充 boxRect 的一部分.你可以

By fluid, you may mean the paint used by a BasicProgressBarUI in its implementation of paintDeterminate(). The UI delegate fills all of boxRect with ProgressBar.background and some fraction of boxRect with ProgressBar.foreground. You can

  • 通过 UIManager 更改颜色,如此处所述,但是委托人没有义务使用您的设置.

  • Change the color via the UIManager, as discussed here, but the delegate is not obligated to use your setting.

按照此处的建议实施您自己的ProgressBarUI.

Implementnt your own ProgressBarUI, as suggested here.

这篇关于JProgressBar 能够隐藏“bar"而不是“fluid"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆