| setLayout() | ใช้ในการกำหนดรูปแบบการจัดวาง component ของ container |
|---|---|
| getLayout() | ใช้คืนค่า รูปแบบการจัดวาง component |
| add() | ใช้ในการเพิ่ม component เข้าไปใน container |
| add( object_component, borderlayout_constant ) | ใช้ในการเพิ่ม component เข้าไปใน container และมีการกำหนดตำแหน่งพื้นที่ด้วย แต่ต้องใช้กับ BorderLayout เท่านั้น |
| setFont() | ใช้กำหนด font |
| getMaximumSize() | ใช้คืนค่า Maximum Size ของ Container |
| getMinimumSize() | ใช้คืนค่า Minimum Size ของ Container |
| getPreferredSize() | ใช้คืนค่า Preferred Size ของ Container |
method:setLayout ( object_layout_manager );
return type:void
content:ใช้ในการกำหนดรูปแบบการจัดวาง component ของ container ถ้ากำหนดเป็นค่า null จะใช้รูปแบบการจัดวาง layout โดยเทียบจากค่า x, y
example:Container container = getContentPane (); container.setLayout ( null ); JButton button = new JButton ( "cancel" ); button.setBounds ( 50, 50, 100, 50 ); container.add ( button );
method:getLayout ();
return type:LayoutManager
content:ใช้คืนค่า รูปแบบการจัดวาง component
example:Container container = getContentPane (); container.setLayout ( null ); LayoutManager layout = container.getLayout ();
method:add ( object_component );
return type:void
content:ใช้ในการเพิ่ม component เข้าไปใน container
example:Container container = getContentPane (); JButton button = new JButton ( "cancel" ); container.add ( button ); container.add ( new JLabel ( "Name :" ) );
method:add ( object_component, borderlayout_constant );
return type:void
content:ใช้ในการเพิ่ม component เข้าไปใน container และมีการกำหนดตำแหน่งพื้นที่ด้วย แต่ต้องใช้กับ BorderLayout เท่านั้น
example:Container container = getContentPane (); BorderLayout borderlayout = new BorderLayout ( 10, 10 ); container.setLayout ( borderlayout ); container.add ( new JLabel ( "Name :" ), BorderLayout.CENTER ); JButton button = new JButton ( "cancel" ); container.add ( button, BorderLayout.NORTH );
method:setFont ( object_font );
return type:void
content:ใช้กำหนด font
example:Container container = getContentPane (); Font font = new Font ( "TimesRoman", Font.BOLD, 12 ); container.setFont ( font );
method:getMaximumSize ();
return type:Dimension
content:ใช้คืนค่า Maximum Size ของ Container
example:Container container = getContentPane (); Dimension dimension = container.getMaximumSize ();
method:getMinimumSize ();
return type:Dimension
content:ใช้คืนค่า Minimum Size ของ Container
example:Container container = getContentPane (); Dimension dimension = container.getMinimumSize ();
method:getPreferredSize ();
return type:Dimension
content:ใช้คืนค่า Preferred Size ของ Container
example:Container container = getContentPane (); Dimension dimension = container.getPreferredSize ();