|
JavaTM 2 Platform Standard Ed. 5.0 |
|||||||||
ÀÌÀü Ŭ·¡½º ´ÙÀ½ÀÇ Å¬·¡½º | ÇÁ·¹ÀÓÀ¸·Î ÇÁ·¹ÀÓ ¾øÀÌ | |||||||||
°³¿ä: NESTED | Çʵå | »ý¼ºÀÚ | ¸Þ¼µå | »ó¼¼: Çʵå | »ý¼ºÀÚ | ¸Þ¼µå |
public interface TableModel
TableModel
ÀÎÅÍÆäÀ̽º´Â JTable
°¡ Å×ÀÌºí µ¥ÀÌÅÍ ¸ðµ¨À» Á¶»çÇϱâ À§Çؼ »ç¿ëÇÏ´Â ¸Þ¼µå¸¦ ÁöÁ¤ÇÕ´Ï´Ù.
JTable
´Â
´ÙÀ½°ú °°Àº ¸î ÁÙ±âÀÇ Äڵ带 »ç¿ëÇØ,TableModel
ÀÎÅÍÆäÀ̽º¸¦ ±¸ÇöÇÏ´Â ÀÓÀÇÀÇ µ¥ÀÌÅÍ ¸ðµ¨À» Ç¥½ÃÇϵµ·Ï ¼³Á¤ÇÒ ¼ö ÀÖ½À´Ï´Ù.
TableModel myData = new MyTableModel(); JTable table = new JTable(myData);
ÀÚ¼¼ÇÑ °ÍÀº, ¡¸The Java Tutorial¡¹ÀÇ¡¸Creating a Table Model¡¹¸¦ ÂüÁ¶ÇϽʽÿÀ.
JTable
¸Þ¼µå °³¿ä | |
---|---|
void |
addTableModelListener (TableModelListener l)
µ¥ÀÌÅÍ ¸ðµ¨ÀÌ º¯°æµÉ ¶§¸¶´Ù ÅëÁöµÇ´Â ¸®½ºÆ®¿¡ ¸®½º³Ê¸¦ Ãß°¡ÇÕ´Ï´Ù. |
Class <? > |
getColumnClass (int columnIndex)
¿ÀÇ ¼¿Ä¡ÀÇ °¡Àå ¸íÈ®ÇÑ ½´ÆÛ Ŭ·¡½º¸¦ µ¹·ÁÁÝ´Ï´Ù. |
int |
getColumnCount ()
¸ðµ¨ÀÇ ·Ä¼ö¸¦ µ¹·ÁÁÝ´Ï´Ù. |
String |
getColumnName (int columnIndex)
columnIndex ¿¡ ÀÖ´Â ¿ÀÇ À̸§À» µ¹·ÁÁÝ´Ï´Ù. |
int |
getRowCount ()
¸ðµ¨ÀÇ Çà¼ö¸¦ µ¹·ÁÁÝ´Ï´Ù. |
Object |
getValueAt (int rowIndex,
int columnIndex)
columnIndex ¿Í rowIndex ¿¡ ÀÖ´Â ¼¿ÀÇ °ªÀ» µ¹·ÁÁÝ´Ï´Ù. |
boolean |
isCellEditable (int rowIndex,
int columnIndex)
rowIndex ,columnIndex ¿¡ À§Ä¡ÇÏ´Â ¼¿ÀÌ ÆíÁý °¡´ÉÇÑ °æ¿ì¿¡ true¸¦
µ¹·ÁÁÝ´Ï´Ù. |
void |
removeTableModelListener (TableModelListener l)
µ¥ÀÌÅÍ ¸ðµ¨ÀÌ º¯°æµÉ ¶§¸¶´Ù ÅëÁöµÇ´Â ¸®½ºÆ®·ÎºÎÅÍ ¸®½º³Ê¸¦ »èÁ¦ÇÕ´Ï´Ù. |
void |
setValueAt (Object aValue,
int rowIndex,
int columnIndex)
columnIndex ¿Í rowIndex ¿¡ ÀÖ´Â ¼¿ÀÇ °ªÀ» aValue ·Î ¼³Á¤ÇÕ´Ï´Ù. |
¸Þ¼µåÀÇ »ó¼¼ |
---|
int getRowCount()
JTable
´Â
ÀÌ ¸Þ¼µå¸¦ »ç¿ëÇØ, Ç¥½ÃÇÒ Çʿ䰡 ÀÖ´Â Çà¼ö¸¦ ÆÇ´ÜÇÕ´Ï´Ù. ÀÌ ¸Þ¼µå´Â ·»´õ¸µÁß¿¡ ºó¹øÇÏ°Ô ºÒ·Á °¡¹Ç·Î ó¸®ÀÇ ¼Óµµ°¡ ÇÊ¿äÇÕ´Ï´Ù.
getColumnCount()
int getColumnCount()
JTable
´Â
ÀÌ ¸Þ¼µå¸¦ »ç¿ëÇØ, µðÆúÆ®·Î »ý¼º ¹× Ç¥½ÃÇÒ Çʿ䰡 ÀÖ´Â ·Ä¼ö¸¦ ÆÇ´ÜÇÕ´Ï´Ù.
getRowCount()
String getColumnName(int columnIndex)
columnIndex
¿¡ ÀÖ´Â ¿ÀÇ À̸§À» µ¹·ÁÁÝ´Ï´Ù. ÀÌ ¸Þ¼µå´Â
Å×À̺íÀÇ ¿Çì´õ¸íÀ» ÃʱâÈÇϱâ À§Çؼ »ç¿ëµË´Ï´Ù. ÀÌ À̸§Àº ÀÏÀÇÀÏ ÇÊ¿ä´Â ¾ø½À´Ï´Ù. Å×À̺íÀÇ 2 °³ÀÇ ¿ÀÌ °°Àº À̸§À» °¡Áö´Â °æ¿ìµµ ÀÖ½À´Ï´Ù.
columnIndex
- ¿ÀÇ À妽º
Class <? > getColumnClass(int columnIndex)
JTable
¿¡
ÇØ »ç¿ëµÇ¾î ¿ÀÇ µðÆúÆ®ÀÇ ·»´õ¸µ ¹× ¿¡µðÅ͸¦ ¼³Á¤ÇÕ´Ï´Ù.
columnIndex
- ¿ÀÇ À妽º
boolean isCellEditable(int rowIndex, int columnIndex)
rowIndex
,columnIndex
¿¡ À§Ä¡ÇÏ´Â ¼¿ÀÌ ÆíÁý °¡´ÉÇÑ °æ¿ì¿¡ true¸¦
µ¹·ÁÁÝ´Ï´Ù. ±×·¸Áö ¾ÊÀº °æ¿ì´Â
¼¿ÀÇ setValueAt
´Â
±× ¼¿ÀÇ °ªÀ» º¯°æÇÏÁö ¾Ê½À´Ï´Ù.
rowIndex
- Ä¡°¡ Á¶È¸µÇ´Â ÇàcolumnIndex
- Ä¡°¡ Á¶È¸µÇ´Â ¿
setValueAt(java.lang.Object, int, int)
Object getValueAt(int rowIndex, int columnIndex)
columnIndex
¿Í rowIndex
¿¡ ÀÖ´Â ¼¿ÀÇ °ªÀ» µ¹·ÁÁÝ´Ï´Ù.
rowIndex
- Ä¡°¡ Á¶È¸µÇ´Â ÇàcolumnIndex
- Ä¡°¡ Á¶È¸µÇ´Â ¿
void setValueAt(Object aValue, int rowIndex, int columnIndex)
columnIndex
¿Í rowIndex
¿¡ ÀÖ´Â ¼¿ÀÇ °ªÀ» aValue
·Î ¼³Á¤ÇÕ´Ï´Ù.
aValue
- »õ·Î¿î °ªrowIndex
- Ä¡°¡ º¯°æµÇ´Â ÇàcolumnIndex
- Ä¡°¡ º¯°æµÇ´Â ¿getValueAt(int, int)
,
isCellEditable(int, int)
void addTableModelListener(TableModelListener l)
l
- TableModelListenervoid removeTableModelListener(TableModelListener l)
l
- TableModelListener
|
JavaTM 2 Platform Standard Ed. 5.0 |
|||||||||
ÀÌÀü Ŭ·¡½º ´ÙÀ½ÀÇ Å¬·¡½º | ÇÁ·¹ÀÓÀ¸·Î ÇÁ·¹ÀÓ ¾øÀÌ | |||||||||
°³¿ä: NESTED | Çʵå | »ý¼ºÀÚ | ¸Þ¼µå | »ó¼¼: Çʵå | »ý¼ºÀÚ | ¸Þ¼µå |
Copyright 2004 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms . Documentation Redistribution Policy µµ ÂüÁ¶ÇϽʽÿÀ.