看板 java 關於我們 聯絡資訊
※ 引述《dharma (達)》之銘言: : 沒寫setLayout(null) : 程式碼裡面也沒寫BorderLayout、FlowLayout...那些 : 可是GUI還是可以run出來 : 這代表Java有預設什麼GUI配置嘛? : 翻了幾本書 : 都沒提到 : 謝謝 http://docs.oracle.com/javase/tutorial/uiswing/layout/using.html Setting the Layout Manager ...(略) Each JPanel object is initialized to use a FlowLayout, unless you specify differently when creating the JPanel. Content panes use BorderLayout by default ...(略) Although we strongly recommend that you use layout managers, you can perform layout without them. By setting a container's layout property to null, you make the container use no layout manager. With this strategy, called absolute positioning, you must specify the size and position of every component within that container. One drawback of absolute positioning is that it does not adjust well when the top-level container is resized. ... 依tutorial內容所示 JPanel預設為FlowLayout ContentPane預設為BorderLayout 而如果setLayout(boolean)傳入null 代表是絕對位置 容器放大、縮小就不會自動調整位置。 以上。 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 175.182.21.168 ※ 文章網址: http://www.ptt.cc/bbs/java/M.1406439153.A.283.html
dharma:要來熟悉官方英文文件 07/27 13:38