2013-12-09 30 views
0

我正在寫一個使用JTabbedPane(包含JScrollPane)和Windows外觀和感覺的Swing程序。當JTabbedPane使用Windows L & F進行渲染時,它會在左邊放置一條兩像素白線,並在該組件的底部放置一條像素白線(請參閱附加圖像)。JTabbedPane在Windows L&F與不可移動的邊框

有沒有辦法刪除它?添加(或刪除)邊框只能將一個邊框放在線條的外側。我已經着眼於爲這個特定的組件編寫我自己的用戶界面,但我不確定從哪裏開始(更不用說如何使用Windows L & F類)。我可以使用UIManager將偏移量設置爲0,但是會切斷默認邊界。我自己的理論圍繞着某種在Windows 7中不呈現的貶低斜面效果。任何其他想法?

回答

1

這是外觀和感覺可靠。嘗試修改UIManager的值TabbedPane.contentBorderInsets

例如:

UIManager.getDefaults().put("TabbedPane.contentBorderInsets", new Insets(1,1,1,1)); 

參見UIManager Defaults(由@camickr)爲其他屬性和默認值。

編輯:

我設法清除與TabbedPane.tabAreaInsets頂部行:

UIManager.getDefaults().put("TabbedPane.contentBorderInsets", new Insets(0,0,0,0)); 
UIManager.getDefaults().put("TabbedPane.tabAreaInsets", new Insets(0,0,0,0)); 

enter image description here

+0

我嘗試過這一點;滾動條覆蓋右邊框,底部邊框消失在Component底部,白線仍然存在。 – MobiusOne

+0

[鏈接](https://dl.dropboxusercontent.com/u/33802166/jtp-issue2.jpg) – MobiusOne

+0

@MobiusOne請參閱關於'TabbedPane.tabAreaInsets'的編輯。 – tenorsax