Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Changing color of JSplitPane divider

843804Apr 14 2005
I have seen many posts on this topic but so far no resolution. What I want is for the two buttons on the divider to be visible but the rest of the divider be invisible. Since my page is white I thought I could set the divider background to white and the problem would be solved. However, no matter which way I use to set the divider background, the buttons disappear as well!

I have tried
UIManager.put("SplitPaneDivider.border", BorderFactory.createMatteBorder(5, 5, 5, 5, Color.red));
and I have tried extending the BasicSplitPaneUI class :
public class InvisibleDividerSplitPaneUI extends BasicSplitPaneUI {
	

	public InvisibleDividerSplitPaneUI() {
	   super();
	}

	public BasicSplitPaneDivider createDefaultDivider() {
	   return new InvisibleDivider(this);
	}
	
	


	class InvisibleDivider extends BasicSplitPaneDivider {
		
	public InvisibleDivider(BasicSplitPaneUI basicSplitPaneUI) {
	   	super(basicSplitPaneUI);
		setLayout(new BorderLayout());
		JPanel jPanel = new JPanel();
		//JButton leftButton = createLeftOneTouchButton();
		//JButton rightButton = createRightOneTouchButton();
		//jPanel.add(leftButton);
		//jPanel.add(rightButton);
		jPanel.setBackground(PILFColorThemes.formFieldBackgroundColor);
		jPanel.setBorder(new LineBorder(PILFColorThemes.formFieldBackgroundColor));
		add(jPanel);
		setBorder(new LineBorder(PILFColorThemes.formFieldBackgroundColor));
	}

	public int getDividerSize() {
		return 8;
	}

	}


}

In both cases the divider color is changed but the buttons are gone!  Any one have an idea?!

Thanks so much!
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 12 2005
Added on Apr 14 2005
0 comments
135 views