所以我有另外一個問題.....重疊JSplitPane的在Jbutton將BorderLayout的,但不會在佈局空
我目前使用的BorderLayout在我的GUI,這樣,當我調整我的JFrame,所有內部組件都會隨之調整大小。我無法獲得任何其他佈局,以便在提供此調整大小功能的同時處理GUI的外觀。在頂部,我有一個JMenuBar,在它的下面有一堆按鈕。在下面我應該有一個JSplitPane,它在那裏。但是,按鈕似乎被包含在JSplitPane中,這不是我的意圖。所以當分割面板發生任何事情時,按鈕會消失,直到我再次將鼠標移到它們上面爲止。
當我將佈局設置爲null時,除非丟失了調整大小的功能,否則一切都很好。
嘗試發佈的圖像,但它不會讓我,因爲我的心不是代表在10尚未:(
有什麼建議? 我試圖把按鈕進入一個JPanel然後添加的JPanel,但在將splitPane與重疊。 。同樣的,一個JToolBar中
中添加我的項目的順序是:
1)菜單欄
setJMenuBar(menuBar)
2)按鈕
getContentPane().add(btnZoomIn)
等
3)拆分窗格
getContentPane().add(splitPane)
那麼之後你
得到了一些代碼,證明這個問題?或屏幕截圖?從它的外觀來看,你應該添加按鈕到'getContentPane().add(btnZoomIn,BorderLayout.NORTH)'作爲邊框佈局只允許一個組件位於UI的中心位置 – MadProgrammer
這裏是空佈局 http ://imgur.com/1X1h7 這裏的邊界佈局 http://imgur.com/xMQUm 也響應borderlayout.north:我已經關掉它,這樣我加入我的每一個6個按鈕到一個jtoolbar,然後在北部地區添加,那就做了訣竅。我的按鈕現在看起來很奇怪,因爲它們在工具欄中,但是很好。感謝您的建議!它幫助了很多 – thaweatherman