i\'m developing a little GUI application with Java using Netbeans Editor. I\'ve put in a JFrame a simple Progress Bar. I\'m developing the project with JDK7
I want t
This is what I have done in the application I currently develop
ColorUIResource colorResource = new ColorUIResource(Color.red.darker().darker());
UIManager.put("nimbusOrange",colorResource);
This simply changes the default orange color with something more appealing to the eyes and it changes it everywhere.
maybe (Color
and Font
) issue talking about Nimbus Look and Feel
have to check this thread
value for
ProgressBar[Disabled+Finished].foregroundPainter ProgressBar[Disabled+Indeterminate].foregroundPainter
ProgressBar[Disabled].backgroundPainter ProgressBar[Disabled].foregroundPainter ProgressBar[Enabled+Finished].foregroundPainter ProgressBar[Enabled+Indeterminate].foregroundPainter ProgressBar[Enabled+Indeterminate].progressPadding ProgressBar[Enabled].backgroundPainter ProgressBar[Enabled].foregroundPainter
.
4. maybe easiest for you will be to change nimbusOrange
from the top of Nimbus default
s, but this change is everywhere,
funny output to the GUI with changed Control Color
, for example
UIManager.getLookAndFeelDefaults().put("nimbusOrange", (new Color(127, 255, 191)));
. 5. for example
import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.EventQueue;
import java.awt.Graphics2D;
import javax.swing.*;
public class MyPopupWithNimbus {
public MyPopupWithNimbus() {
JFrame frame = new JFrame();
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setSize(200, 200);
JPanel panel = new JPanel(new BorderLayout());
panel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
JList list = new JList();
panel.add(list);
JProgressBar progress = new JProgressBar();
progress.setStringPainted(true);
progress.setString("60 pct");
progress.setValue(60);
frame.add(panel);
frame.add(progress, BorderLayout.SOUTH);
JPopupMenu menu = new JPopupMenu();
menu.add(new JMenuItem("A"));
menu.add(new JMenuItem("B"));
menu.add(new JMenuItem("C"));
JMenu jmenu = new JMenu("D");
jmenu.add(new JMenuItem("E"));
menu.add(jmenu);
frame.setVisible(true);
menu.show(frame, 50, 50);
}
public static void main(String[] args) {
try {
for (UIManager.LookAndFeelInfo laf : UIManager.getInstalledLookAndFeels()) {
if ("Nimbus".equals(laf.getName())) {
UIManager.setLookAndFeel(laf.getClassName());
UIManager.getLookAndFeelDefaults().put("nimbusOrange", (new Color(127, 255, 191)));
UIManager.getLookAndFeelDefaults().put("PopupMenu[Enabled].backgroundPainter",
new FillPainter(Color.ORANGE));
}
}
} catch (Exception e) {
e.printStackTrace();
}
EventQueue.invokeLater(new Runnable() {
@Override
public void run() {
MyPopupWithNimbus aa = new MyPopupWithNimbus();
}
});
}
}
class FillPainter implements Painter<JComponent> {
private final Color color;
FillPainter(Color c) {
color = c;
}
@Override
public void paint(Graphics2D g, JComponent object, int width, int height) {
g.setColor(color);
g.fillRect(0, 0, width - 1, height - 1);
}
}