有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

java如何更改JProgressBar文本颜色

     UIManager.put("jb.selectionForeground", new ColorUIResource(Color.BLACK));
     UIManager.put("jb.selectionBackground", new ColorUIResource(Color.BLACK));

我试过这个方法,但不起作用


共 (1) 个答案

  1. # 1 楼答案

    您可以使用以下命令轻松设置JProgressBar文本颜色:-

    UIManager.put("ProgressBar.selectionBackground", Color.RED);//Red
    UIManager.put("ProgressBar.selectionForeground", Color.GREEN);//Green 
    UIManager.put("ProgressBar.background", Color.ORANGE);//Gives Orange
    UIManager.put("ProgressBar.foreground", Color.BLUE);//Gives Blue
    

    有关更多详细信息,请访问:How to change JProgressBar color?

    很乐意帮忙