JavaTM 2 Platform
Standard Ed. 5.0

javax.swing.plaf.basic
Ŭ·¡½º BasicListUI

java.lang.Object 
  »óÀ§¸¦ È®Àå javax.swing.plaf.ComponentUI 
      »óÀ§¸¦ È®Àå javax.swing.plaf.ListUI 
          »óÀ§¸¦ È®Àå javax.swing.plaf.basic.BasicListUI

public class BasicListUI
extends ListUI

ListUI Windows Look & Feel ¿¡ ÇÑ ±¸ÇöÀÔ´Ï´Ù.


Áßø(Nested) Ŭ·¡½º °³¿ä
 class BasicListUI.FocusHandler
          ÀÌ ³»ºÎ Ŭ·¡½º´Â "public"¿Í ¸¶Å© µË´Ï´Ù¸¸, ÀÌ°ÍÀº ÄÄÆÄÀÏ·¯ÀÇ ¹ö±×°¡ ¿øÀÎÀÔ´Ï´Ù.
 class BasicListUI.ListDataHandler
          installUI ½ÇÇà½Ã ¹× JList.model ÇÁ·ÎÆÛƼ°¡ º¯°æµÇ¾úÀ» ¶§¿¡ JList ¸ðµ¨¿¡ Ãß°¡µÇ´Â ListDataListener ÀÔ´Ï´Ù.
 class BasicListUI.ListSelectionHandler
          installUI ½ÇÇà½Ã ¹× JList.selectionModel ÇÁ·ÎÆÛƼ°¡ º¯°æµÇ¾úÀ» ¶§¿¡ JLists ¼±Åà ¸ðµ¨¿¡ Ãß°¡µÇ´Â ListSelectionListener ÀÔ´Ï´Ù.
 class BasicListUI.MouseInputHandler
          JList¸¦ À§ÇÑ Æ÷Ä¿½º ó¸®¿Í ¸¶¿ì½º ÀÔ·ÂÀÔ´Ï´Ù.
 class BasicListUI.PropertyChangeHandler
          PropertyChangeListener´Â installUI ½ÇÇà½Ã¿¡ JList¿¡ Ãß°¡µË´Ï´Ù.
 
ÇÊµå °³¿ä
protected  int cellHeight
           
protected  int[] cellHeights
           
protected static int cellRendererChanged
           
protected  int cellWidth
           
protected static int fixedCellHeightChanged
           
protected static int fixedCellWidthChanged
           
protected  FocusListener focusListener
           
protected static int fontChanged
           
protected  JList list
           
protected  ListDataListener listDataListener
           
protected  ListSelectionListener listSelectionListener
           
protected static int modelChanged
           
protected  MouseInputListener mouseInputListener
           
protected  PropertyChangeListener propertyChangeListener
           
protected static int prototypeCellValueChanged
           
protected  CellRendererPane rendererPane
           
protected static int selectionModelChanged
           
protected  int updateLayoutStateNeeded
           
 
»ý¼ºÀÚ °³¿ä
BasicListUI ()
           
 
¸Þ¼­µå °³¿ä
protected  int convertRowToY (int row)
          ÁöÁ¤µÈ ÇàÀÇ ¿øÁ¡ÀÇ JList »ó´ë Y ÁÂÇ¥¸¦ ¸®ÅÏÇÕ´Ï´Ù.
protected  int convertYToRow (int y0)
          JList »ó´ë ÁÂÇ¥¸¦, ÇöÀçÀÇ ·¹À̾ƿôÀ» ±âº»À¸·Î ÇØ, ÁÂÇ¥¸¦ Æ÷ÇÔÇÑ ÇàÀ¸·Î º¯È¯ÇÕ´Ï´Ù.
protected  FocusListener createFocusListener ()
           
protected  ListDataListener createListDataListener ()
          ¸ðµ¨¿¡ ÀÇÇØ ÇÊ¿ä¿¡ µû¶ó¼­ JList¿¡ Ãß°¡µÇ´Â ListDataListener ÀνºÅϽº¸¦ »ý¼ºÇÕ´Ï´Ù.
protected  ListSelectionListener createListSelectionListener ()
          selectionModel¿¡ ÀÇÇØ ÇÊ¿ä¿¡ µû¶ó¼­ JList¿¡ Ãß°¡µÇ´Â ListSelectionHandler ÀνºÅϽº¸¦ »ý¼ºÇÕ´Ï´Ù.
protected  MouseInputListener createMouseInputListener ()
          MouseInputListener¸¦ ±¸ÇöÇÏ´Â À§¾çÀ» ÀÛ¼ºÇÕ´Ï´Ù.
protected  PropertyChangeListener createPropertyChangeListener ()
          installUI()¿¡ ÀÇÇØ JList¿¡ Ãß°¡µÇ´Â PropertyChangeHandler ÀνºÅϽº¸¦ »ý¼ºÇÕ´Ï´Ù.
static ComponentUI createUI (JComponent  list)
          BasicListUI »õ·Î¿î ÀνºÅϽº¸¦ ¸®ÅÏÇÕ´Ï´Ù.
 Rectangle getCellBounds (JList  list, int index1, int index2)
          ÁöÁ¤µÈ Ç׸ñÀÇ JList ÁÂÇ¥¿¡ À־ÀÇ °æ°è¸¦ ¸®ÅÏÇÕ´Ï´Ù.
 Dimension getPreferredSize (JComponent  c)
          ¸®½ºÆ®ÀÇ preferredSize´Â ¹èÄ¡ ¹æÇâ¿¡ ÀÇÇØ Á¤ÇØÁý´Ï´Ù.
protected  int getRowHeight (int row)
          ÇöÀçÀÇ ·¹À̾ƿôÀ¸·Î ÁöÁ¤µÈ ÇàÀÇ ³ôÀ̸¦ ¸®ÅÏÇÕ´Ï´Ù.
 Point indexToLocation (JList  list, int index)
          ÁöÁ¤µÈ Ç׸ñÀÇ JList ÁÂÇ¥¿¡ À־ÀÇ ¿øÁ¡À» ¸®ÅÏÇÕ´Ï´Ù.
protected  void installDefaults ()
          JList ÇÁ·ÎÆÛƼ (ÆùÆ®, foreground ¹× ¹é±×¶ó¿îµåµî)¸¦ ÃʱâÈ­ÇØ, CellRendererPane¸¦ Ãß°¡ÇÕ´Ï´Ù.
protected  void installKeyboardActions ()
          BasicListUI¸¦ °ü·ÃµÈ JList »óÀÇ Å°º¸µå ¹ÙÀεùÀ» ¸®ÅÏÇÕ´Ï´Ù.
protected  void installListeners ()
          JList, ±× ¸ðµ¨ ¹× selectionModel ¸®½º³Ê¸¦ ÀÛ¼º ¹× ÀνºÅç ÇÕ´Ï´Ù.
 void installUI (JComponent  c)
          installDefaults(), installListeners() ¹× installKeyboardActions()¸¦ ¼ø¼­¿¡ È£ÃâÇØ, this.list¸¦ ÃʱâÈ­ÇÕ´Ï´Ù.
 int locationToIndex (JList  list, Point  location)
          JList ÁÂÇ¥»óÀÇ Á¡À» ±× À§Ä¡¿¡ ÀÖ´Â ¼¿ÀÇ À妽º·Î º¯È¯ÇÕ´Ï´Ù.
protected  void maybeUpdateLayoutState ()
          updateLayoutStateNeeded°¡ Á¦·Î°¡ ¾Æ´Ï¸é, updateLayoutState()À» È£ÃâÇØ updateLayoutStateNeeded¸¦ ¸®¼Â ÇÕ´Ï´Ù.
 void paint (Graphics  g, JComponent  c)
          Graphics °´Ã¼ÀÇ clipRect¿Í ±³Â÷ÇÏ´Â ÇàÀ» ÆäÀÎÆ® ÇÕ´Ï´Ù.
protected  void paintCell (Graphics  g, int row, Rectangle  rowBounds, ListCellRenderer  cellRenderer, ListModel  dataModel, ListSelectionModel  selModel, int leadIndex)
          List ¼¿À» 1°³ ÆäÀÎÆ® ÇÕ´Ï´Ù.
protected  void selectNextIndex ()
          1°³ ÀüÀÇ ÇàÀ» ¼±ÅÃÇØ, ±×°ÍÀ» °­Á¦ÀûÀ¸·Î °¡½Ã·Î ÇÕ´Ï´Ù.
protected  void selectPreviousIndex ()
          1°³ ÀüÀÇ ÇàÀ» ¼±ÅÃÇØ, ±×°ÍÀ» °­Á¦ÀûÀ¸·Î °¡½Ã·Î ÇÕ´Ï´Ù.
protected  void uninstallDefaults ()
          null¿¡ ¸í½ÃÀûÀ¸·Î ¿À¹ö¶óÀ̵å(override)µÇ¾î ÀÖÁö ¾ÊÀº JList ÇÁ·ÎÆÛƼ¸¦ ¼³Á¤ÇÕ´Ï´Ù.
protected  void uninstallKeyboardActions ()
          installKeyboardActions·Î ºÎÅÍ ÀνºÅç µÈ Å°º¸µå ¾×¼ÇÀÇ µî·ÏÀ» ÇØÁ¦ÇÕ´Ï´Ù.
protected  void uninstallListeners ()
          JList, ±× ¸ðµ¨ ¹× selectionModel ¸®½º³Ê¸¦ »èÁ¦ÇÕ´Ï´Ù.
 void uninstallUI (JComponent  c)
          uninstallListeners(), uninstallKeyboardActions() ¹× uninstallDefaults()¸¦ ¼ø¼­¿¡ È£ÃâÇØ, this.list ÃʱâÈ­¸¦ ÇØÁ¦ÇÕ´Ï´Ù.
protected  void updateLayoutState ()
          cellHeight (¶Ç´Â cellHeights) ¹× cellWidth °ªÀ» ÇöÀçÀÇ ÆùÆ®¿Í fixedCellWidth, fixedCellHeight ¹× prototypeCellValue ÇöÀçÀÇ °ªÀ» ±âº»À¸·ÎÀÇÇØ ´Ù½Ã °è»êÇÕ´Ï´Ù.
 
Ŭ·¡½º javax.swing.plaf. ComponentUI ·ÎºÎÅÍ »ó¼ÓµÈ ¸Þ¼­µå
contains, getAccessibleChild, getAccessibleChildrenCount, getMaximumSize, getMinimumSize, update
 
Ŭ·¡½º java.lang. Object ·ÎºÎÅÍ »ó¼ÓµÈ ¸Þ¼­µå
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

ÇʵåÀÇ »ó¼¼

list

protected JList  list

rendererPane

protected CellRendererPane  rendererPane

focusListener

protected FocusListener  focusListener

mouseInputListener

protected MouseInputListener  mouseInputListener

listSelectionListener

protected ListSelectionListener  listSelectionListener

listDataListener

protected ListDataListener  listDataListener

propertyChangeListener

protected PropertyChangeListener  propertyChangeListener

cellHeights

protected int[] cellHeights

cellHeight

protected int cellHeight

cellWidth

protected int cellWidth

updateLayoutStateNeeded

protected int updateLayoutStateNeeded

modelChanged

protected static final int modelChanged
°ü·Ã Ç׸ñ:
Á¤¼ö Çʵ尪

selectionModelChanged

protected static final int selectionModelChanged
°ü·Ã Ç׸ñ:
Á¤¼ö Çʵ尪

fontChanged

protected static final int fontChanged
°ü·Ã Ç׸ñ:
Á¤¼ö Çʵ尪

fixedCellWidthChanged

protected static final int fixedCellWidthChanged
°ü·Ã Ç׸ñ:
Á¤¼ö Çʵ尪

fixedCellHeightChanged

protected static final int fixedCellHeightChanged
°ü·Ã Ç׸ñ:
Á¤¼ö Çʵ尪

prototypeCellValueChanged

protected static final int prototypeCellValueChanged
°ü·Ã Ç׸ñ:
Á¤¼ö Çʵ尪

cellRendererChanged

protected static final int cellRendererChanged
°ü·Ã Ç׸ñ:
Á¤¼ö Çʵ尪
»ý¼ºÀÚ »ó¼¼

BasicListUI

public BasicListUI()
¸Þ¼­µåÀÇ »ó¼¼

paintCell

protected void paintCell(Graphics  g,
                         int row,
                         Rectangle  rowBounds,
                         ListCellRenderer  cellRenderer,
                         ListModel  dataModel,
                         ListSelectionModel  selModel,
                         int leadIndex)
List ¼¿À» 1°³ ÆäÀÎÆ® ÇÕ´Ï´Ù. ÀûÀýÇÑ »óŸ¦ °è»êÇØ, ¼¿ ·»´õ¸µ ÄÄÆÛ³ÍÆ®ÀÇ ¡¸·¯¹ö ½ºÅÆÇÁ¡¹¸¦ ÃëµæÇÏ°í ³ª¼­, CellRendererPane¸¦ »ç¿ëÇØ ¼¿À» ÆäÀÎÆ® ÇÕ´Ï´Ù. ¼­ºê Ŭ·¡½º¿¡¼­´Â paint()°¡ ¾Æ´Ï°í ÀÌ ¸Þ¼­µå¸¦ ¿À¹ö¶óÀ̵å(override) ÇÒ ¼ö ÀÖ½À´Ï´Ù.

°ü·Ã Ç׸ñ:
paint(java.awt.Graphics, javax.swing.JComponent)

paint

public void paint(Graphics  g,
                  JComponent  c)
Graphics °´Ã¼ÀÇ clipRect¿Í ±³Â÷ÇÏ´Â ÇàÀ» ÆäÀÎÆ® ÇÕ´Ï´Ù. ÀÌ ¸Þ¼­µå´Â ÇÊ¿ä¿¡ µû¶ó¼­ paintCell¸¦ È£ÃâÇÕ´Ï´Ù. ¼­ºê Ŭ·¡½º´Â ÀÌ·¯ÇÑ ¸Þ¼­µå¸¦ ¿À¹ö¶óÀ̵å(override) ÇÒ ¼ö ÀÖ½À´Ï´Ù.

¿À¹ö¶óÀ̵å(override):
Ŭ·¡½º ComponentUI ³»ÀÇ paint
ÆĶó¹ÌÅÍ:
g - ÆäÀÎÆ® ´ë»óÀÇ Graphics ÄÁÅؽºÆ®
c - ÆäÀÎÆ® µÇ´Â ÄÄÆÛ³ÍÆ®. ÀÌ Àμö´Â ÀÚÁÖ ¹«½ÃµÇÁö¸¸, UI °´Ã¼°¡ »óžøÀÌ º¹¼öÀÇ ÄÄÆÛ³ÍÆ®¿¡ °øÀ¯µÇ´Â °æ¿ì¿¡ »ç¿ëµÇ´Â ÀÏÀÌ ÀÖ´Â
°ü·Ã Ç׸ñ:
paintCell(java.awt.Graphics, int, java.awt.Rectangle, javax.swing.ListCellRenderer, javax.swing.ListModel, javax.swing.ListSelectionModel, int)

getPreferredSize

public Dimension  getPreferredSize(JComponent  c)
¸®½ºÆ®ÀÇ preferredSize´Â ¹èÄ¡ ¹æÇâ¿¡ ÀÇÇØ Á¤ÇØÁý´Ï´Ù.
¹èÄ¡ ¹æÇâÀûÀýÇÑ »çÀÌÁî
JList.VERTICAL¸®½ºÆ®ÀÇ preferredSize´Â ÇàÀÇ ³ôÀÌÀÇ ÇÕ°è¿Í ¼¿ÀÇ ÃÖ´ëÆøÀÔ´Ï´Ù. JList.fixedCellHeight°¡ °¡¸®Å°´Â °æ¿ì, ÇàÀÇ ³ôÀÌÀÇ ÇÕ°è´Â (cellVerticalMargins + fixedCellHeight) * model.getSize()°¡ µË´Ï´Ù. ¿©±â¼­ rowVerticalMargins´Â Æ÷Ä¿½º¸¦ ³ªÅ¸³»´Â ³ë¶õ ¾Æ¿ìÆ®¶óÀÎÀ» ·»´õ¸µ Çϱâ À§Çؼ­ ÇÒ´çÇÏ´Â ¿µ¿ª¿¡ »ó´çÇÕ´Ï´Ù. °°ÀÌ fixedCellWidth°¡ °¡¸®Å°´Â °æ¿ì´Â ¼¿ÀÇ °íÁ¤³ÐÀ̸¦ »ç¿ëÇÕ´Ï´Ù.
JList.VERTICAL_WRAP°¡½ÃÀÇ Çà¼ö°¡ 0 º¸´Ù Å« °æ¿ì, preferredHeight´Â ¼¿ÀÇ ÃÖ´ëÀÇ ³ôÀÌ * visibleRowCount°¡ µË´Ï´Ù. °¡½ÃÀÇ Çà¼ö°¡ 0 ¾Æ·¡ÀÇ °æ¿ì, ÀûÀýÇÑ ³ôÀÌ´Â ÇöÀçÀÇ ¸®½ºÆ®ÀÇ ³ôÀÌ¿Í ¼¿ÀÇ ÃÖ´ëÀÇ ³ôÀÌÁß ³ôÀº ÆíÀÌ µË´Ï´Ù. ÀûÀýÇÑ ÆøÀº ¼¿ÀÇ ÃÖ´ëÆø * ÇÊ¿äÇÑ ·Ä¼ö,°¡ µË´Ï´Ù. ¿©±â¼­, ÇÊ¿äÇÑ ·Ä¼ö´Â ¸®½ºÆ®ÀÇ ³ôÀÌ/¼¿ÀÇ ÃÖ´ëÀÇ ³ôÀÌÀÔ´Ï´Ù. ¼¿ÀÇ ÃÖ´ëÀÇ ³ôÀÌ´Â ¼¿ÀÇ °íÁ¤ÀÇ ³ôÀÌ°¡ µÇ´ÂÁö, ¸ðµç ¼¿¿¡ ´ëÇؼ­ ¹Ýº¹ÇØ ListCellRenderer ·ÎºÎÅÍ ÃÖ´ëÀÇ ³ôÀ̸¦ °Ë»öÇÏ´Â °ÍÀ¸·Î½á Á¤ÇØÁý´Ï´Ù.
JList.HORIZONTAL_WRAP°¡½ÃÀÇ Çà¼ö°¡ 0 º¸´Ù Å« °æ¿ì, preferredHeight´Â ¼¿ÀÇ ÃÖ´ëÀÇ ³ôÀÌ * adjustedRowCount°¡ µË´Ï´Ù. ¿©±â¼­, visibleRowCount´Â ·Ä¼öÀÇ ÁöÁ¤¿¡ »ç¿ëµË´Ï´Ù. ¼öÆò¿¡ ¹èÄ¡Çϱâ À§ÇØ, Çà¼ö´Â ·Ä¼ö·ÎºÎÅÍ Á¤ÇØÁý´Ï´Ù. ¿¹¸¦ µé¾î 10 Ç׸ñÀÇ ¸ðµ¨·Î °¡½ÃÇà¼ö°¡ 8 À̶ó°í ÇÕ´Ï´Ù. Ç¥½Ã¿¡ ÇÊ¿äÇÑ ¿­Àº 2 ¿­ÀÔ´Ï´Ù¸¸, 8 ÇàÀ̳ª ÇÊ¿ä¾ø°í, 5 ÇàÀ¸·Î ³¡³³´Ï´Ù. µû¶ó¼­, adjustedRowCount´Â 5°¡ µË´Ï´Ù.

°¡½ÃÇà¼ö°¡ 0 ¾Æ·¡ÀÇ °æ¿ì, ÀûÀýÇÑ ³ôÀÌ´Â ·Ä¼ö¿¡ µû¸¨´Ï´Ù. Àû¾îµµ 1 ¿­·ÎJList ³ÐÀÌ (Æø/ÃÖ´ë ¼¿Æø)¿¡ ÀûÀýÇÑ ¹üÀ§³»ÀÇ ¼ö°¡ µË´Ï´Ù. ÀûÀýÇÑ ³ôÀÌ´Â ¸ðµ¨ »çÀÌÁî/·Ä¼ö * ¼¿ÀÇ ÃÖ´ëÀÇ ³ôÀÌ°¡ µË´Ï´Ù. ¼¿ÀÇ ÃÖ´ëÀÇ ³ôÀÌ´Â ¼¿ÀÇ °íÁ¤ÀÇ ³ôÀÌ°¡ µÇ´ÂÁö, ¸ðµç ¼¿¿¡ ´ëÇؼ­ ¹Ýº¹ÇØ ListCellRenderer ·ÎºÎÅÍ ÃÖ´ëÀÇ ³ôÀ̸¦ °Ë»öÇÏ´Â °ÍÀ¸·Î½á Á¤ÇØÁý´Ï´Ù.

»ó±â´Â ¹Ìó¸®ÀÎ ÀûÀýÇÑ Æø°ú ³ôÀÌÀÔ´Ï´Ù. °á°úÀûÀ¸·Î ¾òÀ» ¼ö ÀÖ´Â ÀûÀýÇÑ ÆøÀº »ó±âÀdzÐÀÌ + insets.left + insets.right ·Î °á°úÀûÀ¸·Î ¾òÀ» ¼ö ÀÖ´Â ÀûÀýÇÑ ³ôÀÌ´Â »ó±âÀÇ ³ôÀÌ + insets.top + insets.bottom ÀÔ´Ï´Ù. ¿©±â¼­, Insets´Â list.getInsets()·Î ºÎÅÍ Á¤ÇØÁý´Ï´Ù.

¿À¹ö¶óÀ̵å(override):
Ŭ·¡½º ComponentUI ³»ÀÇ getPreferredSize
ÆĶó¹ÌÅÍ:
c - JList ÄÄÆÛ³ÍÆ®
¹Ýȯ°ª:
¸®½ºÆ®ÀÇ ÃÑ»çÀÌÁî
°ü·Ã Ç׸ñ:
JComponent.getPreferredSize(), LayoutManager.preferredLayoutSize(java.awt.Container)

selectPreviousIndex

protected void selectPreviousIndex()
1°³ ÀüÀÇ ÇàÀ» ¼±ÅÃÇØ, ±×°ÍÀ» °­Á¦ÀûÀ¸·Î °¡½Ã·Î ÇÕ´Ï´Ù.

°ü·Ã Ç׸ñ:
JList.ensureIndexIsVisible(int)

selectNextIndex

protected void selectNextIndex()
1°³ ÀüÀÇ ÇàÀ» ¼±ÅÃÇØ, ±×°ÍÀ» °­Á¦ÀûÀ¸·Î °¡½Ã·Î ÇÕ´Ï´Ù.

°ü·Ã Ç׸ñ:
JList.ensureIndexIsVisible(int)

installKeyboardActions

protected void installKeyboardActions()
BasicListUI¸¦ °ü·ÃµÈ JList »óÀÇ Å°º¸µå ¹ÙÀεùÀ» ¸®ÅÏÇÕ´Ï´Ù. ÀÌ ¸Þ¼­µå´Â installUI() ½ÇÇà½Ã¿¡ È£ÃâÇÕ´Ï´Ù.

°ü·Ã Ç׸ñ:
installUI(javax.swing.JComponent)

uninstallKeyboardActions

protected void uninstallKeyboardActions()
installKeyboardActions·Î ºÎÅÍ ÀνºÅç µÈ Å°º¸µå ¾×¼ÇÀÇ µî·ÏÀ» ÇØÁ¦ÇÕ´Ï´Ù. ÀÌ ¸Þ¼­µå´Â uninstallUI()ÀÇ ½ÇÇà½Ã¿¡ È£ÃâÇÕ´Ï´Ù. ¼­ºê Ŭ·¡½º´Â installUI ½ÇÇà½Ã¿¡ µî·ÏµÈ Å°º¸µå ¾×¼ÇÀ» ¸ðµÎ, ¿©±â¼­ »èÁ¦ÇÒ ÇÊ¿ä°¡ ÀÖ½À´Ï´Ù.

°ü·Ã Ç׸ñ:
installUI(javax.swing.JComponent)

installListeners

protected void installListeners()
JList, ±× ¸ðµ¨ ¹× selectionModel ¸®½º³Ê¸¦ ÀÛ¼º ¹× ÀνºÅç ÇÕ´Ï´Ù. ÀÌ ¸Þ¼­µå´Â installUI()ÀÇ ½ÇÇà½Ã¿¡ È£ÃâÇÕ´Ï´Ù.

°ü·Ã Ç׸ñ:
installUI(javax.swing.JComponent), uninstallListeners()

uninstallListeners

protected void uninstallListeners()
JList, ±× ¸ðµ¨ ¹× selectionModel ¸®½º³Ê¸¦ »èÁ¦ÇÕ´Ï´Ù. ¿©±â¼­, ¸®½º³ÊÀÇ Çʵå´Â ¸ðµÎ null¿¡ ¸®¼Â µË´Ï´Ù. ÀÌ ¸Þ¼­µå´Â uninstallUI()ÀÇ ½ÇÇà½Ã¿¡ È£ÃâÇÕ´Ï´Ù. installListners¿Í ÀÇ µ¿±â¸¦ À¯ÁöÇϵµ·ÏÀÇÇØ ÁÖ¼¼¿ä.

°ü·Ã Ç׸ñ:
uninstallUI(javax.swing.JComponent), installListeners()

installDefaults

protected void installDefaults()
JList ÇÁ·ÎÆÛƼ (ÆùÆ®, foreground ¹× ¹é±×¶ó¿îµåµî)¸¦ ÃʱâÈ­ÇØ, CellRendererPane¸¦ Ãß°¡ÇÕ´Ï´Ù. ÆùÆ®, foreground ¹× ¹é±×¶ó¿îµåÀÇ °¢ ÇÁ·ÎÆÛƼ´Â ±×·¯ÇÑ ÇöÀçÀÇ °ªÀÌ null ³ª UIResource ÀÎ °æ¿ì¿¡¸¸ ¼³Á¤µË´Ï´Ù. ±× ¿ÜÀÇ ÇÁ·ÎÆÛƼ´Â ÇöÀçÀÇ °ªÀÌ null ÀÎ °æ¿ì·Î ¼³Á¤µË´Ï´Ù.

°ü·Ã Ç׸ñ:
uninstallDefaults(), installUI(javax.swing.JComponent), CellRendererPane

uninstallDefaults

protected void uninstallDefaults()
null¿¡ ¸í½ÃÀûÀ¸·Î ¿À¹ö¶óÀ̵å(override)µÇ¾î ÀÖÁö ¾ÊÀº JList ÇÁ·ÎÆÛƼ¸¦ ¼³Á¤ÇÕ´Ï´Ù. ÇöÀçÀÇ °ªÀÌ UIResouce°¡ ¾Æ´Ï¸é, ÇÁ·ÎÆÛƼ´Â ¿À¹ö¶óÀ̵å(override) µÇ¾ú´Ù°í ÆǴܵ˴ϴÙ.

°ü·Ã Ç׸ñ:
installDefaults(), uninstallUI(javax.swing.JComponent), CellRendererPane

installUI

public void installUI(JComponent  c)
installDefaults(), installListeners() ¹× installKeyboardActions()¸¦ ¼ø¼­¿¡ È£ÃâÇØ, this.list¸¦ ÃʱâÈ­ÇÕ´Ï´Ù.

¿À¹ö¶óÀ̵å(override):
Ŭ·¡½º ComponentUI ³»ÀÇ installUI
ÆĶó¹ÌÅÍ:
c - UI À§¾çÀÌ ÀνºÅç µÇ°í ÀÖ´Â ÄÄÆÛ³ÍÆ®
°ü·Ã Ç׸ñ:
installDefaults(), installListeners(), installKeyboardActions()

uninstallUI

public void uninstallUI(JComponent  c)
uninstallListeners(), uninstallKeyboardActions() ¹× uninstallDefaults()¸¦ ¼ø¼­¿¡ È£ÃâÇØ, this.list ÃʱâÈ­¸¦ ÇØÁ¦ÇÕ´Ï´Ù. this.list´Â null ·Î ¼³Á¤µË´Ï´Ù.

¿À¹ö¶óÀ̵å(override):
Ŭ·¡½º ComponentUI ³»ÀÇ uninstallUI
ÆĶó¹ÌÅÍ:
c - ÀÌ UI À§¾çÀÌ »èÁ¦µÇ´Â ÄÄÆÛ³ÍÆ®. ÀÌ Àμö´Â ÀÚÁÖ ¹«½ÃµÇÁö¸¸, UI °´Ã¼°¡ »óžøÀÌ º¹¼öÀÇ ÄÄÆÛ³ÍÆ®¿¡ °øÀ¯µÇ´Â °æ¿ì¿¡ »ç¿ëµÇ´Â ÀÏÀÌ ÀÖ´Â
°ü·Ã Ç׸ñ:
uninstallListeners(), uninstallKeyboardActions(), uninstallDefaults()

createUI

public static ComponentUI  createUI(JComponent  list)
BasicListUI »õ·Î¿î ÀνºÅϽº¸¦ ¸®ÅÏÇÕ´Ï´Ù. BasicListUI À§¾çÀº JList 1°³À» µÚµû¶ó 1°³À» ÇÒ´çÇÒ ¼ö ÀÖ½À´Ï´Ù.

¹Ýȯ°ª:
Winodws Look & Feel¸¦ À§ÇÑ, »õ·Î¿î ListUI ±¸Çö

locationToIndex

public int locationToIndex(JList  list,
                           Point  location)
JList ÁÂÇ¥»óÀÇ Á¡À» ±× À§Ä¡¿¡ ÀÖ´Â ¼¿ÀÇ À妽º·Î º¯È¯ÇÕ´Ï´Ù. ¼¿ÀÌ ½ÇÁ¦·Î ±× À§Ä¡¸¦ Æ÷ÇÔÇÒÁö ¾î¶³Áö¸¦ ÆÇÁ¤ÇÏ·Á¸é, ÀÌ ¸Þ¼­µå¿Í getCellBounds¸¦ Á¶ÇÕÇØ »ç¿ëÇÕ´Ï´Ù. ¸ðµ¨ÀÌ ºñ¾îÀÖ´Â °æ¿ì´Â -1À» ¸®ÅÏÇÕ´Ï´Ù.

Á¤ÀÇ:
Ŭ·¡½º ListUI ³»ÀÇ locationToIndex
location - ¼¿ÀÇ JList »óÀÇ »ó´ë ÁÂÇ¥
¹Ýȯ°ª:
ÁöÁ¤µÈ À§Ä¡¿¡ ÀÖ´Â ¼¿ÀÇ À妽º, ¶Ç´Â -1
°ü·Ã Ç׸ñ:
ListUI.locationToIndex(javax.swing.JList, java.awt.Point)

indexToLocation

public Point  indexToLocation(JList  list,
                             int index)
Ŭ·¡½º ListUI ±â¼ú:
ÁöÁ¤µÈ Ç׸ñÀÇ JList ÁÂÇ¥¿¡ À־ÀÇ ¿øÁ¡À» ¸®ÅÏÇÕ´Ï´Ù. ¹«È¿ÀÎ À妽º¸¦ ÁöÁ¤ÇßÀ» °æ¿ì´Â nullÀ» ¸®ÅÏÇÕ´Ï´Ù.

Á¤ÀÇ:
Ŭ·¡½º ListUI ³»ÀÇ indexToLocation
index - JList ¼¿ÀÇ À妽º
¹Ýȯ°ª:
index ·Î ÁöÁ¤µÈ ¹øÈ£ÀÇ ¼¿ÀÇ ¿øÁ¡. index°¡ ¹«È¿ÀÇ °æ¿ì´Â null
°ü·Ã Ç׸ñ:
ListUI.indexToLocation(javax.swing.JList, int)

getCellBounds

public Rectangle  getCellBounds(JList  list,
                               int index1,
                               int index2)
Ŭ·¡½º ListUI ±â¼ú:
ÁöÁ¤µÈ Ç׸ñÀÇ JList ÁÂÇ¥¿¡ À־ÀÇ °æ°è¸¦ ¸®ÅÏÇÕ´Ï´Ù. ¹«È¿ÀÎ À妽º¸¦ ÁöÁ¤ÇßÀ» °æ¿ì´Â nullÀ» ¸®ÅÏÇÕ´Ï´Ù.

Á¤ÀÇ:
Ŭ·¡½º ListUI ³»ÀÇ getCellBounds
¹Ýȯ°ª:
index ·Î ÁöÁ¤µÈ ¹øÈ£ÀÇ ¼¿ÀÇ °æ°è
°ü·Ã Ç׸ñ:
ListUI.getCellBounds(javax.swing.JList, int, int)

getRowHeight

protected int getRowHeight(int row)
ÇöÀçÀÇ ·¹À̾ƿôÀ¸·Î ÁöÁ¤µÈ ÇàÀÇ ³ôÀ̸¦ ¸®ÅÏÇÕ´Ï´Ù.

¹Ýȯ°ª:
ÁöÁ¤µÈ ÇàÀÇ ³ôÀÌ. ÇàÀÇ ÁöÁ¤ÀÌ ¹«È¿ÀÎ °æ¿ì´Â -1
°ü·Ã Ç׸ñ:
convertYToRow(int), convertRowToY(int), updateLayoutState()

convertYToRow

protected int convertYToRow(int y0)
JList »ó´ë ÁÂÇ¥¸¦, ÇöÀçÀÇ ·¹À̾ƿôÀ» ±âº»À¸·Î ÇØ, ÁÂÇ¥¸¦ Æ÷ÇÔÇÑ ÇàÀ¸·Î º¯È¯ÇÕ´Ï´Ù. y0°¡ ¾î´À Çà¿¡µµ Æ÷ÇÔµÇÁö ¾Ê´Â °æ¿ì´Â -1À» ¸®ÅÏÇÕ´Ï´Ù.

¹Ýȯ°ª:
y0¸¦ Æ÷ÇÔÇÑ Çà, ¶Ç´Â -1
°ü·Ã Ç׸ñ:
getRowHeight(int), updateLayoutState()

convertRowToY

protected int convertRowToY(int row)
ÁöÁ¤µÈ ÇàÀÇ ¿øÁ¡ÀÇ JList »ó´ë Y ÁÂÇ¥¸¦ ¸®ÅÏÇÕ´Ï´Ù. ÇàÀÌ ¹«È¿ÀÎ °æ¿ì´Â -1À» ¸®ÅÏÇÕ´Ï´Ù.

¹Ýȯ°ª:
ÇàÀÇ ¿øÁ¡ÀÇ Y ÁÂÇ¥, ¶Ç´Â -1
°ü·Ã Ç׸ñ:
getRowHeight(int), updateLayoutState()

maybeUpdateLayoutState

protected void maybeUpdateLayoutState()
updateLayoutStateNeeded°¡ Á¦·Î°¡ ¾Æ´Ï¸é, updateLayoutState()À» È£ÃâÇØ updateLayoutStateNeeded¸¦ ¸®¼Â ÇÕ´Ï´Ù. ÀÌ ¸Þ¼­µå´Â ¸®½ºÆ®ÀÇ Áö¿À¸ÞÆ®¸®¿¡ ±Ù°ÅÇѵ¥ µîÀΰ¡ÀÇ Ã³¸®¸¦ Çϱâ Àü¿¡ ´Ù¸¥ ¸Þ¼­µå·Î È£ÃâÇϵµ·ÏÀÇÇØ ÁÖ¼¼¿ä. ¿¹¸¦ µé¾î paint() ¹× getPreferredSize()·Î ÃÖÃʷΠȣÃâÇØ ÁÖ¼¼¿ä.

°ü·Ã Ç׸ñ:
updateLayoutState()

updateLayoutState

protected void updateLayoutState()
cellHeight (¶Ç´Â cellHeights) ¹× cellWidth °ªÀ» ÇöÀçÀÇ ÆùÆ®¿Í fixedCellWidth, fixedCellHeight ¹× prototypeCellValue ÇöÀçÀÇ °ªÀ» ±âº»À¸·ÎÀÇÇØ ´Ù½Ã °è»êÇÕ´Ï´Ù.

°ü·Ã Ç׸ñ:
maybeUpdateLayoutState()

createMouseInputListener

protected MouseInputListener  createMouseInputListener()
MouseInputListener¸¦ ±¸ÇöÇÏ´Â À§¾çÀ» ÀÛ¼ºÇÕ´Ï´Ù. ÀÌ À§¾çÀº installUI()ÀÇ ½ÇÇà½Ã¿¡ ´ëÀÀÇÏ´Â java.awt.Component ¸®½º³Ê ¸®½ºÆ®¿¡ Ãß°¡µË´Ï´Ù. ¼­ºê Ŭ·¡½º´Â ÀÌ ¸Þ¼­µå¸¦ ¿À¹ö¶óÀ̵å(override)ÀÇÇØ µ¶ÀÚÀûÀÎ MouseInputListener¸¦ µ¹·ÁÁÙ ¼ö°¡ ÀÖ½À´Ï´Ù. ´ÙÀ½¿¡ ¿¹¸¦ ³ªÅ¸³À´Ï´Ù.

 class MyListUI extends BasicListUI {
    protected MouseInputListener createMouseInputListener() {
        return new MyMouseInputHandler();
    }
    public class MyMouseInputHandler extends MouseInputHandler {
        public void mouseMoved(MouseEvent e) {
            // do some extra work when the mouse moves
            super.mouseMoved(e);
        }
    }
 }
 

°ü·Ã Ç׸ñ:
BasicListUI.MouseInputHandler, installUI(javax.swing.JComponent)

createFocusListener

protected FocusListener  createFocusListener()

createListSelectionListener

protected ListSelectionListener  createListSelectionListener()
selectionModel¿¡ ÀÇÇØ ÇÊ¿ä¿¡ µû¶ó¼­ JList¿¡ Ãß°¡µÇ´Â ListSelectionHandler ÀνºÅϽº¸¦ »ý¼ºÇÕ´Ï´Ù. ¼­ºê Ŭ·¡½º´Â ÀÌ ¸Þ¼­µå¸¦ ¿À¹ö¶óÀ̵å(override)ÀÇÇØ µ¶ÀÚÀûÀÎ ListSelectionListener¸¦ µ¹·ÁÁÙ ¼ö°¡ ÀÖ½À´Ï´Ù. ´ÙÀ½¿¡ ¿¹¸¦ ³ªÅ¸³À´Ï´Ù.

 class MyListUI extends BasicListUI {
    protected ListSelectionListener createListSelectionListener() {
        return new MySelectionListener();
    }
    public class MySelectionListener extends ListSelectionHandler {
        public void valueChanged(ListSelectionEvent e) {
            // do some extra work when the selection changes
            super.valueChange(e);
        }
    }
 }
 

°ü·Ã Ç׸ñ:
BasicListUI.ListSelectionHandler, installUI(javax.swing.JComponent)

createListDataListener

protected ListDataListener  createListDataListener()
¸ðµ¨¿¡ ÀÇÇØ ÇÊ¿ä¿¡ µû¶ó¼­ JList¿¡ Ãß°¡µÇ´Â ListDataListener ÀνºÅϽº¸¦ »ý¼ºÇÕ´Ï´Ù. ¼­ºê Ŭ·¡½º´Â ÀÌ ¸Þ¼­µå¸¦ ¿À¹ö¶óÀ̵å(override)ÀÇÇØ µ¶ÀÚÀûÀÎ ListDataListener¸¦ µ¹·ÁÁÙ ¼ö°¡ ÀÖ½À´Ï´Ù. ´ÙÀ½¿¡ ¿¹¸¦ ³ªÅ¸³À´Ï´Ù.

 class MyListUI extends BasicListUI {
    protected ListDataListener createListDataListener() {
        return new MyListDataListener();
    }
    public class MyListDataListener extends ListDataHandler {
        public void contentsChanged(ListDataEvent e) {
            // do some extra work when the models contents change
            super.contentsChange(e);
        }
    }
 }
 

°ü·Ã Ç׸ñ:
ListDataListener, JList.getModel(), installUI(javax.swing.JComponent)

createPropertyChangeListener

protected PropertyChangeListener  createPropertyChangeListener()
installUI()¿¡ ÀÇÇØ JList¿¡ Ãß°¡µÇ´Â PropertyChangeHandler ÀνºÅϽº¸¦ »ý¼ºÇÕ´Ï´Ù. ¼­ºê Ŭ·¡½º´Â ÀÌ ¸Þ¼­µå¸¦ ¿À¹ö¶óÀ̵å(override)ÀÇÇØ µ¶ÀÚÀûÀÎ PropertyChangeListener¸¦ µ¹·ÁÁÙ ¼ö°¡ ÀÖ½À´Ï´Ù. ´ÙÀ½¿¡ ¿¹¸¦ ³ªÅ¸³À´Ï´Ù.

 class MyListUI extends BasicListUI {
    protected PropertyChangeListener createPropertyChangeListener() {
        return new MyPropertyChangeListener();
    }
    public class MyPropertyChangeListener extends PropertyChangeHandler {
        public void propertyChange(PropertyChangeEvent e) {
            if (e.getPropertyName(). equals("model")) {
                // do some extra work when the model changes
            }
            super.propertyChange(e);
        }
    }
 }
 

°ü·Ã Ç׸ñ:
PropertyChangeListener, installUI(javax.swing.JComponent)

JavaTM 2 Platform
Standard Ed. 5.0

Copyright 2004 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms . Documentation Redistribution Policy µµ ÂüÁ¶ÇϽʽÿÀ.