我发现了这个例子:
http://java2s.com/Open-Source/Java-Document-2/Swing/petersoft-java-style-2/com/petersoft/white/SplitPaneDivider.java.htm我想把它应用到我的JSplitPane
所以我做了:
BasicSplitPaneUI bspUI=(BasicSplitPaneUI)mainContainer.getUI();
mainContainer.setUI(new ola.elementsCustom.SplitPaneDivider(bspUI));
但是它给了我一个错误,我真的不明白:
setUI() (ola.elementsCustom.SplitPaneDivider)没有合适的方法方法javax.swing.JSplitPane.setUI(javax.swing. platform . splitpaneui)是不适用的…
ola.elementsCustom.SplitPaneDivider
需要扩展javax.swing.plaf.SplitPaneUI
-您确定是这样吗?
无论如何,你总是可以修改分隔符的外观和行为,比如:
splitPane.setUI(new BasicSplitPaneUI() {
public BasicSplitPaneDivider createDefaultDivider() {
return new BasicSplitPaneDivider(this) {
public void setBorder(Border b) {
//some code
}
};
}
});