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 could be the problem?

+4
source share
4 answers

You can create your own JPanel class and use it instead of JPanel.

 class MyJPanel extends JPanel{ public MyJPanel(){ setOpaque(false); } } 
+3
source

Why not use JComponent instead? The default is opaque .

+2
source

I do not see this 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"); 
+1
source

Since the method deals with default values, you need to put it at the very beginning of your program for it to work, or, possibly, before calling other GUI-related methods. The only thing that should have happened before was the locale.

0
source

All Articles