我使用了 .setBackground
和 .setForeground
,但它们没有起作用,颜色还是橙色,无法更改。
我使用了 .setBackground
和 .setForeground
,但它们没有起作用,颜色还是橙色,无法更改。
我认为这些数值适合您
UIManager.put("ProgressBar.background", Color.ORANGE);
UIManager.put("ProgressBar.foreground", Color.BLUE);
UIManager.put("ProgressBar.selectionBackground", Color.RED);
UIManager.put("ProgressBar.selectionForeground", Color.GREEN);
你应该将setStringPainted属性设置为true:
progressBar.setStringPainted(true);
progressBar.setForeground(Color.blue);
progressBar.setString("10%");
UIManager.put( "nimbusOrange", new Color( 38, 139, 210 ) );
对我来说它有效,只需更改颜色,您可以使用Color.RED或类似的颜色
UIManager
;另请参见此替代方案。 - trashgod