|
JavaTM 2 Platform Standard Ed. 5.0 |
|||||||||
ÀÌÀü Ŭ·¡½º ´ÙÀ½ Ŭ·¡½º | ÇÁ·¹ÀÓÀ¸·Î ÇÁ·¹ÀÓ ¾øÀÌ | |||||||||
°³¿ä: NESTED | Çʵå | constructor | ¸Þ¼µå | »ó¼¼: Çʵå | »ý¼ºÀÚ | ¸Þ¼µå |
java.lang.Object javax.swing.tree.DefaultTreeCellEditor
public class DefaultTreeCellEditor
TreeCellEditor
ÀÔ´Ï´Ù. DefaultTreeCellRenderer
ÀνºÅϽº¸¦ ÁöÁ¤ÇØ,ÀÚ½Ä ¾ÆÀÌÄÜÀ» ÃëµæÇÒ ¼ö ÀÖµµ·Ï ÇÒ ÇÊ¿ä°¡ ÀÖ½À´Ï´Ù. DefaultTreeCellRenderer
ÀڽľÆÀÌÄÜ¿¡ µû¶ó ¹èÄ¡µÇ´Â TreeCellEditor
¸¦ ¿É¼ÇÀ¸·Î ÁöÁ¤ÇÒ ¼ö ÀÖ½À´Ï´Ù. TreeCellEditor
¸¦ ÁöÁ¤ÇÏÁö ¾ÊÀ¸¸éTextField
°¡ »ç¿ëµË´Ï´Ù. ÆíÁýÀ» °³½ÃÇÏ·Á¸é,
¸¶¿ì½º¸¦ Æ®¸®Çà Ŭ¸¯ÇÏ´ÂÁö, ¸¶¿ì½º Ŭ¸¯À» ÈÞÁö¸¦ ³¢¿ö 2ȸ ÇàÇØ 1200 ¹Ð¸® ¼¼ÄÁµå ±â´Ù¸³´Ï´Ù.
°æ°í: ÀÌ Å¬·¡½ºÀÇ Á÷·ÄÈ µÈ °´Ã¼´Â ÇâÈÄÀÇ Swing ¸±¸®Áî¿Í
ȣȯµÇÁö ¾ÊÀ» ¿¹Á¤ÀÔ´Ï´Ù. ÇöÀçÀÇ Á÷·ÄÈÀÇ Áö¿øÀº
´Ü±â°£ÀÇ ¿î¿ëÀ̳ª, °°Àº ¹öÀüÀÇ Swing¸¦ ½ÇÇàÇÏ´Â ¾îÇø®ÄÉÀ̼ǰ£ÀÇ RMI¿¡ ÀûÀýÇÏ°í ÀÖ½À´Ï´Ù. JDK ¹öÀü
1.4 ÀÌÈÄ, ¸ðµç JavaBeans™
Àå±â°£ÀÇ ¿î¿ë Áö¿øÀº
java.beans
ÆÐÅ°Áö¿¡ Ãß°¡µÇ°í ÀÖ½À´Ï´Ù. ÀÚ¼¼ÇÑ ³»¿ëÀº XMLEncoder
¸¦
ÂüÁ¶ÇϽʽÿÀ.
JTree
Áßø(Nested) Ŭ·¡½º °³¿ä | |
---|---|
class |
DefaultTreeCellEditor.DefaultTextField
¿¡µðÅÍ°¡ Á¦°øµÇÁö ¾Ê´Â °æ¿ì¿¡ »ç¿ëÇÏ´Â TextField ÀÔ´Ï´Ù. |
class |
DefaultTreeCellEditor.EditorContainer
editingComponent
¹èÄ¡¸¦ Ãë±ÞÇÏ´Â ÄÁÅ×À̳ÊÀÔ´Ï´Ù. |
ÇÊµå °³¿ä | |
---|---|
protected Color |
borderSelectionColor
º¸´õ ¼±ÅûöÀÌ ·»´õ¸µ µÇ´Â °æ¿ì¿¡ true¸¦ ¸®ÅÏÇÕ´Ï´Ù. |
protected boolean |
canEdit
Java 2 Ç÷§Æû v1. 4 ¿¡¼´Â ÀÌ Çʵå´Â »ç¿ëµÇÁö ¾Ê°Ô µÇ¾ú½À´Ï´Ù. |
protected Component |
editingComponent
ÆíÁýÀ¸·Î »ç¿ëµÇ´Â ÄÄÆÛ³ÍÆ®ÀÔ´Ï´Ù. |
protected Container |
editingContainer
ÆíÁý ÄÁÅ×À̳ʷΠeditorComponent ¸¦ Æ÷ÇÔÇÕ´Ï´Ù. |
protected Icon |
editingIcon
ÆíÁý½Ã¿¡ »ç¿ëÇÏ´ÂÀڽľÆÀÌÄÜÀÔ´Ï´Ù. |
protected Font |
font
ÆäÀÎÆ® ÇÏ´Â ÆùÆ®ÀÔ´Ï´Ù. |
protected TreePath |
lastPath
¼±ÅÃµÈ ¸¶Áö¸· ÆнºÀÔ´Ï´Ù. |
protected int |
lastRow
getTreeCellEditorComponent ¿¡ ¸¶Áö¸·¿¡ °Ç³×¹ÞÀº ÇàÀÔ´Ï´Ù. |
protected int |
offset
ÆíÁý¿¡ »ç¿ëÇÕ´Ï´Ù. |
protected TreeCellEditor |
realEditor
ÆíÁýÀ» ó¸®ÇÏ´Â ¿¡µðÅÍÀÔ´Ï´Ù. |
protected DefaultTreeCellRenderer |
renderer
º¸´õ¿Í ¿ÀÇÁ¼Â(offset)ÀÇ Ãëµæ¿¡ »ç¿ëµÇ´Â ·»´õ¸µÀÔ´Ï´Ù. |
protected Timer |
timer
ÆíÁý ¼¼¼ÇÀÇ °³½ÃÀü¿¡ »ç¿ëµË´Ï´Ù. |
protected JTree |
tree
´ë±âµµ ÇàÇÏ°í ÀÖ´Â JTree
ÀνºÅϽºÀÔ´Ï´Ù. |
»ý¼ºÀÚ °³¿ä | |
---|---|
DefaultTreeCellEditor (JTree tree,
DefaultTreeCellRenderer renderer)
ÁöÁ¤µÈ ·»´õ¸µ°ú µðÆúÆ®ÀÇ ¿¡µðÅ͸¦ »ç¿ëÇØ, JTree¿ëÀÇ DefaultTreeCellEditor °´Ã¼¸¦ ±¸ÃàÇÕ´Ï´Ù (º¸Åë
ÀÇ ÆíÁý¿¡´Â ÀÌ »ý¼ºÀÚ¸¦ »ç¿ë). |
|
DefaultTreeCellEditor (JTree tree,
DefaultTreeCellRenderer renderer,
TreeCellEditor editor)
ÁöÁ¤µÈ ·»´õ¸µ°ú ÁöÁ¤µÈ ¿¡µðÅ͸¦ »ç¿ëÇØ, JTree ¿ëÀÇ DefaultTreeCellEditor °´Ã¼¸¦ ±¸ÃàÇÕ´Ï´Ù (Ư¼öÇÑ ÆíÁý¿¡´Â ÀÌ »ý¼ºÀÚ¸¦ »ç¿ë). |
¸Þ¼µå °³¿ä | |
---|---|
void |
actionPerformed (ActionEvent e)
ŸÀ̸Ӱ¡ Æ®¸®°Å µÇ¸é, ¸Þ¼¼Áö·Î¼ º¸³»Á® ÆíÁý ¼¼¼ÇÀ» °³½ÃÇÕ´Ï´Ù. |
void |
addCellEditorListener (CellEditorListener l)
CellEditorListener ¸¦ Ãß°¡ÇÕ´Ï´Ù. |
void |
cancelCellEditing ()
¸Þ¼¼Áö·Î¼ cancelCellEditing ¸¦ realEditor ¿¡ º¸³», ÀÌ ÀνºÅϽº·ÎºÎÅÍ »èÁ¦ÇÕ´Ï´Ù. |
protected boolean |
canEditImmediately (EventObject event)
event ÀÌ null ÀÎ °æ¿ì, true¸¦ ¸®ÅÏÇÕ´Ï´Ù. |
protected Container |
createContainer ()
editingComponent
¹èÄ¡¸¦ °ü¸®ÇÏ´Â ÄÁÅ×À̳ʸ¦ ÀÛ¼ºÇÕ´Ï´Ù. |
protected TreeCellEditor |
createTreeCellEditor ()
TreeCellEditor °¡ »ý¼ºÀÚ³»·Î ÁöÁ¤µÇÁö ¾Ê´Â °æ¿ì¿¡ È£ÃâÇÕ´Ï´Ù. |
protected void |
determineOffset (JTree tree,
Object value,
boolean isSelected,
boolean expanded,
boolean leaf,
int row)
|
Color |
getBorderSelectionColor ()
º¸´õ¸¦ ·»´õ¸µ ÇÏ´Â »öÀ» ¸®ÅÏÇÕ´Ï´Ù. |
CellEditorListener [] |
getCellEditorListeners ()
addCellEditorListener()¸¦ »ç¿ëÇØ ÀÌ DefaultTreeCellEditor¿¡ Ãß°¡µÈ ¸ðµç CellEditorListener ·Î
ºÎÅÍ µÇ´Â ¹è¿À» ¸®ÅÏÇÕ´Ï´Ù. |
Object |
getCellEditorValue ()
ÇöÀç ÆíÁýÁßÀÇ °ªÀ» ¸®ÅÏÇÕ´Ï´Ù. |
Font |
getFont ()
ÆíÁý¿¡ »ç¿ëÇÏ´Â ÆùÆ®¸¦ ¸®ÅÏÇÕ´Ï´Ù. |
Component |
getTreeCellEditorComponent (JTree tree,
Object value,
boolean isSelected,
boolean expanded,
boolean leaf,
int row)
¿¡µðÅ͸¦ ¼³Á¤ÇÕ´Ï´Ù. |
protected boolean |
inHitRegion (int x,
int y)
°Ç³×¹ÞÀº À§°ªÀÌ ÆíÁýÀ» °³½ÃÇϴµ¥ À¯È¿ÇÑ ¸¶¿ì½º À§Ä¡ÀÇ °æ¿ì, true¸¦ ¸®ÅÏÇÕ´Ï´Ù. |
boolean |
isCellEditable (EventObject event)
realEditor °¡ true¸¦ ÀÌ ¸Þ¼¼Áö¿¡ µ¹·ÁÁÖ¸é, prepareForEditing °¡ ¸Þ¼¼Áö·Î¼ º¸³»Á® true°¡ ¸®Åϵ˴ϴÙ
. |
protected void |
prepareForEditing ()
ÆíÁýÀÌ °³½ÃµÇ±â Á÷Àü¿¡ È£ÃâÇÕ´Ï´Ù. |
void |
removeCellEditorListener (CellEditorListener l)
Á÷Àü¿¡ Ãß°¡ ³¡³ CellEditorListener ¸¦ »èÁ¦ÇÕ´Ï´Ù. |
void |
setBorderSelectionColor (Color newColor)
º¸´õ¿¡ »ç¿ëÇÏ´Â »öÀ» ¼³Á¤ÇÕ´Ï´Ù. |
void |
setFont (Font font)
ÆíÁý¿ëÀÇ ÆùÆ®¸¦ ¼³Á¤ÇÕ´Ï´Ù. |
protected void |
setTree (JTree newTree)
ÇöÀç ÆíÁý ´ë»óÀÇ Æ®¸®¸¦ ¼³Á¤ÇÕ´Ï´Ù. |
boolean |
shouldSelectCell (EventObject event)
¹Ýȯ°ªÀÇ realEditor ¸¦ ¸Þ¼¼Áö·Î¼ º¸³À´Ï´Ù. |
protected boolean |
shouldStartEditingTimer (EventObject event)
event ÀÌ MouseEvent ·Î
Ŭ¸¯¼ö°¡ 1ÀÎ °æ¿ì¿¡ true¸¦ ¸®ÅÏÇÕ´Ï´Ù. |
protected void |
startEditingTimer ()
ÆíÁý ŸÀ̸Ӹ¦ ½ÃÀÛÇÕ´Ï´Ù. |
boolean |
stopCellEditing ()
realEditor °¡ ÆíÁýÀÇ Á¤Áö¸¦ Çã°¡ÇÏ´Â °æ¿ì, realEditor ´Â »èÁ¦µÇ¾î true°¡ ¸®Åϵ˴ϴÙ
. |
void |
valueChanged (TreeSelectionEvent e)
lastPath ¸¦ ¸®¼Â ÇÕ´Ï´Ù. |
Ŭ·¡½º java.lang. Object ·ÎºÎÅÍ »ó¼ÓµÈ ¸Þ¼µå |
---|
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
ÇʵåÀÇ »ó¼¼ |
---|
protected TreeCellEditor realEditor
protected DefaultTreeCellRenderer renderer
protected Container editingContainer
editorComponent
¸¦ Æ÷ÇÔÇÕ´Ï´Ù.
protected transient Component editingComponent
editingContainer
·Î
ºÎÅÍ ÃëµæµË´Ï´Ù.
protected boolean canEdit
isCellEditable
À»
Á÷Á¢ ¿À¹ö¶óÀ̵å(override)ÀÇÇØ ÁÖ¼¼¿ä.
protected transient int offset
editingComponent
¸¦ ¹èÄ¡ÇÏ´Â x ÁÂÇ¥¸¦ ³ªÅ¸³À´Ï´Ù.
protected transient JTree tree
JTree
ÀνºÅϽºÀÔ´Ï´Ù.
protected transient TreePath lastPath
protected transient Timer timer
protected transient int lastRow
getTreeCellEditorComponent
¿¡ ¸¶Áö¸·¿¡ °Ç³×¹ÞÀº ÇàÀÔ´Ï´Ù.
protected Color borderSelectionColor
protected transient Icon editingIcon
protected Font font
null
˼
·»´õ¸µÀÇ ÆùÆ®¸¦ »ç¿ëÇÏ´Â °ÍÀ» ³ªÅ¸³À´Ï´Ù.
»ý¼ºÀÚ »ó¼¼ |
---|
public DefaultTreeCellEditor(JTree tree, DefaultTreeCellRenderer renderer)
DefaultTreeCellEditor
°´Ã¼¸¦ ±¸ÃàÇÕ´Ï´Ù (º¸Åë
ÀÇ ÆíÁý¿¡´Â ÀÌ »ý¼ºÀÚ¸¦ »ç¿ë).
tree
- JTree
°´Ã¼renderer
- DefaultTreeCellRenderer
°´Ã¼public DefaultTreeCellEditor(JTree tree, DefaultTreeCellRenderer renderer, TreeCellEditor editor)
JTree
¿ëÀÇ DefaultTreeCellEditor
°´Ã¼¸¦ ±¸ÃàÇÕ´Ï´Ù (Ư¼öÇÑ ÆíÁý¿¡´Â ÀÌ »ý¼ºÀÚ¸¦ »ç¿ë).
tree
- JTree
°´Ã¼renderer
- DefaultTreeCellRenderer
°´Ã¼editor
- TreeCellEditor
°´Ã¼¸Þ¼µåÀÇ »ó¼¼ |
---|
public void setBorderSelectionColor(Color newColor)
newColor
- »õ·Î¿î º¸´õ»öpublic Color getBorderSelectionColor()
public void setFont(Font font)
null
˼
·»´õ¸µÀÇ ÆùÆ®¸¦ »ç¿ëÇÏ´Â °ÍÀ» ³ªÅ¸³À´Ï´Ù. ÀÌ°ÍÀº ¸®½Ã¹öÀÇ ÀνºÅϽº¸¦ »ý¼ºÇϴµ¥ »ç¿ëÇÑ ¿¡µðÅÍ·Î ¼³Á¤ÇÑ ÆùÆ®°¡ À־, ¿À¹ö¶óÀ̵å(override) ÇÒ °ÍÀº ¾ø½À´Ï´Ù. ¿¡µðÅÍÀÇ null
ÀÌ °Ç³×¹ÞÀ¸¸é, ÀÌ ÆùÆ®¸¦ ¼±ÅÃÇÏ´Â µðÆúÆ® ¿¡µðÅÍ°¡ ÀÛ¼ºµË´Ï´Ù.
font
- ÆíÁý¿ëÀÇ Font
getFont()
public Font getFont()
Font
setFont(java.awt.Font)
public Component getTreeCellEditorComponent(JTree tree, Object value, boolean isSelected, boolean expanded, boolean leaf, int row)
realEditor
¿¡
°Ô °Ç³×Áý´Ï´Ù.
TreeCellEditor
³»ÀÇ getTreeCellEditorComponent
tree
- ¿¡µðÅÍ¿¡ ÆíÁýÀ» ¿ä±¸ÇÏ°í ÀÖ´Â JTree. ÀÌ ÆĶó¹ÌÅÍ´Â nullµµ °¡´Évalue
- ÆíÁýµÇ´Â ¼¿Ä¡isSelected
- ¼¿ÀÌ ·»´õ¸µÀÌ µÇ¾î ¼±Åúΰ¡ ÇÏÀ̶óÀÌÆ® µÇ°í ÀÖ´Â °æ¿ì´Â trueexpanded
- ³ëµå°¡ Àü°³µÇ°í ÀÖ´Â °æ¿ì´Â trueleaf
- ³ëµå°¡ ÀÙ³ëµåÀÇ °æ¿ì´Â truerow
- ÆíÁýÁßÀÇ ³ëµåÀÇ Çà À妽º
public Object getCellEditorValue()
CellEditor
³»ÀÇ getCellEditorValue
public boolean isCellEditable(EventObject event)
realEditor
°¡ true¸¦ ÀÌ ¸Þ¼¼Áö¿¡ µ¹·ÁÁÖ¸é, prepareForEditing
°¡ ¸Þ¼¼Áö·Î¼ º¸³»Á® true°¡ ¸®Åϵ˴ϴÙ
.
CellEditor
³»ÀÇ isCellEditable
event
- ¿¡µðÅÍ°¡ ÆíÁýÀ» ½ÃÀÛÇÒÁö ¾î¶³Áö¸¦ °ËÅäÇϴµ¥ »ç¿ëÇÏ´Â À̺¥Æ®
CellEditor.shouldSelectCell(java.util.EventObject)
public boolean shouldSelectCell(EventObject event)
realEditor
¸¦ ¸Þ¼¼Áö·Î¼ º¸³À´Ï´Ù.
CellEditor
³»ÀÇ shouldSelectCell
event
- ¿¡µðÅÍ°¡ ÆíÁýÀ» ½ÃÀÛÇϱâ À§Çؼ »ç¿ëÇÏ´Â À̺¥Æ®
CellEditor.isCellEditable(java.util.EventObject)
public boolean stopCellEditing()
realEditor
°¡ ÆíÁýÀÇ Á¤Áö¸¦ Çã°¡ÇÏ´Â °æ¿ì, realEditor
´Â »èÁ¦µÇ¾î true°¡ ¸®Åϵ˴ϴÙ
. ±×·¸Áö ¾ÊÀº °æ¿ì´Â false°¡ ¸®Åϵ˴ϴÙ
.
CellEditor
³»ÀÇ stopCellEditing
public void cancelCellEditing()
cancelCellEditing
¸¦ realEditor
¿¡ º¸³», ÀÌ ÀνºÅϽº·ÎºÎÅÍ »èÁ¦ÇÕ´Ï´Ù.
CellEditor
³»ÀÇ cancelCellEditing
public void addCellEditorListener(CellEditorListener l)
CellEditorListener
¸¦ Ãß°¡ÇÕ´Ï´Ù.
CellEditor
³»ÀÇ addCellEditorListener
l
- Ãß°¡µÇ´Â ¸®½º³Êpublic void removeCellEditorListener(CellEditorListener l)
CellEditorListener
¸¦ »èÁ¦ÇÕ´Ï´Ù.
CellEditor
³»ÀÇ removeCellEditorListener
l
- »èÁ¦µÇ´Â ¸®½º³Êpublic CellEditorListener [] getCellEditorListeners()
CellEditorListener
·Î
ºÎÅÍ µÇ´Â ¹è¿À» ¸®ÅÏÇÕ´Ï´Ù.
CellEditorListener
. ¸®½º³Ê°¡ Ãß°¡µÇ¾î ÀÖÁö ¾ÊÀº °æ¿ì´Â ºñ¾îÀÖ´Â ¹è¿public void valueChanged(TreeSelectionEvent e)
lastPath
¸¦ ¸®¼Â ÇÕ´Ï´Ù.
TreeSelectionListener
³»ÀÇ valueChanged
e
- º¯°æÀ» ±â¼úÇÏ´Â À̺¥Æ®public void actionPerformed(ActionEvent e)
ActionListener
³»ÀÇ actionPerformed
protected void setTree(JTree newTree)
newTree
- ÆíÁýÇÏ´Â »õ·Î¿î Æ®¸®protected boolean shouldStartEditingTimer(EventObject event)
event
ÀÌ MouseEvent
·Î
Ŭ¸¯¼ö°¡ 1ÀÎ °æ¿ì¿¡ true¸¦ ¸®ÅÏÇÕ´Ï´Ù.
event
- Á¶»çÁßÀÇ À̺¥Æ®protected void startEditingTimer()
protected boolean canEditImmediately(EventObject event)
event
ÀÌ null
ÀÎ °æ¿ì, true¸¦ ¸®ÅÏÇÕ´Ï´Ù. Ŭ¸¯¼ö°¡ 2 º¸´Ù Å« MouseEvent
·Î
inHitRegion
À»
°¡Áö´Â °æ¿ì¿¡µµ true¸¦ ¸®ÅÏÇÕ´Ï´Ù.
event
- Á¶»çÁßÀÇ À̺¥Æ®protected boolean inHitRegion(int x, int y)
x
°¡ ·»´õ¸µ¿¡ ÀÇÇØ Ç¥½ÃµÇ´ÂÀڽľÆÀÌÄÜ°úÀڽľÆÀÌÄÜ °¸ÀÇ Æø¾Æ·¡ÀÇ °æ¿ì¿¡
false¸¦ µ¹·ÁÁÙ ¼ö ÀÖµµ·Ï ÀÌ ¸Þ¼µå´Â ±¸ÇöµÇ°í ÀÖ½À´Ï´Ù. Áï, ·»´õ¸µÀ¸·Î Ç¥½ÃµÈ ÅؽºÆ® ºÎºÐ À§¿¡¼ »ç¿ëÀÚ°¡ Ŭ¸¯ÇÏ´Â °æ¿ì´Â true, ±×·¸Áö ¾ÊÀº °æ¿ì¿¡ false¸¦ ¸®ÅÏÇÕ´Ï´Ù.
x
- Á¡ÀÇ x ÁÂÇ¥y
- Á¡ÀÇ y ÁÂÇ¥
protected void determineOffset(JTree tree, Object value, boolean isSelected, boolean expanded, boolean leaf, int row)
protected void prepareForEditing()
editingComponent
ÀÌ editingContainer
¿¡ Ãß°¡µË´Ï´Ù.
protected Container createContainer()
editingComponent
¹èÄ¡¸¦ °ü¸®ÇÏ´Â ÄÁÅ×À̳ʸ¦ ÀÛ¼ºÇÕ´Ï´Ù.
protected TreeCellEditor createTreeCellEditor()
TreeCellEditor
°¡ »ý¼ºÀÚ³»·Î ÁöÁ¤µÇÁö ¾Ê´Â °æ¿ì¿¡ È£ÃâÇÕ´Ï´Ù. TextField
¿¡
µðÅ͸¦ ¸®ÅÏÇÕ´Ï´Ù.
TextField
¿¡
µðÅÍ
|
JavaTM 2 Platform Standard Ed. 5.0 |
|||||||||
ÀÌÀü Ŭ·¡½º ´ÙÀ½ Ŭ·¡½º | ÇÁ·¹ÀÓÀ¸·Î ÇÁ·¹ÀÓ ¾øÀÌ | |||||||||
°³¿ä: NESTED | Çʵå | constructor | ¸Þ¼µå | »ó¼¼: Çʵå | »ý¼ºÀÚ | ¸Þ¼µå |
Copyright 2004 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms . Documentation Redistribution Policy µµ ÂüÁ¶ÇϽʽÿÀ.