How to change the color of a JSeparator?
问题 The question is in the title. I'm currently doing something like: jSperator = new JSeparator(); jSeparator1.setForeground(new java.awt.Color(255, 51, 51)); But the separator keep his default color, something like 212,212,212. 回答1: have to change ’Background’ instead of ’Foreground’ logics could be different for Nimbus Look and Feel Metal L&F import javax.swing.*; import java.awt.*; public class GridBagSeparator1 { public static void main(String[] args) { JFrame frame = new JFrame("Laying Out