| new JComboBox () | ใช้สร้าง object JComboBox |
|---|---|
| new JComboBox ( object ); | ใช้สร้าง object JComboBox และมีการกำหนดค่าข้อมูลไว้แล้ว |
| new JComboBox ( object_vector ); | ใช้สร้าง object JComboBox และมีการกำหนดค่าข้อมูลไว้ในรูปแบบของ object Vector |
| setMaximumRowCount() | ใช้กำหนด จำนวนข้อมูลสูงสุด ที่จะให้แสดงเมื่อมีการกดปุ่มลูกศร ของ object JComboBox |
| setEditable() | ใช้กำหนดว่า จะสามารถให้แก้ไขข้อมูลใน object JComboBox ได้หรือไม่ |
| setSelectedIndex() | ใช้กำหนดว่า จะเลือกข้อมูลที่ตำแหน่งไหน ใน object JComboBox |
| setSelectedItem() | ใช้กำหนดว่า จะเลือกข้อมูลอะไร ใน object JComboBox |
| addItem() | ใช้เพิ่มข้อมูล เข้าไปใน object JComboBox ในตำแหน่งสุดท้าย |
| insertItemAt() | ใช้เพิ่มข้อมูล เข้าไปใน object JComboBox ในตำแหน่งที่กำหนด |
| removeItemAt() | ใช้ลบข้อมูล ออกจาก object JComboBox ในตำแหน่งที่กำหนด |
| removeItem() | ใช้ลบข้อมูลที่กำหนด ออกจาก object JComboBox |
| getItemCount() | ใช้คืนค่า จำนวนข้อมูลทั้งหมด ที่มีอยู่ใน object JComboBox |
| getSelectedIndex() | ใข้คืนค่า index ของข้อมูล ที่กำลังถูกเลือกอยู่ |
| getSelectedItem() | ใข้คืนค่า ข้อมูล ที่กำลังถูกเลือกอยู่ |
method:new JComboBox ();
return type:JComboBox
content:ใช้สร้าง object JComboBox
example:JComboBox combo_box = new JComboBox ();
method:new JComboBox ( object );
return type:JComboBox
content:ใช้สร้าง object JComboBox และมีการกำหนดค่าข้อมูลไว้แล้ว
example:String [] string_value = { "bam", "boo", "lab", "code" }; JComboBox combo_box = new JComboBox ( string_value );
method:new JComboBox ( object_vector );
return type:JComboBox
content:ใช้สร้าง object JComboBox และมีการกำหนดค่าข้อมูลไว้ในรูปแบบของ object Vector
example:Vector vector = new Vector (); vector.addElement ( "bamboo" ); vector.addElement ( "labcode" ); JComboBox combo_box = new JComboBox ( vector );
method:setMaximumRowCount ( int_max );
return type:void
content:ใช้กำหนด จำนวนข้อมูลสูงสุด ที่จะให้แสดงเมื่อมีการกดปุ่มลูกศร ของ object JComboBox
example:Vector vector = new Vector (); vector.addElement ( "bamboo" ); vector.addElement ( "labcode" ); JComboBox combo_box = new JComboBox ( vector ); combo_box.setMaximumRowCount ( 5 );
method:setEditable ( boolean );
return type:void
content:ใช้กำหนดว่า จะสามารถให้แก้ไขข้อมูลใน object JComboBox ได้หรือไม่
example:Vector vector = new Vector (); vector.addElement ( "bamboo" ); vector.addElement ( "labcode" ); JComboBox combo_box = new JComboBox ( vector ); combo_box.setEditable ( false );
method:setSelectedIndex ( int_index );
return type:void
content:ใช้กำหนดว่า จะเลือกข้อมูลที่ตำแหน่งไหน ใน object JComboBox
example:Vector vector = new Vector (); vector.addElement ( "bamboo" ); vector.addElement ( "labcode" ); JComboBox combo_box = new JComboBox ( vector ); combo_box.setSelectedIndex ( 1 );
method:setSelectedItem ( object );
return type:void
content:ใช้กำหนดว่า จะเลือกข้อมูลอะไร ใน object JComboBox
example:Vector vector = new Vector (); vector.addElement ( "bamboo" ); vector.addElement ( "labcode" ); JComboBox combo_box = new JComboBox ( vector ); combo_box.setSelectedItem ( "labcode" );
method:addItem ( object );
return type:void
content:ใช้เพิ่มข้อมูล เข้าไปใน object JComboBox ในตำแหน่งสุดท้าย
example:Vector vector = new Vector (); vector.addElement ( "bamboo" ); vector.addElement ( "lab" ); JComboBox combo_box = new JComboBox ( vector ); combo_box.addItem ( "code" );
method:insertItemAt ( object, int_index );
return type:void
content:ใช้เพิ่มข้อมูล เข้าไปใน object JComboBox ในตำแหน่งที่กำหนด
example:Vector vector = new Vector (); vector.addElement ( "bamboo" ); vector.addElement ( "code" ); JComboBox combo_box = new JComboBox ( vector ); combo_box.insertItemAt ( "lab", 1 );
method:removeItemAt ( int_index );
return type:void
content:ใช้ลบข้อมูล ออกจาก object JComboBox ในตำแหน่งที่กำหนด
example:Vector vector = new Vector (); vector.addElement ( "bamboo" ); vector.addElement ( "lab" ); vector.addElement ( "code" ); JComboBox combo_box = new JComboBox ( vector ); combo_box.removeItemAt ( 1 );
method:removeItem ( object );
return type:void
content:ใช้ลบข้อมูลที่กำหนด ออกจาก object JComboBox
example:Vector vector = new Vector (); vector.addElement ( "bamboo" ); vector.addElement ( "lab" ); vector.addElement ( "code" ); JComboBox combo_box = new JComboBox ( vector ); combo_box.removeItem ( "lab" );
method:getItemCount ();
return type:int
content:ใช้คืนค่า จำนวนข้อมูลทั้งหมด ที่มีอยู่ใน object JComboBox
example:Vector vector = new Vector (); vector.addElement ( "bamboo" ); vector.addElement ( "lab" ); vector.addElement ( "code" ); JComboBox combo_box = new JComboBox ( vector ); int num_data = combo_box.getItemCount ();
method:getSelectedIndex ();
return type:int
content:ใข้คืนค่า index ของข้อมูล ที่กำลังถูกเลือกอยู่
example:Vector vector = new Vector (); vector.addElement ( "bamboo" ); vector.addElement ( "lab" ); vector.addElement ( "code" ); JComboBox combo_box = new JComboBox ( vector ); int index_selected = combo_box.getSelectedIndex ();
method:getSelectedItem ();
return type:int
content:ใข้คืนค่า ข้อมูล ที่กำลังถูกเลือกอยู่
example:Vector vector = new Vector (); vector.addElement ( "bamboo" ); vector.addElement ( "lab" ); vector.addElement ( "code" ); JComboBox combo_box = new JComboBox ( vector ); String string_selected = ( String ) combo_box.getSelectedItem ();