Sai Yang

Sai Yang

  • NA
  • 136
  • 25.8k

How to set odd color in jtable?

May 10 2020 5:33 AM
I am using java 8.2. Upon this code, how can I set background color for the opposite row?
  1. UIDefaults defaults = UIManager.getLookAndFeelDefaults();  
  2. if (defaults.get("Table.alternateRowColor") == null) {  
  3. defaults.put("Table.alternateRowColor"new Color(252, 242, 206));  
  4. }  
I want the opposite row different from default color. Now it's white.

Answers (1)