UIManager.put("Panel.opaque", false); does not work
Setting UIManager.put("Panel.opaque", false); does not work. I need to call panel.setOpaque(false); for each panel.
what can b开发者_开发问答e the problem?
You can create a custom JPanel
class and use it instead of JPanel.
class MyJPanel extends JPanel{
public MyJPanel(){
setOpaque(false);
}
}
Why not use a JComponent
instead? It is non-opaque by default.
I don't see that constant when i do
UIDefaults defaults = UIManager.getLookAndFeelDefaults();
Set<Entry<Object, Object>> entries = defaults.entrySet();
for (Entry<Object, Object> entry : entries) {
System.out.print(entry.getKey() + " = ");
System.out.print(entry.getValue() + "\n");
Since the method deals with default values, you have to put it at the very beginning of your program to make it work, or probably before calling other GUI related methods. The only thing that should come before it is locale.
精彩评论