Hi everyone,

Can you give me some hints on how can I change the color of splitdivider to fit it into the background color.
The function I called refuse to work:
Java Code:
BasicSplitPaneDivider dividerContainer = (BasicSplitPaneDivider) splitPane.getComponent(0);
System.out.println(dividerContainer.getClass().toString());
dividerContainer.setForeground(Color.red);
My sample codes
Java Code:
JFrame frame=new JFrame();
    	frame.setSize(500,500);
    	JSplitPane splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT);
    	
    	JPanel p1=new JPanel();
    	p1.setBackground(Color.BLACK);
    	JPanel p2=new JPanel();
    	p2.setBackground(Color.BLACK);
    	
    	
    	splitPane.setLeftComponent(p1);
    	splitPane.setRightComponent(p2);
    	
    	BasicSplitPaneDivider dividerContainer = (BasicSplitPaneDivider) splitPane.getComponent(0);
    	System.out.println(dividerContainer.getClass().toString());
    	dividerContainer.setForeground(Color.red);
    	
    	splitPane.setDividerSize(2);
    	splitPane.setDividerLocation(0.67);
    	splitPane.setResizeWeight(0.67);
    	double a=splitPane.getDividerLocation();
    	System.out.println(a);
    	
    	
    	frame.setContentPane(splitPane);
    	frame.setVisible(true);
By the way if I try to setDividerSize=0, then the whole left component disappear. Why does that happen?

Thank you for your time :)