0
有沒有什麼方法可以設置JFrame的寬度固定,但JFrame動態的高度是多少?舉一個例子,JFrame:固定寬度但動態高度
width = 1200
Height = will be based on number of elements
換句話說
width = 1200
Height = pack()
請幫助!
有沒有什麼方法可以設置JFrame的寬度固定,但JFrame動態的高度是多少?舉一個例子,JFrame:固定寬度但動態高度
width = 1200
Height = will be based on number of elements
換句話說
width = 1200
Height = pack()
請幫助!
使用恆定的寬度和高度爲一個變量,然後用the regular setPreferredSize method
我敢肯定,不要停止框架的大小(寬度明智) - 這是我如何閱讀問題。另外,我們通常不鼓勵使用setPreferredSize – MadProgrammer 2013-03-19 09:30:33
我覺得你最好的選擇是通過覆蓋它的'getPreferredSize'方法 – MadProgrammer 2013-03-19 07:43:00
不要設置限制內容窗格的寬度固定大小。請看這[問題](http://stackoverflow.com/questions/7229226/should-i-avoid-the-use-of-setpreferredmaximumminimumsize-methods-in-java-swi) – Amarnath 2013-03-19 07:53:19
也考慮'BorderLayout.EAST'或'BorderLayout.WEST'。 – trashgod 2013-03-19 10:50:07