|
JavaTM 2 Platform Standard Ed. 5.0 |
|||||||||
ÀÌÀü Ŭ·¡½º ´ÙÀ½ Ŭ·¡½º | ÇÁ·¹ÀÓÀ¸·Î ÇÁ·¹ÀÓ ¾øÀÌ | |||||||||
°³¿ä: NESTED | Çʵå | constructor | ¸Þ¼µå | »ó¼¼: Çʵå | »ý¼ºÀÚ | ¸Þ¼µå |
java.lang.Objectjava.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JList
public class JList
»ç¿ëÀÚ°¡ ¸®½ºÆ®·ÎºÎÅÍ 1°³
¶Ç´Â º¹¼öÀÇ °´Ã¼¸¦ ¼±ÅÃÇϱâ À§ÇÑ ÄÄÆÛ³ÍÆ®ÀÔ´Ï´Ù. ´Ù¸¥ ¸ðµ¨ÀÎ ListModel
´Â
¸®½ºÆ®ÀÇ ³»¿ëÀ» ³ªÅ¸³À´Ï´Ù. ListModel
ÀνºÅϽº¸¦ »ý¼ºÇÏ´Â JList
»ý¼ºÀÚ¸¦ »ç¿ëÇϸé, °´Ã¼ÀÇ ¹è¿ ¶Ç´Â º¤Å͸¦ °£´ÜÇÏ°Ô Ç¥½ÃÇÒ ¼ö ÀÖ½À´Ï´Ù.
// Create a JList that displays the strings in data[] String[] data = {"one", "two", "three", "four"}; JList dataList = new JList(data); // The value of the JList model property is an object that provides // a read-only view of the data. It was constructed automatically. for(int i = 0; i < dataList.getModel(). getSize(); i++) { System.out.println(dataList.getModel(). getElementAt(i)); } // Create a JList that displays the superclass of JList.class. // We store the superclasses in a java.util.Vector. Vector superClasses = new Vector(); Class rootClass = javax.swing.JList.class; for(Class cls = rootClass; cls ! = null; cls = cls.getSuperclass()) { superClasses.addElement(cls); } JList classList = new JList(superClasses);
JList
´Â ½ºÅ©·ÑÀ» Á÷Á¢ Áö¿ø
Çϰí ÀÖ½À´Ï´Ù. ½ºÅ©·Ñ ¸®½ºÆ®¸¦ ÀÛ¼ºÇÏ·Á¸é,
JList
¸¦ JScrollPane
ºäÆ÷Æ®ºä·Î¼ ¼³Á¤ÇÕ´Ï´Ù. ´ÙÀ½¿¡ ¿¹¸¦ ³ªÅ¸³À´Ï´Ù.
JScrollPane scrollPane = new JScrollPane(dataList); // Or in two steps: JScrollPane scrollPane = new JScrollPane(); scrollPane.getViewport(). setView(dataList);
µðÆúÆ®¿¡¼´Â Á¤¼ö MULTIPLE_INTERVAL_SELECTION
¸¦ »ç¿ëÇØ, JList
¼±Åà ¸ðµ¨¿¡ ÀÇÇØ Ç׸ñÀÇ Æí¼ºÀ» ÇÑ ¹ø¿¡ ¼±ÅÃÇÒ ¼ö ÀÖ½À´Ï´Ù
. ¼±Åà »óÅ´ ½ÇÁ¦·Î´Â °³º°ÀÇ À§¾ç °´Ã¼, ListSelectionModel
ÀνºÅϽº·Î °ü¸®µÇ°í ÀÖ½À´Ï´Ù. ´Ù¸¸, JList
¿¡
¼´Â ¼±Åà °ü¸®¿¡ Æí¸®ÇÑ ÇÁ·ÎÆÛƼ°¡ Á¦°øµË´Ï´Ù.
String[] data = {"one", "two", "three", "four"}; JList dataList = new JList(data); dataList.setSelectedIndex(1); // select "two" dataList.getSelectedValue(); // returns "two"
JList
³»¿ëÀº µ¿ÀûÀÔ´Ï´Ù. Áï, JList
ÀÛ¼º ÈÄ¿¡ ¸®½ºÆ® ¿ä¼ÒÀÇ °ªÀ̳ª ¸®½ºÆ®ÀÇ »çÀÌÁ º¯°æÇÒ ¼ö ÀÖ½À´Ï´Ù. JList
´Â
swing.event.ListDataListener
±¸Çö¿¡ ÀÇÇØ ¸ðµ¨ÀÇ º¯°æÀ» °¨½ÃÇÕ´Ï´Ù. ListModel
°¡ ¿Ã¹Ù¸£°Ô ±¸ÇöµÇ°í ÀÖÀ¸¸é, º¯°æÀÌ ¹ß»ýÇÒ ¶§¸¶´Ù ¸®½º³Ê¿¡°Ô ÅëÁöÇÕ´Ï´Ù. º¯°æÀº ¼öÁ¤, Ãß°¡ ¶Ç´Â »èÁ¦µÈ ¸®½ºÆ® À妽ºÀÇ ¹üÀ§¸¦ ½Äº°ÇÏ´Â swing.event.ListDataEvent
¿¡ ÀÇÇØ ±â¼úµË´Ï´Ù. ´Ü¼øÇÑ µ¿Àû ³»¿ëÀÇ JList
¾îÇø®ÄÉÀ̼ÇÀº, DefaultListModel
Ŭ·¡½º¸¦ »ç¿ëÇØ ¸®½ºÆ® ¿ä¼Ò¸¦ Æ÷ÇÔÇÒ ¼ö ÀÖ½À´Ï´Ù. ÀÌ Å¬·¡½º´Â ListModel
ÀÎÅÍÆäÀ̽º¸¦ ±¸ÇöÇØ, java.util.Vector
APIµµ
Á¦°øÇÕ´Ï´Ù. Ä¿½ºÅÒ ListModel
±¸ÇöÀ» Á¦°øÇÒ Çʿ䰡 ÀÖ´Â ¾îÇø®ÄÉÀ̼ÇÀº ±âº»ÀûÀÎ ListDataListener
Áö¿ø¸¦ Á¦°øÇÏ´Â AbstractListModel
À»
»ó¼ÓÇÒ ¼ö ÀÖ½À´Ï´Ù
. ´ÙÀ½¿¡ ¿¹¸¦ ³ªÅ¸³À´Ï´Ù.
// This list model has about 2^16 elements. Enjoy scrolling. ListModel bigData = new AbstractListModel() { public int getSize() { return Short.MAX_VALUE; } public Object getElementAt(int index) { return "Index " + index; } }; JList bigDataList = new JList(bigData); // We don't want the JList implementation to compute the width // or height of all of the list cells, so we give it a string // that's as big as we'll need for any cell. It uses this to // compute values for the fixedCellWidth and fixedCellHeight // properties. bigDataList.setPrototypeCellValue("Index 1234567890");
JList
´Â
cellRenderer
¸¦ È£ÃâÇÏ´Â À§¾ç¿¡ ÀÇÇØ Á¦°øµÇ´Â java.awt.Component
¸¦ »ç¿ëÇØ, ¸®½ºÆ®³»¿¡¼ °¡½Ã ¼¿À» ·»´õ¸µ ÇÕ´Ï´Ù. °¡½ÃÀÇ °¢ ÇàÀº ¼¿ ·»´õ¸µ ÄÄÆÛ³ÍÆ®¸¦ ¡¸rubber-stamp¡¹¿Í °°ÀÌ »ç¿ëÇØ ·»´õ¸µ µË´Ï´Ù. JList
´Â
¼¿À» ·»´õ¸µ ÇÒ Çʿ䰡 ÀÖÀ» ¶§¸¶´Ù, ¼¿ ·»´õ¸µ¿¡ ÄÄÆÛ³ÍÆ®¸¦ ¿ä±¸ÇØ, setBounds()
¸¦ »ç¿ëÇØ ÀûÀýÇÑ Àå¼Ò¿¡ ¹èÄ¡ÇÏ°í ³ª¼, ·»´õ¸µÀÇ ·»´õ¸µ ¸Þ¼µå¸¦ È£ÃâÇØ ·»´õ¸µ ÇÕ´Ï´Ù. µðÆúÆ®ÀÇ ¼¿ ·»´õ¸µÀº, JLabel
ÄÄÆÛ³ÍÆ®¸¦ »ç¿ëÇØ, °¢ ÄÄÆÛ³ÍÆ®ÀÇ Ä³¸¯ÅÍ ¶óÀÎÄ¡¸¦ ·»´õ¸µ ÇÕ´Ï´Ù. ´ÙÀ½°ú °°Àº Äڵ忡ÀÇÇØ ÀÚ½ÅÀÇ ¼¿ ·»´õ¸µÀ» »ç¿ëÇÒ ¼öµµ ÀÖ½À´Ï´Ù.
// Display an icon and a string for each object in the list. class MyCellRenderer extends JLabel implements ListCellRenderer { final static ImageIcon longIcon = new ImageIcon("long.gif"); final static ImageIcon shortIcon = new ImageIcon("short.gif"); // This is the only method defined by ListCellRenderer. // We just reconfigure the JLabel each time we're called. public Component getListCellRendererComponent( JList list, Object value, // value to display int index, // cell index boolean isSelected, // is the cell selected boolean cellHasFocus) // the list and the cell have the focus { String s = value.toString(); setText(s); setIcon((s.length() > 10) ? longIcon : shortIcon); if (isSelected) { setBackground(list.getSelectionBackground()); setForeground(list.getSelectionForeground()); } else { setBackground(list.getBackground()); setForeground(list.getForeground()); } setEnabled(list.isEnabled()); setFont(list.getFont()); setOpaque(true); return this; } } String[] data = {"one", "two", "three", "four"}; JList dataList = new JList(data); dataList.setCellRenderer(new MyCellRenderer());
JList
´Â
´õºí Ŭ¸¯À̳ª Æ®¸®Çà ( ¹× ±× ÀÌ»óÀÇ È¸¼öÀÇ) Ŭ¸¯À» Ưº°È÷´Â Áö¿ø
Çϰí ÀÖ¾ú½À´Ï´Ù¸¸, MouseListener
¸¦ ÀÌ¿ëÇÏ¸é ±×°ÍµéÀ» °£´ÜÇÏ°Ô Ã³¸®ÇÒ ¼ö ÀÖ½À´Ï´Ù
. Ŭ¸¯µÈ ¼¿À» Á¶»çÇÏ·Á¸é,
JList
locationToIndex()
¸Þ¼µå¸¦ »ç¿ëÇÕ´Ï´Ù. ´ÙÀ½¿¡ ¿¹¸¦ ³ªÅ¸³À´Ï´Ù.
final JList list = new JList(dataModel); MouseListener mouseListener = new MouseAdapter() { public void mouseClicked(MouseEvent e) { if (e.getClickCount() == 2) { int index = list.locationToIndex(e.getPoint()); System.out.println("Double clicked on Item " + index); } } }; list.addMouseListener(mouseListener);ÀÌ ¿¹¿¡¼´Â
dataList
´Â À͸íÀÇ MouseListener
Ŭ·¡½º¿¡ ÀÇÇØ ÂüÁ¶µÇ°í Àֱ⠶§¹®¿¡
final
°¡ µÇ°í ÀÖ½À´Ï´Ù.
°æ°í: ÀÌ Å¬·¡½ºÀÇ Á÷·ÄÈ µÈ °´Ã¼´Â ÇâÈÄÀÇ Swing ¸±¸®Áî¿Í
ȣȯµÇÁö ¾ÊÀ» ¿¹Á¤ÀÔ´Ï´Ù. ÇöÀçÀÇ Á÷·ÄÈÀÇ Áö¿øÀº
´Ü±â°£ÀÇ ¿î¿ëÀ̳ª, °°Àº ¹öÀüÀÇ Swing¸¦ ½ÇÇàÇÏ´Â ¾îÇø®ÄÉÀ̼ǰ£ÀÇ RMI¿¡ ÀûÀýÇϰí ÀÖ½À´Ï´Ù. JDK ¹öÀü
1.4 ÀÌÈÄ, ¸ðµç JavaBeans™
Àå±â°£ÀÇ ¿î¿ë Áö¿øÀº
java.beans
ÆÐŰÁö¿¡ Ãß°¡µÇ°í ÀÖ½À´Ï´Ù. ÀÚ¼¼ÇÑ ³»¿ëÀº XMLEncoder
¸¦
ÂüÁ¶ÇϽʽÿÀ.
ÀÚ¼¼ÇÑ °ÍÀº, ¡¸The Java Tutorial¡¹ÀÇ ¡¸How to Use Lists¡¹¸¦ ÂüÁ¶ÇϽʽÿÀ. ¶ÇÇÑ, ¡¸The Swing Connection¡¹ ¡¸Advanced JList Programming¡¹µµ ÂüÁ¶ÇϽʽÿÀ.
ListModel
,
AbstractListModel
,
DefaultListModel
,
ListSelectionModel
,
DefaultListSelectionModel
,
ListCellRenderer
Áßø(Nested) Ŭ·¡½º °³¿ä | |
---|---|
protected class |
JList.AccessibleJList
ÀÌ Å¬·¡½º´Â JList Ŭ·¡½º¿ëÀÇ »ç¿ëÀÚ
º¸Á¶ ±â´ÉÀÇ Áö¿ø¸¦ ±¸ÇöÇϰí ÀÖ½À´Ï´Ù. |
Ŭ·¡½º javax.swing. JComponent ·ÎºÎÅÍ »ó¼ÓµÈ Áßø(Nested) Ŭ·¡½º/ÀÎÅÍÆäÀ̽º |
---|
JComponent.AccessibleJComponent |
Ŭ·¡½º java.awt. Container ·ÎºÎÅÍ »ó¼ÓµÈ Áßø(Nested) Ŭ·¡½º/ÀÎÅÍÆäÀ̽º |
---|
Container.AccessibleAWTContainer |
Ŭ·¡½º java.awt. Component ·ÎºÎÅÍ »ó¼ÓµÈ Áßø(Nested) Ŭ·¡½º/ÀÎÅÍÆäÀ̽º |
---|
Component.AccessibleAWTComponent,
Component.BltBufferStrategy,
Component.FlipBufferStrategy |
ÇÊµå °³¿ä | |
---|---|
static int |
HORIZONTAL_WRAP
¼¿ÀÌ ¼öÆò ¹æÇâÀÇ ´ÙÀ½¿¡ ¼öÁ÷ ¹æÇâÀÇ ¼ø¼·Î ³ª¶õÇØÁö´Â ¡¸½Å¹® ½ºÅ¸ÀÏ¡¹·¹À̾ƿôÀ» ³ªÅ¸³À´Ï´Ù. |
static int |
VERTICAL
µðÆúÆ®ÀÇ ·¹À̾ƿôÀ» ³ªÅ¸³À´Ï´Ù. |
static int |
VERTICAL_WRAP
¼¿ÀÌ ¼öÁ÷ ¹æÇâÀÇ ´ÙÀ½¿¡ ¼öÆò ¹æÇâÀÇ ¼ø¼·Î ³ª¶õÇØÁö´Â ¡¸½Å¹® ½ºÅ¸ÀÏ¡¹·¹À̾ƿôÀ» ³ªÅ¸³À´Ï´Ù. |
Ŭ·¡½º javax.swing. JComponent ·ÎºÎÅÍ »ó¼ÓµÈ Çʵå |
---|
accessibleContext,
listenerList,
TOOL_TIP_TEXT_KEY,
ui,
UNDEFINED_CONDITION,
WHEN_ANCESTOR_OF_FOCUSED_COMPONENT,
WHEN_FOCUSED,
WHEN_IN_FOCUSED_WINDOW |
Ŭ·¡½º java.awt. Component ·ÎºÎÅÍ »ó¼ÓµÈ Çʵå |
---|
BOTTOM_ALIGNMENT,
CENTER_ALIGNMENT,
LEFT_ALIGNMENT,
RIGHT_ALIGNMENT,
TOP_ALIGNMENT |
ÀÎÅÍÆäÀ̽º java.awt.image. ImageObserver ·ÎºÎÅÍ »ó¼ÓµÈ Çʵå |
---|
ABORT,
ALLBITS,
ERROR,
FRAMEBITS,
HEIGHT,
PROPERTIES,
SOMEBITS,
WIDTH |
»ý¼ºÀÚ °³¿ä | |
---|---|
JList ()
ºñ¾îÀÖ´Â ¸ðµ¨·Î JList ¸¦ ±¸ÃàÇÕ´Ï´Ù. |
|
JList (ListModel dataModel)
ÁöÁ¤µÈ null ÀÌ¿ÜÀÇ ¸ðµ¨ÀÇ ¿ä¼Ò¸¦ Ç¥½ÃÇÏ´Â JList ¸¦ ±¸ÃàÇÕ´Ï´Ù. |
|
JList (Object [] listData)
ÁöÁ¤µÈ ¹è¿ÀÇ ¿ä¼Ò¸¦ Ç¥½ÃÇÏ´Â JList ¸¦ ±¸ÃàÇÕ´Ï´Ù. |
|
JList (Vector <? > listData)
ÁöÁ¤µÈ Vector
¿ä¼Ò¸¦ Ç¥½ÃÇÏ´Â JList ¸¦ ±¸ÃàÇÕ´Ï´Ù. |
¸Þ¼µå °³¿ä | |
---|---|
void |
addListSelectionListener (ListSelectionListener listener)
¼±ÅÃÀÌ º¯°æµÉ ¶§¸¶´Ù ÅëÁöµÇ´Â ¸®½ºÆ®¿¡ ¸®½º³Ê¸¦ Ãß°¡ÇÕ´Ï´Ù. |
void |
addSelectionInterval (int anchor,
int lead)
ÁöÁ¤µÈ ±¸°£À» ÇöÀçÀÇ ¼±Åÿ¡ °¡¼¼ÇÕ´Ï´Ù. |
void |
clearSelection ()
¼±ÅÃÀ» Ŭ¸®¾î ÇÕ´Ï´Ù. |
protected ListSelectionModel |
createSelectionModel ()
DefaultListSelectionModel
ÀνºÅϽº¸¦ ¸®ÅÏÇÕ´Ï´Ù. |
void |
ensureIndexIsVisible (int index)
ºäÆ÷Æ®¸¦ ½ºÅ©·Ñ ÇØ, ÁöÁ¤µÈ ¼¿À» ¿ÏÀüÇÏ°Ô °¡½Ã·Î ÇÕ´Ï´Ù. |
protected void |
fireSelectionValueChanged (int firstIndex,
int lastIndex,
boolean isAdjusting)
¼±Åà ¸ðµ¨ÀÌ º¯°æµÈ °ÍÀ» JList
ListSelectionListener ¿¡ ÅëÁöÇÕ´Ï´Ù. |
AccessibleContext |
getAccessibleContext ()
ÀÌ JList¿¡ °ü·ÃÇÑ AccessibleContext¸¦ ¸®ÅÏÇÕ´Ï´Ù. |
int |
getAnchorSelectionIndex ()
¸¶Áö¸· addSelectionModel ¶Ç´Â setSelectionInterval È£ÃâÇØ¿¡ ÀÖ¾î¼ÀÇ ÃÖÃÊÀÇ À妽º Àμö¸¦ ¸®ÅÏÇÕ´Ï´Ù. |
Rectangle |
getCellBounds (int index0,
int index1)
JList ÁÂÇ¥·Î ÁöÁ¤µÈ Ç׸ñ ¹üÀ§ÀÇ °æ°è¸¦ ¸®ÅÏÇÕ´Ï´Ù. |
ListCellRenderer |
getCellRenderer ()
¸®½ºÆ® Ç׸ñÀ» ·»´õ¸µ ÇÏ´Â °´Ã¼¸¦ ¸®ÅÏÇÕ´Ï´Ù. |
boolean |
getDragEnabled ()
dragEnabled ÇÁ·ÎÆÛƼ¸¦ ÃëµæÇÕ´Ï´Ù. |
int |
getFirstVisibleIndex ()
ÃÖÃÊÀÇ °¡½Ã ¼¿ÀÇ À妽º¸¦ ¸®ÅÏÇÕ´Ï´Ù. |
int |
getFixedCellHeight ()
°íÁ¤ ¼¿°íÀÇ °ªÀ» ¸®ÅÏÇÕ´Ï´Ù. |
int |
getFixedCellWidth ()
°íÁ¤ ¼¿ÆøÀÇ °ªÀ» ¸®ÅÏÇÕ´Ï´Ù. |
int |
getLastVisibleIndex ()
¸¶Áö¸· °¡½Ã ¼¿ÀÇ À妽º¸¦ ¸®ÅÏÇÕ´Ï´Ù. |
int |
getLayoutOrientation ()
·¹À̾ƿôÀÌ ¼¿ÀÇ ´ÜÀÏÀÇ ¿ÀÇ °æ¿ì´Â JList.VERTICAL , ÄÁÅÙÃ÷°¡ ¼öÁ÷ ¹æÇâÀÇ ´ÙÀ½¿¡ ¼öÆò ¹æÇâÀÇ ¼ø¼¿¡ ÁÙ¼± ¡¸½Å¹® ½ºÅ¸ÀÏ¡¹ÀÇ °æ¿ì´Â JList.VERTICAL_WRAP , ÄÁÅÙÃ÷°¡ ¼öÆò ¹æÇâÀÇ ´ÙÀ½¿¡ ¼öÁ÷ ¹æÇâÀÇ ¼ø¼¿¡ ÁÙ¼± ¡¸½Å¹® ½ºÅ¸ÀÏ¡¹ÀÇ °æ¿ì´Â JList.HORIZONTAL_WRAP ¸¦ ¸®ÅÏÇÕ´Ï´Ù. |
int |
getLeadSelectionIndex ()
¸¶Áö¸· addSelectionInterval ¶Ç´Â setSelectionInterval È£ÃâÇØ¿¡ ÀÖ¾î¼ÀÇ 2¹øÂ°ÀÇ À妽º Àμö¸¦ ¸®ÅÏÇÕ´Ï´Ù. |
ListSelectionListener [] |
getListSelectionListeners ()
ÀÌ JList¿¡ addListSelectionListener()·Î Ãß°¡µÈ ¸ðµç ListSelectionListener
¹è¿À» ¸®ÅÏÇÕ´Ï´Ù. |
int |
getMaxSelectionIndex ()
¼±Åõǰí ÀÖ´Â ¼¿ÀÇ ÃÖ´ë À妽º¸¦ ¸®ÅÏÇÕ´Ï´Ù. |
int |
getMinSelectionIndex ()
¼±Åõǰí ÀÖ´Â ¼¿ÀÇ ÃÖ¼Ò À妽º¸¦ ¸®ÅÏÇÕ´Ï´Ù. |
ListModel |
getModel ()
JList ÄÄÆÛ³ÍÆ®¿¡ ÀÇÇØ Ç¥½ÃµÇ´Â Ç׸ñÀÇ ¸®½ºÆ®¸¦ º¸°ü À¯ÁöÇÏ´Â µ¥ÀÌÅÍ ¸ðµ¨À» ¸®ÅÏÇÕ´Ï´Ù. |
int |
getNextMatch (String prefix,
int startIndex,
Position.Bias bias)
Á¢µÎ»ç·Î ½ÃÀ۵Ǵ ´ÙÀ½ÀÇ ¸®½ºÆ® ¿ä¼Ò¸¦ ¸®ÅÏÇÕ´Ï´Ù. |
Dimension |
getPreferredScrollableViewportSize ()
visibleRowCount
ÇàÀ» Ç¥½ÃÇϱâ À§Çؼ ÇÊ¿äÇÑ ºäÆ÷Æ®ÀÇ »çÀÌÁ °è»êÇÕ´Ï´Ù. |
Object |
getPrototypeCellValue ()
¡¸prototype ¼¿¡¹ÀÇ ¼¿³ÐÀ̸¦ ¸®ÅÏÇÕ´Ï´Ù. |
int |
getScrollableBlockIncrement (Rectangle visibleRect,
int orientation,
int direction)
´ÙÀ½ ¶Ç´Â ÀüÀÇ ºí·ÏÀ» Ç¥½ÃÇϱâ À§Çؼ ½ºÅ©·Ñ ÇÏ´Â °Å¸®¸¦ ¸®ÅÏÇÕ´Ï´Ù. |
boolean |
getScrollableTracksViewportHeight ()
ÀÌ JList ÀÌ JViewport ¿¡ Ç¥½ÃµÇ¾î ºäÆ÷Æ®°¡ JList
ÀûÀýÇÑ ³ôÀ̺¸´Ù ³ôÀº °æ¿ì, ¶Ç´Â ·¹À̾ƿô ¹æÇâÀÌ VERTICAL_WRAP À̸ç, °¡½ÃÇà Ä«¿îÆ®°¡ 0 ¾Æ·¡ÀÇ °æ¿ì´Â true¸¦ ¸®ÅÏÇÕ´Ï´Ù. |
boolean |
getScrollableTracksViewportWidth ()
ÀÌ JList ÀÌ JViewport ¿¡ Ç¥½ÃµÇ¾î ºäÆ÷Æ®°¡ JList
ÀûÀýÇÑ Æøº¸´Ù ³ÐÀº °æ¿ì, ¶Ç´Â ·¹À̾ƿô ¹æÇâÀÌ HORIZONTAL_WRAP À̸ç, °¡½ÃÇà Ä«¿îÆ®°¡ <= 0ÀÎ °æ¿ì´Â true¸¦ ¸®ÅÏÇÕ´Ï´Ù. |
int |
getScrollableUnitIncrement (Rectangle visibleRect,
int orientation,
int direction)
´ÙÀ½ ¶Ç´Â ÀüÀÇ Çà (¼öÁ÷ ½ºÅ©·Ñ) ¶Ç´Â ¿ (¼öÆò ½ºÅ©·Ñ)À» Ç¥½ÃÇϱâ À§Çؼ ½ºÅ©·Ñ ÇÏ´Â °Å¸®¸¦ ¸®ÅÏÇÕ´Ï´Ù. |
int |
getSelectedIndex ()
ÃÖÃÊ·Î ¼±ÅÃµÈ À妽º¸¦ µ¹·ÁÁÖ´ÂÁö, ¼±Åà Ç׸ñÀÌ ¾ø´Â °æ¿ì´Â -1À» ¸®ÅÏÇÕ´Ï´Ù. |
int[] |
getSelectedIndices ()
¼±Åà ¶°³¯ ¼ö ÀÖ¾î ¸ðµç À妽ºÀÇ ½Â¼ø ¹è¿À» ¸®ÅÏÇÕ´Ï´Ù. |
Object |
getSelectedValue ()
ÃÖÃÊ·Î ¼±ÅÃµÈ À妽º¸¦ µ¹·ÁÁÖ´ÂÁö, ¼±ÅÃÀÌ ºñ¾îÀÖ´Â °æ¿ì´Â null À»
¸®ÅÏÇÕ´Ï´Ù. |
Object [] |
getSelectedValues ()
¼±ÅÃµÈ ¼¿ÀÇ °ªÀÇ ¹è¿À» ¸®ÅÏÇÕ´Ï´Ù. |
Color |
getSelectionBackground ()
¼±ÅÃµÈ ¼¿ÀÇ ¹é±×¶ó¿îµå Ä÷¯¸¦ ¸®ÅÏÇÕ´Ï´Ù. |
Color |
getSelectionForeground ()
foreground Ä÷¯ÀÇ ¼±ÅÃÀ» ¸®ÅÏÇÕ´Ï´Ù. |
int |
getSelectionMode ()
´ÜÀÏ Ç׸ñ ¼±Åà ¶Ç´Â º¹¼ö Ç׸ñ ¼±ÅÃÀÇ ¾î´À ÂÊÀÌ Çã¿ë µÇ°í ÀÖÀ»±î¸¦ ¸®ÅÏÇÕ´Ï´Ù. |
ListSelectionModel |
getSelectionModel ()
ÇöÀçÀÇ ¼±Åà ¸ðµ¨ÀÇ °ªÀ» ¸®ÅÏÇÕ´Ï´Ù. |
String |
getToolTipText (MouseEvent event)
JComponent
getToolTipText ¸Þ¼µå¸¦ ¿À¹ö¶óÀ̵å(override) ÇØ, ÅØ½ºÆ® ¼¼Æ®°¡ ÀÖ´Â °æ¿ì, ·»´õ¸µÀÇ ÈùÆ®¸¦ »ç¿ëÇÒ ¼ö ÀÖµµ·Ï ÇÕ´Ï´Ù. |
ListUI |
getUI ()
ÀÌ ÄÄÆÛ³ÍÆ®¸¦ ·»´õ¸µ ÇÏ´Â Look & Feel (L&F) °´Ã¼¸¦ ¸®ÅÏÇÕ´Ï´Ù. |
String |
getUIClassID ()
Look & Feel (L&F) Ŭ·¡½ºÀÇ À̸§ÀÇ ±¸Ãà¿¡ »ç¿ëµÈ Á¢µÎ»ç¸¦ ¸®ÅÏÇÕ´Ï´Ù. |
boolean |
getValueIsAdjusting ()
µ¥ÀÌÅÍ ¸ðµ¨ÀÇ isAdjusting ÇÁ·ÎÆÛƼÀÇ °ªÀ» ¸®ÅÏÇÕ´Ï´Ù. |
int |
getVisibleRowCount ()
°¡½ÃÇàÀÇ ÀûÀýÇÑ ¼ö¸¦ ¸®ÅÏÇÕ´Ï´Ù. |
Point |
indexToLocation (int index)
ÁöÁ¤µÈ Ç׸ñÀÇ JList ÁÂÇ¥¿¡ ÀÖ¾î¼ÀÇ ¿øÁ¡À» ¸®ÅÏÇÕ´Ï´Ù. |
boolean |
isSelectedIndex (int index)
ÁöÁ¤µÈ À妽º°¡ ¼±Åõǰí ÀÖ´Â °æ¿ì´Â true¸¦ ¸®ÅÏÇÕ´Ï´Ù. |
boolean |
isSelectionEmpty ()
¾Æ¹«°Íµµ ¼±ÅõǾî ÀÖÁö ¾ÊÀº °æ¿ì´Â true¸¦ ¸®ÅÏÇÕ´Ï´Ù. |
int |
locationToIndex (Point location)
JList
ÁÂÇ¥»óÀÇ Á¡À» ±× À§Ä¡¿¡ ÀÖ´Â ¼¿ÀÇ À妽º·Î º¯È¯ÇÕ´Ï´Ù. |
protected String |
paramString ()
ÀÌ JList
ij¸¯ÅÍ ¶óÀΠǥÇöÀ» ¸®ÅÏÇÕ´Ï´Ù. |
void |
removeListSelectionListener (ListSelectionListener listener)
¼±ÅÃÀÌ º¯°æµÉ ¶§¸¶´Ù ÅëÁöµÇ´Â ¸®½º³Ê¸¦ ¸®½ºÆ®·ÎºÎÅÍ »èÁ¦ÇÕ´Ï´Ù. |
void |
removeSelectionInterval (int index0,
int index1)
¼±Åà ¹üÀ§¸¦, ÁöÁ¤µÈ ±¸°£°ú ÇöÀçÀÇ ¼±Åà ¹üÀ§¿ÍÀÇ Â÷ÀÌ ÁýÇÕÀ¸·Î ¼³Á¤ÇÕ´Ï´Ù. |
void |
setCellRenderer (ListCellRenderer cellRenderer)
¸®½ºÆ®³»ÀÇ °¢ ¼¿À» ·»´õ¸µ ÇÏ´Â À§¾çÀ» ¼³Á¤ÇÕ´Ï´Ù. |
void |
setDragEnabled (boolean b)
dragEnabled ÇÁ·ÎÆÛƼ¸¦ ¼³Á¤ÇÕ´Ï´Ù. |
void |
setFixedCellHeight (int height)
¸®½ºÆ®¿¡ ÀÖ´Â ¸ðµç ¼¿ÀÇ ³ôÀ̸¦ ¼³Á¤ÇÕ´Ï´Ù. |
void |
setFixedCellWidth (int width)
¸®½ºÆ®¿¡ ÀÖ´Â ¸ðµç ¼¿ÀÇ ³ÐÀ̸¦ ¼³Á¤ÇÕ´Ï´Ù. |
void |
setLayoutOrientation (int layoutOrientation)
¸®½ºÆ®ÀÇ ¼¿ÀÇ ¹èÄ¡ ¹æ¹ýÀ» Á¤ÀÇÇÕ´Ï´Ù. |
void |
setListData (Object [] listData)
Object ¹è¿·ÎºÎÅÍ ListModel À»
±¸ÃàÇØ, setModel À»
Àû¿ëÇÕ´Ï´Ù. |
void |
setListData (Vector <? > listData)
Vector ·Î
ºÎÅÍ ListModel À»
±¸ÃàÇØ, setModel À»
Àû¿ëÇÕ´Ï´Ù. |
void |
setModel (ListModel model)
¸®½ºÆ®ÀÇ ³»¿ë ¶Ç´Â ¡¸°ª¡¹À» ³ªÅ¸³»´Â ¸ðµ¨À» ¼³Á¤ÇØ, PropertyChangeListener ¿¡
ÀÇ ÅëÁö ÈÄ¿¡ ¸®½ºÆ®ÀÇ ¼±Åà ¹üÀ§¸¦ Ŭ¸®¾î ÇÕ´Ï´Ù. |
void |
setPrototypeCellValue (Object prototypeCellValue)
fixedCellWidth ¹× fixedCellHeight ÇÁ·ÎÆÛƼ¸¦ °è»êÇÕ´Ï´Ù. |
void |
setSelectedIndex (int index)
´ÜÀÏ ¼¿À» ¼±ÅÃÇÕ´Ï´Ù. |
void |
setSelectedIndices (int[] indices)
¼¿¼¼Æ®¸¦ ¼±ÅÃÇÕ´Ï´Ù. |
void |
setSelectedValue (Object anObject,
boolean shouldScroll)
ÁöÁ¤µÈ °´Ã¼¸¦ ¸®½ºÆ®·ÎºÎÅÍ ¼±ÅÃÇÕ´Ï´Ù. |
void |
setSelectionBackground (Color selectionBackground)
¼±ÅÃµÈ ¼¿ÀÇ ¹é±×¶ó¿îµå Ä÷¯¸¦ ¼³Á¤ÇÕ´Ï´Ù. |
void |
setSelectionForeground (Color selectionForeground)
¼±ÅÃµÈ ¼¿ÀÇ foreground Ä÷¯¸¦ ¼³Á¤ÇÕ´Ï´Ù. |
void |
setSelectionInterval (int anchor,
int lead)
ÁöÁ¤µÈ ±¸°£À» ¼±ÅÃÇÕ´Ï´Ù. |
void |
setSelectionMode (int selectionMode)
´ÜÀÏ Ç׸ñ ¼±Åà ¶Ç´Â º¹¼ö Ç׸ñ ¼±ÅÃÀÌ °¡´ÉÇѰ¡ ¾î¶²°¡¸¦ ÆÇÁ¤ÇÕ´Ï´Ù. |
void |
setSelectionModel (ListSelectionModel selectionModel)
¸®½ºÆ®ÀÇ selectionModel À»
null ÀÌ ¾Æ´Ñ ListSelectionModel ±¸ÇöÀ¸·Î ¼³Á¤ÇÕ´Ï´Ù. |
void |
setUI (ListUI ui)
ÀÌ ÄÄÆÛ³ÍÆ®¸¦ ·»´õ¸µ ÇÏ´Â Look & Feel (L&F) °´Ã¼¸¦ ¼³Á¤ÇÕ´Ï´Ù. |
void |
setValueIsAdjusting (boolean b)
µ¥ÀÌÅÍ ¸ðµ¨ÀÇ isAdjusting ÇÁ·ÎÆÛƼ¸¦ true ·Î ¼³Á¤ÇØ, ¸ðµç ¼±Åà À̺¥Æ® (¼±Åà ¸ðµå·Î ¸®½ºÆ® Ç׸ñ»óÀ» ¸¶¿ì½º·Î µå·¡±×
Çϰí ÀÖ´Â °æ¿ìµî)°¡ ¿Ï·áÇÑ ½ÃÁ¡¿¡¼ ´ÜÀÏ À̺¥Æ®°¡ »ý¼ºµÇµµ·Ï ÇÕ´Ï´Ù. |
void |
setVisibleRowCount (int visibleRowCount)
½ºÅ©·Ñ ¹Ù¸¦ »ç¿ëÇÏÁö ¾Ê°í Ç¥½ÃÇÒ ¼ö ÀÖ´Â ¸®½ºÆ®³»ÀÇ ÇàÀÇ ÀûÀýÇÑ ¼ö¸¦ ¼³Á¤ÇÕ´Ï´Ù. |
void |
updateUI ()
ÇöÀçÀÇ Look & Feel ·ÎºÎÅÍÀÇ °ªÀ» °¡Áö´Â UI ÇÁ·ÎÆÛƼ¸¦ ¸®¼Â ÇÕ´Ï´Ù. |
Ŭ·¡½º java.lang. Object ·ÎºÎÅÍ »ó¼ÓµÈ ¸Þ¼µå |
---|
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
ÇʵåÀÇ »ó¼¼ |
---|
public static final int VERTICAL
setLayoutOrientation(int)
,
Á¤¼ö Çʵ尪 public static final int VERTICAL_WRAP
setLayoutOrientation(int)
,
Á¤¼ö Çʵ尪 public static final int HORIZONTAL_WRAP
setLayoutOrientation(int)
,
Á¤¼ö Çʵ尪 »ý¼ºÀÚ »ó¼¼ |
---|
public JList(ListModel dataModel)
null
ÀÌ¿ÜÀÇ ¸ðµ¨ÀÇ ¿ä¼Ò¸¦ Ç¥½ÃÇÏ´Â JList
¸¦ ±¸ÃàÇÕ´Ï´Ù. ¸ðµç JList
»ý¼ºÀÚ´Â ÀÌ °´Ã¼¿¡ À§¾ç ÇÕ´Ï´Ù.
dataModel
- ÀÌ ¸®½ºÆ®ÀÇ µ¥ÀÌÅÍ ¸ðµ¨
IllegalArgumentException
- dataModel
°¡ null
ÀÎ °æ¿ìpublic JList(Object [] listData)
JList
¸¦ ±¸ÃàÇÕ´Ï´Ù. ÀÌ »ý¼ºÀÚ´Â ListModel
»ý¼ºÀÚ¿¡ À§¾ç ÇÕ´Ï´Ù.
listData
- µ¥ÀÌÅÍ ¸ðµ¨¿¡ ·Îµå µÇ´Â Object
¹è¿public JList(Vector <? > listData)
Vector
¿ä¼Ò¸¦ Ç¥½ÃÇÏ´Â JList
¸¦ ±¸ÃàÇÕ´Ï´Ù. ÀÌ »ý¼ºÀÚ´Â ListModel
»ý¼ºÀÚ¿¡ À§¾ç ÇÕ´Ï´Ù.
listData
- µ¥ÀÌÅÍ ¸ðµ¨¿¡ ·Îµå µÇ´Â Vector
public JList()
JList
¸¦ ±¸ÃàÇÕ´Ï´Ù.
¸Þ¼µåÀÇ »ó¼¼ |
---|
public ListUI getUI()
ListUI
°´Ã¼public void setUI(ListUI ui)
ui
- ListUI
L&F °´Ã¼UIDefaults.getUI(javax.swing.JComponent)
public void updateUI()
JComponent
³»ÀÇ updateUI
UIManager.getUI(javax.swing.JComponent)
public String getUIClassID()
JComponent
³»ÀÇ getUIClassID
JComponent.getUIClassID()
,
UIDefaults.getUI(javax.swing.JComponent)
public Object getPrototypeCellValue()
prototypeCellValue
ÇÁ·ÎÆÛƼÀÇ °ªsetPrototypeCellValue(java.lang.Object)
public void setPrototypeCellValue(Object prototypeCellValue)
fixedCellWidth
¹× fixedCellHeight
ÇÁ·ÎÆÛƼ¸¦ °è»êÇÕ´Ï´Ù. À妽º 0
cellRenderer
¸¦ ÁöÁ¤Ä¡·Î ¼³Á¤ÇÏ°í ³ª¼, ·»´õ¸µ ÄÄÆÛ³ÍÆ®ÀÇ ¿ì¼± »çÀÌÁ °è»êÇÕ´Ï´Ù. ¸®½ºÆ®°¡ ³Ê¹« ±æ¾î JList
ÀÌ °¢ ¼¿ÀÇ Æø°ú ³ôÀ̸¦ °è»êÇÏÁö ¸øÇϰí, ´Ù¸¥ ¼¿°ú °°Àº ½ºÆäÀ̽º¸¦ °¡Áö´Â °ÍÀ» ¾Ë ¼ö ÀÖ´Â ¼¿ÀÌ ÀÖ´Â °æ¿ì¿¡´Â ÀÌ ÇÁ·ÎÆÛƼ°¡ Æí¸®ÇÕ´Ï´Ù.
fixedCellWidth
¹× fixedCellHeight
ÇÁ·ÎÆÛƼ¸¦ ¿©±â¼ ¼³Á¤Çصµ, prototypeCellValue
¸¸À¸·Î PropertyChangeEvent
ÀÌ Æ®¸®°Å µÇ´Â °Í¿¡ ÁÖÀÇÇØ ÁÖ¼¼¿ä.
ÀÌ ÇÁ·ÎÆÛƼÀÇ ¼³Á¤¿¹¸¦ ÂüÁ¶ÇÏ·Á¸é, »ó±âÀÇ Å¬·¡½ºÀÇ ¼³¸íÀ» ÂüÁ¶ÇϽʽÿÀ.
ÀÌ ÇÁ·ÎÆÛƼÀÇ ±âº»°ª´Â null
ÀÔ´Ï´Ù.
À̰ÍÀº JavaBeans ¹Ù¿îµå ÇÁ·ÎÆÛƼÀÔ´Ï´Ù.
prototypeCellValue
- fixedCellWidth
¹× fixedCellHeight
º£À̽º°¡ µÇ´Â °ªgetPrototypeCellValue()
,
setFixedCellWidth(int)
,
setFixedCellHeight(int)
,
Container.addPropertyChangeListener(java.beans.PropertyChangeListener)
public int getFixedCellWidth()
fixedCellWidth
ÇÁ·ÎÆÛƼ·Î °¡¸®Å°´Â °ªÀÔ´Ï´Ù.
setFixedCellWidth(int)
public void setFixedCellWidth(int width)
width
°¡ -1ÀÎ °æ¿ì, °¢ ¸®½ºÆ® ¿ä¼ÒÀÇ cellRenderer
ÄÄÆÛ³ÍÆ®¿¡ getPreferredSize
¸¦ Àû¿ëÇÏ´Â °ÍÀ¸·Î½á, ¼¿ÆøÀÌ °è»êµË´Ï´Ù.
ÀÌ ÇÁ·ÎÆÛƼÀÇ ±âº»°ª´Â -1 ÀÔ´Ï´Ù.
À̰ÍÀº JavaBeans ¹Ù¿îµå ÇÁ·ÎÆÛƼÀÔ´Ï´Ù.
width
- Çȼ¿ ´ÜÀ§ÀÇ, ¸®½ºÆ®³»ÀÇ ¸ðµç ¼¿ÀÇ ÆøgetPrototypeCellValue()
,
setFixedCellWidth(int)
,
Container.addPropertyChangeListener(java.beans.PropertyChangeListener)
public int getFixedCellHeight()
fixedCellHeight
ÇÁ·ÎÆÛƼ·Î °¡¸®Å°´Â °ªÀÔ´Ï´Ù.
setFixedCellHeight(int)
public void setFixedCellHeight(int height)
height
ÀÌ -1ÀÎ °æ¿ì, °¢ ¸®½ºÆ® ¿ä¼ÒÀÇ cellRenderer
ÄÄÆÛ³ÍÆ®¿¡ getPreferredSize
¸¦ Àû¿ëÇÏ´Â °ÍÀ¸·Î½á, ¼¿ÀÇ ³ôÀ̰¡ °è»êµË´Ï´Ù.
ÀÌ ÇÁ·ÎÆÛƼÀÇ ±âº»°ª´Â -1 ÀÔ´Ï´Ù.
À̰ÍÀº JavaBeans ¹Ù¿îµå ÇÁ·ÎÆÛƼÀÔ´Ï´Ù.
height
- ¸®½ºÆ®³»ÀÇ ¸ðµç ¼¿ÀÇ ³ôÀ̸¦ Çȼ¿¼ö·Î ÁöÁ¤ÇÏ´Â Á¤¼ögetPrototypeCellValue()
,
setFixedCellWidth(int)
,
Container.addPropertyChangeListener(java.beans.PropertyChangeListener)
public ListCellRenderer getCellRenderer()
ListCellRenderer
setCellRenderer(javax.swing.ListCellRenderer)
public void setCellRenderer(ListCellRenderer cellRenderer)
prototypeCellValue
°¡ ¼³Á¤µÇ¾î ÀÖÀ¸¸é, fixedCellWidth
¹× fixedCellHeight
ÇÁ·ÎÆÛƼµµ ¼³Á¤µË´Ï´Ù. ±×·¯³ª, cellRenderer
ÇÁ·ÎÆÛƼ¿¡ ´ëÇØ¼´Â PropertyChangeEvent
´Â 1°³
¸¸ »ý¼ºµË´Ï´Ù.
ÀÌ ÇÁ·ÎÆÛƼÀÇ ±âº»°ª´Â ListUI À§¾ç (Look & Feel ±¸Çö)¿¡ ÀÇÇØ Á¦°øµË´Ï´Ù.
¼¿ ·»´õ¸µÀÇ ¼³Á¤¿¹¸¦ ÂüÁ¶ÇÏ·Á¸é, »ó±âÀÇ Å¬·¡½ºÀÇ ¼³¸íÀ» ÂüÁ¶ÇϽʽÿÀ.
À̰ÍÀº JavaBeans ¹Ù¿îµå ÇÁ·ÎÆÛƼÀÔ´Ï´Ù.
cellRenderer
- ¸®½ºÆ®³»ÀÇ ¼¿À» ·»´õ¸µ ÇÏ´Â ListCellRenderer
getCellRenderer()
public Color getSelectionForeground()
Color
°´Ã¼setSelectionForeground(java.awt.Color)
,
setSelectionBackground(java.awt.Color)
public void setSelectionForeground(Color selectionForeground)
ÀÌ ÇÁ·ÎÆÛƼÀÇ ±âº»°ª´Â Look & Feel ±¸Çö¿¡ ÀÇÇØ Á¤Àǵ˴ϴÙ.
À̰ÍÀº JavaBeans ¹Ù¿îµå ÇÁ·ÎÆÛƼÀÔ´Ï´Ù.
selectionForeground
- ¼±ÅÃµÈ ¸®½ºÆ® Ç׸ñÀÇ foreground·Î »ç¿ëÇÏ´Â Color
getSelectionForeground()
,
setSelectionBackground(java.awt.Color)
,
JComponent.setForeground(java.awt.Color)
,
JComponent.setBackground(java.awt.Color)
,
JComponent.setFont(java.awt.Font)
public Color getSelectionBackground()
Color
setSelectionBackground(java.awt.Color)
,
setSelectionForeground(java.awt.Color)
public void setSelectionBackground(Color selectionBackground)
ÀÌ ÇÁ·ÎÆÛƼÀÇ ±âº»°ª´Â Look & Feel ±¸Çö¿¡ ÀÇÇØ Á¤Àǵ˴ϴÙ.
À̰ÍÀº JavaBeans ¹Ù¿îµå ÇÁ·ÎÆÛƼÀÔ´Ï´Ù.
selectionBackground
- ¼±ÅÃµÈ ¼¿ÀÇ ¹é±×¶ó¿îµå¿¡¼ »ç¿ëÇÏ´Â Color
getSelectionBackground()
,
setSelectionForeground(java.awt.Color)
,
JComponent.setForeground(java.awt.Color)
,
JComponent.setBackground(java.awt.Color)
,
JComponent.setFont(java.awt.Font)
public int getVisibleRowCount()
setVisibleRowCount(int)
public void setVisibleRowCount(int visibleRowCount)
JViewport
»óÀ§ °´Ã¼ (Á¸ÀçÇÏ´Â °æ¿ì¸¸)¿¡
°áÁ¤µË´Ï´Ù. ÀÌ ÇÁ·ÎÆÛƼġ´Â JList
preferredScrollableViewportSize
°ª¿¡°Ô¸¸ ¿µÇâÀ» ÁÝ´Ï´Ù.
ÀÌ ÇÁ·ÎÆÛƼÀÇ ±âº»°ª´Â 8 ÀÔ´Ï´Ù.
À̰ÍÀº JavaBeans ¹Ù¿îµå ÇÁ·ÎÆÛƼÀÔ´Ï´Ù.
visibleRowCount
- °¡½ÃÇàÀÇ ÀûÀýÇÑ ¼ö¸¦ ÁöÁ¤ÇÏ´Â Á¤¼ögetVisibleRowCount()
,
JComponent.getVisibleRect()
,
JViewport
public int getLayoutOrientation()
JList.VERTICAL
, ÄÁÅÙÃ÷°¡ ¼öÁ÷ ¹æÇâÀÇ ´ÙÀ½¿¡ ¼öÆò ¹æÇâÀÇ ¼ø¼¿¡ ÁÙ¼± ¡¸½Å¹® ½ºÅ¸ÀÏ¡¹ÀÇ °æ¿ì´Â JList.VERTICAL_WRAP
, ÄÁÅÙÃ÷°¡ ¼öÆò ¹æÇâÀÇ ´ÙÀ½¿¡ ¼öÁ÷ ¹æÇâÀÇ ¼ø¼¿¡ ÁÙ¼± ¡¸½Å¹® ½ºÅ¸ÀÏ¡¹ÀÇ °æ¿ì´Â JList.HORIZONTAL_WRAP
¸¦ ¸®ÅÏÇÕ´Ï´Ù.
setLayoutOrientation(int)
public void setLayoutOrientation(int layoutOrientation)
JList
ÀÎ °æ¿ì, ´ÙÀ½ÀÇ ¹æ¹ýÀÇ ¾î¶² °ÍÀΰ¡·Î ¹èÄ¡ÇÒ ¼ö ÀÖ½À´Ï´Ù.
0 1 2 3
0 1 2 3
0 2 1 3
À̰͵éÀº ´ÙÀ½ÀÇ °ª¿¡ ´ëÀÀÇÕ´Ï´Ù.
°ª | ¼³¸í |
---|---|
JList.VERTICAL | ¼¿Àº 1°³ÀÇ ¿·Î ¼öÁ÷ ¹æÇâÀ¸·Î ¹èÄ¡µÇ´Â |
JList.HORIZONTAL_WRAP | ¼¿Àº ¼öÆò ¹æÇâÀ¸·Î ¹èÄ¡µÇ¾î Çʿ信 µû¶ó¼ ´ÙÀ½ÀÇ Çà¿¡ µÇÁ¢¾î ²ªÀδÙ. »ç¿ëÇÏ´Â Çà¼ö´Â 0 º¸´Ù Å« °æ¿ì getVisibleRowCount ·Î
Á¤ÀÇµÇ¾î ±×·¸Áö ¾ÊÀº °æ¿ì´Â JList
ÆøÀ¸·Î ÁöÁ¤µÇ´Â |
JList.VERTICAL_WRAP | ¼¿Àº ¼öÁ÷ ¹æÇâÀ¸·Î ¹èÄ¡µÇ¾î Çʿ信 µû¶ó¼ ´ÙÀ½ÀÇ ¿¿¡ µÇÁ¢¾î ²ªÀδÙ. »ç¿ëÇÏ´Â Çà¼ö´Â 0 º¸´Ù Å« °æ¿ì getVisibleRowCount ·Î
Á¤ÀÇµÇ¾î ±×·¸Áö ¾ÊÀº °æ¿ì´Â JList
³ôÀÌ·Î ÁöÁ¤µÇ´Â |
JList.VERTICAL
ÀÔ´Ï´Ù.
layoutOrientation
°¡ JList.HORIZONTAL_WRAP
, JList.VERTICAL
, ¶Ç´Â JList.VERTICAL_WRAP
¾î¶² °Íµµ ¾Æ´Ñ °æ¿ì´Â IllegalArgumentException
°¡ ¹ß»ý µË´Ï´Ù.
layoutOrientation
- »õ·Î¿î orientation. JList.HORIZONTAL_WRAP
, JList.VERTICAL
, ¶Ç´Â JList.VERTICAL_WRAP
°¡¿îµ¥ 1°³
getLayoutOrientation()
,
setVisibleRowCount(int)
,
getScrollableTracksViewportHeight()
public int getFirstVisibleIndex()
componentOrientation
ÇÁ·ÎÆÛƼ¿¡
ÇÕ´Ï´Ù. ¹æÇâÀÌ, ¿ÞÂÊ¿¡¼ ¿À¸¥ÂÊ¿¡ÀÇ ¼öÆò ¹æÇâÀÎ °æ¿ì, ÃÖÃÊÀÇ °¡½Ã ¼¿Àº ¸®½ºÆ®ÀÇ Á»󱸼®ÀÌ µÇ¾î, ±Ý¹æ ´Ù¸¥ °÷À¸·ÎÀÇ ¼öÆò ¹æÇâÀÇ °æ¿ì´Â ¿ì»ó±¸¼®ÀÌ µË´Ï´Ù. ¾î´À ¼¿µµ °¡½Ã°¡ ¾Æ´Ñ °æ¿ì³ª ¸®½ºÆ®°¡ ºñ¾îÀÖ´Â °æ¿ì¿¡´Â -1À» ¸®ÅÏÇÕ´Ï´Ù. ¸®ÅÏµÈ ¼¿Àº ºÎºÐÀûÀ¸·Î °¡½Ã¿¡¼µµ ±¦Âú½À´Ï´Ù.
getLastVisibleIndex()
,
JComponent.getVisibleRect()
public int getLastVisibleIndex()
componentOrientation
ÇÁ·ÎÆÛƼ¿¡
ÇÕ´Ï´Ù. ¹æÇâÀÌ, ¿ÞÂÊ¿¡¼ ¿À¸¥ÂÊ¿¡ÀÇ ¼öÆò ¹æÇâÀÎ °æ¿ì, ¸¶Áö¸· °¡½Ã ¼¿Àº JList
¿ìÇϱ¸¼®ÀÌ µÇ¾î, ±Ý¹æ ´Ù¸¥ °÷À¸·ÎÀÇ ¼öÆò ¹æÇâÀÇ °æ¿ì´Â ¿ÞÂÊ ÇÏ´Ü ¸ð¼¸®°¡ µË´Ï´Ù. ¾î´À ¼¿µµ °¡½Ã°¡ ¾Æ´Ñ °æ¿ì³ª ¸®½ºÆ®°¡ ºñ¾îÀÖ´Â °æ¿ì¿¡´Â -1À» ¸®ÅÏÇÕ´Ï´Ù. ¸®ÅÏµÈ ¼¿Àº ºÎºÐÀûÀ¸·Î °¡½Ã¿¡¼µµ ±¦Âú½À´Ï´Ù.
getFirstVisibleIndex()
,
JComponent.getVisibleRect()
public void ensureIndexIsVisible(int index)
JViewport
³»¿¡¼ JList
¸¦ Ç¥½ÃÇÒ Çʿ䰡 ÀÖ½À´Ï´Ù.
index
- °¡½Ã·Î ÇÏ´Â ¼¿ÀÇ À妽ºJComponent.scrollRectToVisible(java.awt.Rectangle)
,
JComponent.getVisibleRect()
public void setDragEnabled(boolean b)
dragEnabled
ÇÁ·ÎÆÛƼ¸¦ ¼³Á¤ÇÕ´Ï´Ù. ÀÌ ÇÁ·ÎÆÛƼ´Â ÀÌ ÄÄÆÛ³ÍÆ®ÀÇ ÀÚµ¿ µå·¡±×
ó¸® (µå·¡±×£¦µå·ÓÀÇ ÃÖÃÊÀÇ Ã³¸®)¸¦ À¯È¿ÇÏ°Ô Çϱâ À§Çؼ true
°¡ µÇ¾î ÀÖÀ» Çʿ䰡 ÀÖ½À´Ï´Ù. transferHandler
ÇÁ·ÎÆÛƼ´Â µå·¡±×
·Î ¹¹µçÁö ÇÒ ¼ö ÀÖµµ·Ï null
ÀÌ¿ÜÀÇ °ªÀ¸·Î ¼³Á¤ÇÒ Çʿ䰡 ÀÖ½À´Ï´Ù. dragEnabled
ÇÁ·ÎÆÛƼÀÇ µðÆúÆ®ÀÇ °ªÀº false
ÀÔ´Ï´Ù.
ÀÚµ¿ µå·¡±×
󸮰¡ À¯È¿ÀÇ °æ¿ì, ´ëºÎºÐÀÇ Look & Feel´Â
»ç¿ëÀÚ°¡ ¼±ÅÃÀ» À§Çؼ mouse button¸¦ ´·¯, ¸¶¿ì½º¸¦ ¼öÇȼ¿ À̵¿Çϸé Ç×»ó µå·¡±×£¦µå·Ó Á¶ÀÛÀÌ ½ÃÀ۵˴ϴÙ. µû¶ó¼, ÀÌ ÇÁ·ÎÆÛƼ¸¦ true
·Î
¼³Á¤ÇÏ´Â °ÍÀ¸·Î½á, ¼±ÅÃÀÇ µ¿ÀÛ¿¡ ¹Ì¹¦ÇÑ È¿°ú°¡ ÀÖ½À´Ï´Ù.
ÀϺÎÀÇ Look & Feel´Â ÀÚµ¿ µå·¡±×£¦µå·Ó Á¶ÀÛÀ» Áö¿ø
ÇÏÁö ¾Ê´Â °æ¿ì°¡ ÀÖ½À´Ï´Ù. À̰͵éÀº ÀÌ ÇÁ·ÎÆÛƼ¸¦ ¹«½ÃÇÕ´Ï´Ù. Á÷Á¢ TransferHandler
exportAsDrag
¸Þ¼µå¸¦ È£ÃâÇØ ÄÄÆÛ³ÍÆ®¸¦ º¯°æÇÏ´Â °ÍÀ¸·Î½á, ÀÌ·¯ÇÑ Look & Feel¸¦ Á¶ÀÛÇÒ ¼ö ÀÖ½À´Ï´Ù
.
b
- dragEnabled
ÇÁ·ÎÆÛƼ·Î ¼³Á¤µÇ´Â °ª
HeadlessException
- b
°¡ true
ÀÎ °æ¿ì·Î GraphicsEnvironment.isHeadless()
°¡ true
¸¦ µ¹·ÁÁÖ´Â °æ¿ìGraphicsEnvironment.isHeadless()
,
getDragEnabled()
,
JComponent.setTransferHandler(javax.swing.TransferHandler)
,
TransferHandler
public boolean getDragEnabled()
dragEnabled
ÇÁ·ÎÆÛƼ¸¦ ÃëµæÇÕ´Ï´Ù.
dragEnabled
ÇÁ·ÎÆÛƼÀÇ °ªsetDragEnabled(boolean)
public int getNextMatch(String prefix, int startIndex, Position.Bias bias)
prefix
- ÀÏÄ¡¸¦ Å×½ºÆ®Çϴ ij¸¯ÅÍ ¶óÀÎstartIndex
- °Ë»öÀ» °³½ÃÇÏ´Â À妽ºbias
- °Ë»ö ¹æÇâ. Position.Bias.Forward ¶Ç´Â Position.Bias.Backward
IllegalArgumentException
- Á¢µÎ»ç°¡ null ¶Ç´Â startIndex°¡ ¹üÀ§¿Ü¿¡ ÀÖ´Â °æ¿ìpublic String getToolTipText(MouseEvent event)
JComponent
getToolTipText
¸Þ¼µå¸¦ ¿À¹ö¶óÀ̵å(override) ÇØ, ÅØ½ºÆ® ¼¼Æ®°¡ ÀÖ´Â °æ¿ì, ·»´õ¸µÀÇ ÈùÆ®¸¦ »ç¿ëÇÒ ¼ö ÀÖµµ·Ï ÇÕ´Ï´Ù.
JList
ÀÌ ·»´õ¸µÀÇ Åø ÈùÆ®¸¦ ÀûÀýÈ÷ Ç¥½ÃÇÒ ¼ö ÀÖµµ·Ï ÇÏ·Á¸é,
JList
´Â ToolTipManager
¿¡ µî·ÏÀ» ¸¶Ä£ ÄÄÆÛ³ÍÆ®°¡ ¾Æ´Ï¸é ¾ÈµË´Ï´Ù. À̰ÍÀº »ý¼ºÀÚ
À¸·Î ÀÚµ¿ÀûÀ¸·Î ÇàÇØÁý´Ï´Ù¸¸, ³ªÁß¿¡ JList
¿¡ setToolTipText(null)
¸¦ ÅëÁöÇϸé, ¸®½ºÆ® ÄÄÆÛ³ÍÆ®¸¦ µî·Ï ÇØÁ¦ÇϹǷΠ·»´õ¸µÀ¸·ÎºÎÅÍÀÇ ÈùÆ®´Â ±× ÀÌ»ó Ç¥½ÃµÇÁö ¾Ê½À´Ï´Ù.
JComponent
³»ÀÇ getToolTipText
JComponent.getToolTipText()
public int locationToIndex(Point location)
JList
ÁÂÇ¥»óÀÇ Á¡À» ±× À§Ä¡¿¡ ÀÖ´Â ¼¿ÀÇ À妽º·Î º¯È¯ÇÕ´Ï´Ù. ¼¿ÀÌ ½ÇÁ¦·Î ±× À§Ä¡¸¦ Æ÷ÇÔÇÒÁö ¾î¶³Áö¸¦ ÆÇÁ¤ÇÏ·Á¸é,
ÀÌ ¸Þ¼µå¿Í getCellBounds
¸¦ Á¶ÇÕÇØ »ç¿ëÇÕ´Ï´Ù. ¸ðµ¨ÀÌ ºñ¾îÀÖ´Â °æ¿ì´Â -1À» ¸®ÅÏÇÕ´Ï´Ù.
location
- JList
¿¡ °ü·ÃÇÑ ¼¿ÀÇ ÁÂÇ¥
public Point indexToLocation(int index)
JList
ÁÂÇ¥¿¡ ÀÖ¾î¼ÀÇ ¿øÁ¡À» ¸®ÅÏÇÕ´Ï´Ù. index
°¡ ¹«È¿ÀÎ °æ¿ì´Â null
À»
¸®ÅÏÇÕ´Ï´Ù.
index
- JList
¼¿ÀÇ À妽º
public Rectangle getCellBounds(int index0, int index1)
JList
ÁÂÇ¥·Î ÁöÁ¤µÈ Ç׸ñ ¹üÀ§ÀÇ °æ°è¸¦ ¸®ÅÏÇÕ´Ï´Ù. À妽º°¡ ¹«È¿ÀÎ °æ¿ì´Â null
À»
¸®ÅÏÇÕ´Ï´Ù.
index0
- ¹üÀ§³»ÀÇ ÃÖÃÊÀÇ JList
¼¿ÀÇ À妽ºindex1
- ¹üÀ§³»ÀÇ ¸¶Áö¸· JList
¼¿ÀÇ À妽º
public ListModel getModel()
JList
ÄÄÆÛ³ÍÆ®¿¡ ÀÇÇØ Ç¥½ÃµÇ´Â Ç׸ñÀÇ ¸®½ºÆ®¸¦ º¸°ü À¯ÁöÇÏ´Â µ¥ÀÌÅÍ ¸ðµ¨À» ¸®ÅÏÇÕ´Ï´Ù.
ListModel
setModel(javax.swing.ListModel)
public void setModel(ListModel model)
PropertyChangeListener
¿¡
ÀÇ ÅëÁö ÈÄ¿¡ ¸®½ºÆ®ÀÇ ¼±Åà ¹üÀ§¸¦ Ŭ¸®¾î ÇÕ´Ï´Ù.
À̰ÍÀº JavaBeans ¹Ù¿îµå ÇÁ·ÎÆÛƼÀÔ´Ï´Ù.
model
- Ç¥½ÃµÇ´Â Ç׸ñÀÇ ¸®½ºÆ®¸¦ Á¦°øÇÏ´Â ListModel
IllegalArgumentException
- model
°¡ null
ÀÎ °æ¿ìgetModel()
public void setListData(Object [] listData)
ListModel
À»
±¸ÃàÇØ, setModel
À»
Àû¿ëÇÕ´Ï´Ù.
listData
- ¸®½ºÆ®¿¡ Ç¥½ÃÇÏ´Â Ç׸ñÀ» º¸°ü À¯ÁöÇÏ´Â Object
¹è¿setModel(javax.swing.ListModel)
public void setListData(Vector <? > listData)
Vector
·Î
ºÎÅÍ ListModel
À»
±¸ÃàÇØ, setModel
À»
Àû¿ëÇÕ´Ï´Ù.
listData
- ¸®½ºÆ®¿¡ Ç¥½ÃÇÏ´Â Ç׸ñÀ» º¸°ü À¯ÁöÇÏ´Â Vector
setModel(javax.swing.ListModel)
protected ListSelectionModel createSelectionModel()
DefaultListSelectionModel
ÀνºÅϽº¸¦ ¸®ÅÏÇÕ´Ï´Ù. ÀÌ ¸Þ¼µå´Â »ý¼ºÀÚ°¡ selectionModel
ÇÁ·ÎÆÛƼ¸¦ ÃʱâÈÇϴµ¥ »ç¿ëÇÕ´Ï´Ù.
JList
ÀÌ »ç¿ëÇÏ´Â ListSelectionModel
setSelectionModel(javax.swing.ListSelectionModel)
,
DefaultListSelectionModel
public ListSelectionModel getSelectionModel()
ListSelectionModel
setSelectionModel(javax.swing.ListSelectionModel)
,
ListSelectionModel
protected void fireSelectionValueChanged(int firstIndex, int lastIndex, boolean isAdjusting)
JList
ListSelectionListener
¿¡ ÅëÁöÇÕ´Ï´Ù. ÀÌ ¸Þ¼µå´Â ListSelectionEvent
¸¦ selectionModel
·Î
ºÎÅÍ, Á÷Á¢ JList
¿¡ Ãß°¡µÈ ListSelectionListener
¿¡ Àü¼Û Çϱâ À§Çؼ »ç¿ëµË´Ï´Ù.
firstIndex
- ¼±Åõǰí ÀÖ´Â ÃÖÃÊÀÇ À妽ºlastIndex
- ¼±Åõǰí ÀÖ´Â ¸¶Áö¸· À妽ºisAdjusting
- º¹¼öÀÇ º¯°æÀ» ÇßÀ» °æ¿ì´Â trueaddListSelectionListener(javax.swing.event.ListSelectionListener)
,
removeListSelectionListener(javax.swing.event.ListSelectionListener)
,
EventListenerList
public void addListSelectionListener(ListSelectionListener listener)
JList
¿¡ Á÷Á¢ Ãß°¡µÇ´Â ¸®½º³Ê´Â (ListSelectionModel
´ë½Å¿¡) ListSelectionEvent.getSource()
(ÀÌ JList)¸¦ °¡Áý´Ï´Ù.
listener
- Ãß°¡ÇÏ´Â ListSelectionListener
getSelectionModel()
,
getListSelectionListeners()
public void removeListSelectionListener(ListSelectionListener listener)
listener
- »èÁ¦ÇÏ´Â ListSelectionListener
addListSelectionListener(javax.swing.event.ListSelectionListener)
,
getSelectionModel()
public ListSelectionListener [] getListSelectionListeners()
ListSelectionListener
¹è¿À» ¸®ÅÏÇÕ´Ï´Ù.
ListSelectionListener
. Ãß°¡µÈ ¸®½º³Ê°¡ ¾ø´Â °æ¿ì´Â ºñ¾îÀÖ´Â ¹è¿addListSelectionListener(javax.swing.event.ListSelectionListener)
public void setSelectionModel(ListSelectionModel selectionModel)
selectionModel
À»
null
ÀÌ ¾Æ´Ñ ListSelectionModel
±¸ÇöÀ¸·Î ¼³Á¤ÇÕ´Ï´Ù. ¼±Åà ¸ðµ¨Àº ´ÜÀÏ ¼±ÅÃ, ÀÎÁ¢ÇÑ ¹üÀ§ÀÇ ¼±Åà ¹× ºñÀÎÁ¢ ¼±ÅÃÀ» ÀÛ¼ºÇϴ ŽºÅ©¸¦ ó¸®ÇÕ´Ï´Ù.
À̰ÍÀº JavaBeans ¹Ù¿îµå ÇÁ·ÎÆÛƼÀÔ´Ï´Ù.
selectionModel
- ¼±ÅÃÀ» ±¸ÇöÇÏ´Â ListSelectionModel
IllegalArgumentException
- selectionModel
°¡ null
ÀÎ °æ¿ìgetSelectionModel()
public void setSelectionMode(int selectionMode)
selectionMode
°ªÀ» ÁöÁ¤ÇÒ ¼ö ÀÖ½À´Ï´Ù. ListSelectionModel.SINGLE_SELECTION
- 1ȸ¿¡ 1°³ÀÇ ¸®½ºÆ® À妽º¸¸À» ¼±ÅÃÇÒ ¼ö ÀÖ½À´Ï´Ù. ÀÌ ¸ðµå¿¡¼´Â setSelectionInterval
¹× addSelectionInterval
¸Þ¼µå´Â µ¿µîÀÌ µÇ¾î, 2¹øÂ°ÀÇ À妽º Àμö¸¸ÀÌ »ç¿ëµË´Ï´Ù. ListSelectionModel.SINGLE_INTERVAL_SELECTION
- ¿¬¼ÓÇÏ´Â À妽º ±¸°£À» 1ȸ¿¡ 1°³
¼±ÅÃÇÒ ¼ö ÀÖ½À´Ï´Ù. ÀÌ ¸ðµå¿¡¼´Â setSelectionInterval
¸Þ¼µå¿Í addSelectionInterval
¸Þ¼µå´Â µ¿µîÇÕ´Ï´Ù. ListSelectionModel.MULTIPLE_INTERVAL_SELECTION
- ÀÌ ¸ðµå¿¡¼´Â ¼±Åà ´ë»óÀ¸·Î Á¦ÇÑÀº ¾ø½À´Ï´Ù. À̰ÍÀÌ µðÆúÆ®ÀÔ´Ï´Ù.
selectionMode
- °¡´ÉÇÑ ¼±Åà ŸÀÔÀ» ÁöÁ¤ÇÏ´Â Á¤¼ögetSelectionMode()
public int getSelectionMode()
selectionMode
ÇÁ·ÎÆÛƼÀÇ °ªsetSelectionMode(int)
public int getAnchorSelectionIndex()
addSelectionModel
¶Ç´Â setSelectionInterval
È£ÃâÇØ¿¡ ÀÖ¾î¼ÀÇ ÃÖÃÊÀÇ À妽º Àμö¸¦ ¸®ÅÏÇÕ´Ï´Ù. selectionModel
¿¡ À§¾ç ÇÏ´Â °£ÀÌ ¸Þ¼µåÀÔ´Ï´Ù.
ListSelectionModel.getAnchorSelectionIndex()
,
addSelectionInterval(int, int)
,
setSelectionInterval(int, int)
,
addListSelectionListener(javax.swing.event.ListSelectionListener)
public int getLeadSelectionIndex()
addSelectionInterval
¶Ç´Â setSelectionInterval
È£ÃâÇØ¿¡ ÀÖ¾î¼ÀÇ 2¹øÂ°ÀÇ À妽º Àμö¸¦ ¸®ÅÏÇÕ´Ï´Ù. selectionModel
¿¡ À§¾ç ÇÏ´Â °£ÀÌ ¸Þ¼µåÀÔ´Ï´Ù.
ListSelectionModel.getLeadSelectionIndex()
,
addSelectionInterval(int, int)
,
setSelectionInterval(int, int)
,
addListSelectionListener(javax.swing.event.ListSelectionListener)
public int getMinSelectionIndex()
selectionModel
¿¡ À§¾ç ÇÏ´Â °£ÀÌ ¸Þ¼µåÀÔ´Ï´Ù.
ListSelectionModel.getMinSelectionIndex()
,
addListSelectionListener(javax.swing.event.ListSelectionListener)
public int getMaxSelectionIndex()
selectionModel
¿¡ À§¾ç ÇÏ´Â °£ÀÌ ¸Þ¼µåÀÔ´Ï´Ù.
ListSelectionModel.getMaxSelectionIndex()
,
addListSelectionListener(javax.swing.event.ListSelectionListener)
public boolean isSelectedIndex(int index)
selectionModel
¿¡ À§¾ç ÇÏ´Â °£ÀÌ ¸Þ¼µåÀÔ´Ï´Ù.
index
- ¼±Åà »óŰ¡ Á¶È¸µÇ´Â À妽º
ListSelectionModel.isSelectedIndex(int)
,
setSelectedIndex(int)
,
addListSelectionListener(javax.swing.event.ListSelectionListener)
public boolean isSelectionEmpty()
selectionModel
¿¡ À§¾ç ÇÏ´Â °£ÀÌ ¸Þ¼µåÀÔ´Ï´Ù.
ListSelectionModel.isSelectionEmpty()
,
clearSelection()
,
addListSelectionListener(javax.swing.event.ListSelectionListener)
public void clearSelection()
isSelectionEmpty
´Â true¸¦ ¸®ÅÏÇÕ´Ï´Ù. selectionModel
¿¡ À§¾ç ÇÏ´Â °£ÀÌ ¸Þ¼µåÀÔ´Ï´Ù.
ListSelectionModel.clearSelection()
,
isSelectionEmpty()
,
addListSelectionListener(javax.swing.event.ListSelectionListener)
public void setSelectionInterval(int anchor, int lead)
anchor
¹× lead
À妽º°¡ Æ÷ÇԵ˴ϴÙ. anchor
°¡ lead
º¸´Ù ÀÛÁö ¾Ê¾Æµµ ±¦Âú½À´Ï´Ù. selectionModel
¿¡ À§¾ç ÇÏ´Â °£ÀÌ ¸Þ¼µåÀÔ´Ï´Ù. anchor
¶Ç´Â lead
°¡ -1ÀÎ °æ¿ì, DefaultListSelectionModel
±¸ÇöÀº ¾Æ¹«°Íµµ ½Ç½ÃÇÏÁö ¾Ê½À´Ï´Ù. anchor
¶Ç´Â lead
°¡ -1 ¹Ì¸¸ÀÇ °æ¿ì, IndexOutOfBoundsException
°¡ ¹ß»ý µË´Ï´Ù.
anchor
- ¼±ÅÃÇÏ´Â ÃÖÃÊÀÇ À妽ºlead
- ¼±ÅÃÇÏ´Â ¸¶Áö¸· À妽º
IndexOutOfBoundsException
- anchor
¶Ç´Â lead
°¡ -1 ¹Ì¸¸ÀÇ °æ¿ìListSelectionModel.setSelectionInterval(int, int)
,
addSelectionInterval(int, int)
,
removeSelectionInterval(int, int)
,
addListSelectionListener(javax.swing.event.ListSelectionListener)
public void addSelectionInterval(int anchor, int lead)
selectionModel
¿¡ À§¾ç ÇÏ´Â °£ÀÌ ¸Þ¼µåÀÔ´Ï´Ù. anchor
¶Ç´Â lead
°¡ -1ÀÎ °æ¿ì, DefaultListSelectionModel
±¸ÇöÀº ¾Æ¹«°Íµµ ½Ç½ÃÇÏÁö ¾Ê½À´Ï´Ù. anchor
¶Ç´Â lead
°¡ -1 ¹Ì¸¸ÀÇ °æ¿ì, IndexOutOfBoundsException
°¡ ¹ß»ý µË´Ï´Ù.
anchor
- ¼±Åÿ¡ Ãß°¡ÇÏ´Â ÃÖÃÊÀÇ À妽ºlead
- ¼±Åÿ¡ Ãß°¡ÇÏ´Â ¸¶Áö¸· À妽º
IndexOutOfBoundsException
- anchor
¶Ç´Â lead
°¡ -1 ¹Ì¸¸ÀÇ °æ¿ìListSelectionModel.addSelectionInterval(int, int)
,
setSelectionInterval(int, int)
,
removeSelectionInterval(int, int)
,
addListSelectionListener(javax.swing.event.ListSelectionListener)
public void removeSelectionInterval(int index0, int index1)
index0
¹× index1
À妽º°¡ »èÁ¦µË´Ï´Ù. index0
°¡ index1
º¸´Ù ÀÛÁö ¾Ê¾Æµµ ±¦Âú½À´Ï´Ù. selectionModel
¿¡ À§¾ç ÇÏ´Â °£ÀÌ ¸Þ¼µåÀÔ´Ï´Ù. index0
¶Ç´Â index1
°¡ -1ÀÎ °æ¿ì, DefaultListSelectionModel
±¸ÇöÀº ¾Æ¹«°Íµµ ½Ç½ÃÇÏÁö ¾Ê½À´Ï´Ù. index0
¶Ç´Â index1
°¡ -1 ¹Ì¸¸ÀÇ °æ¿ì, IndexOutOfBoundsException
°¡ ¹ß»ý µË´Ï´Ù.
index0
- ¼±ÅÃÀ¸·ÎºÎÅÍ »èÁ¦ÇÏ´Â ÃÖÃÊÀÇ À妽ºindex1
- ¼±ÅÃÀ¸·ÎºÎÅÍ »èÁ¦ÇÏ´Â ¸¶Áö¸· À妽º
IndexOutOfBoundsException
- index0
¶Ç´Â index1
°¡ -1 ¹Ì¸¸ÀÇ °æ¿ìListSelectionModel.removeSelectionInterval(int, int)
,
setSelectionInterval(int, int)
,
addSelectionInterval(int, int)
,
addListSelectionListener(javax.swing.event.ListSelectionListener)
public void setValueIsAdjusting(boolean b)
isAdjusting
ÇÁ·ÎÆÛƼ¸¦ true ·Î ¼³Á¤ÇØ, ¸ðµç ¼±Åà À̺¥Æ® (¼±Åà ¸ðµå·Î ¸®½ºÆ® Ç׸ñ»óÀ» ¸¶¿ì½º·Î µå·¡±×
Çϰí ÀÖ´Â °æ¿ìµî)°¡ ¿Ï·áÇÑ ½ÃÁ¡¿¡¼ ´ÜÀÏ À̺¥Æ®°¡ »ý¼ºµÇµµ·Ï ÇÕ´Ï´Ù.
b
- ÇÁ·ÎÆÛƼġÀÇ boolean Ä¡ListSelectionModel.setValueIsAdjusting(boolean)
public boolean getValueIsAdjusting()
isAdjusting
ÇÁ·ÎÆÛƼÀÇ °ªÀ» ¸®ÅÏÇÕ´Ï´Ù. º¹¼öÀÇ º¯°æÀ» Çϰí ÀÖ´Â °æ¿ì¿¡´Â true¸¦ ¸®ÅÏÇÕ´Ï´Ù.
ListSelectionModel.getValueIsAdjusting()
public int[] getSelectedIndices()
removeSelectionInterval(int, int)
,
addListSelectionListener(javax.swing.event.ListSelectionListener)
public void setSelectedIndex(int index)
index
- ¼±ÅÃÇÏ´Â ´ÜÀÏ ¼¿ÀÇ À妽ºListSelectionModel.setSelectionInterval(int, int)
,
isSelectedIndex(int)
,
addListSelectionListener(javax.swing.event.ListSelectionListener)
public void setSelectedIndices(int[] indices)
indices
- ¼±ÅÃÇÏ´Â ¼¿ÀÇ À妽ºÀÇ ¹è¿ListSelectionModel.addSelectionInterval(int, int)
,
isSelectedIndex(int)
,
addListSelectionListener(javax.swing.event.ListSelectionListener)
public Object [] getSelectedValues()
isSelectedIndex(int)
,
getModel()
,
addListSelectionListener(javax.swing.event.ListSelectionListener)
public int getSelectedIndex()
getMinSelectionIndex
°ªgetMinSelectionIndex()
,
addListSelectionListener(javax.swing.event.ListSelectionListener)
public Object getSelectedValue()
null
À»
¸®ÅÏÇÕ´Ï´Ù.
getMinSelectionIndex()
,
getModel()
,
addListSelectionListener(javax.swing.event.ListSelectionListener)
public void setSelectedValue(Object anObject, boolean shouldScroll)
anObject
- ¼±ÅÃÇÏ´Â °´Ã¼shouldScroll
- °´Ã¼°¡ Á¸ÀçÇØ, ¸®½ºÆ®¸¦ ½ºÅ©·ÑÀÇÇØ ¼±ÅÃÇÑ °´Ã¼¸¦ Ç¥½ÃÇÏ´Â °æ¿ì´Â true. ±×·¸Áö ¾ÊÀº °æ¿ì´Â falsepublic Dimension getPreferredScrollableViewportSize()
visibleRowCount
ÇàÀ» Ç¥½ÃÇϱâ À§Çؼ ÇÊ¿äÇÑ ºäÆ÷Æ®ÀÇ »çÀÌÁ °è»êÇÕ´Ï´Ù. fixedCellWidth
¹× fixedCellHeight
ÇÁ·ÎÆÛƼ°¡ °¡¸®Å°´Â °æ¿ì¿¡´Â ÀÌ »çÀÌÁî´Â ºÐ¸íÇÕ´Ï´Ù. ÀÌ·¯ÇÑ ÇÁ·ÎÆÛƼġ´Â prototypeCellValue
ÇÁ·ÎÆÛƼ¿¡ ÀÇÇØ ¾Ï¹¬À¸·Î ÁöÁ¤µÇ´Â Àϵµ ÀÖ½À´Ï´Ù. fixedCellWidth
°¡ ÁöÁ¤µÇ¾î ÀÖÁö ¾ÊÀº °æ¿ì¿¡´Â ÀÌ »çÀÌÁî´Â °¡Àå ÆøÀÇ ³ÐÀº ¸®½ºÆ® ¿ä¼Ò¸¦ ã¾Æ³»´Â °Í¿¡ ÀÇÇØ °è»êµË´Ï´Ù. fixedCellHeight
ÀÌ ÁöÁ¤µÇ¾î ÀÖÁö ¾ÊÀº °æ¿ì¿¡´Â ´ÙÀ½°ú °°ÀÌÀÇÇØ ÈÞ¸®½ºÆ½¿¡ °áÂøµË´Ï´Ù. visibleRowCount
¿¡ ÀÇÇØ °ö¼ÀÇÕ´Ï´Ù. JList.getModel(). getSize() == 0
À̸é), °¡½ÃÇà ±Ùó 16 Çȼ¿À» ÇÒ´çÇØ Æø¿¡ (fixedCellWidth
°¡ ¼³Á¤µÇ¾î ÀÖÁö ¾ÊÀ¸¸é) 256 Çȼ¿À» ÇÒ´çÇØ ÃÖ¼±ÀÇ °á°ú¸¦ ±â´ëÇÕ´Ï´Ù.
VERTICAL
°¡ ¾Æ´Ñ °æ¿ì, getPreferredSize
·Î
ºÎÅÍÀÇ °ªÀ» ¸®ÅÏÇÕ´Ï´Ù. ÇöÀçÀÇ ListUI
¿¡
ÀÇÇØ ÀûÀýÇÑ °ªÀ» µ¹·ÁÁÖµµ·Ï
getPreferredSize
°¡ ¿À¹ö¶óÀ̵å(override) µÇ´Â °ÍÀÌ ¿¹»óµË´Ï´Ù.
Scrollable
³»ÀÇ getPreferredScrollableViewportSize
visibleRowCount
ÇàÀÇ Ç¥½Ã¿¡ ÇÊ¿äÇÑ ºäÆ÷Æ®ÀÇ »çÀÌÁ Æ÷ÇÔÇÑ Å©±âgetPreferredScrollableViewportSize()
,
setPrototypeCellValue(java.lang.Object)
public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction)
¼öÆò ¹æÇâÀÇ ½ºÅ©·Ñ¿¡¼´Â ¸®½ºÆ®°¡ ¼öÁ÷ ¹æÇâÀ¸·Î ¹èÄ¡µÇ°í ÀÖ´Â (orientation°¡ VERTICAL
) °æ¿ì, ¸®½ºÆ®ÀÇ font size°¡ ¸®Åϵ˴ϴÙ
. ÆùÆ®°¡ null
ÀÎ °æ¿ì´Â 1 ÀÌ ¸®Åϵ˴ϴÙ
.
visibleRect
°ªÀº, this.getVisibleRect()
¿Í
°°Áö ¾ÊÀ¸¸é ¾ÈµË´Ï´Ù.
Scrollable
³»ÀÇ getScrollableUnitIncrement
visibleRect
- °¡½Ã ±¸Çüorientation
- HORIZONTAL ¶Ç´Â VERTICALdirection
- 0 ¾Æ·¡ÀÇ °æ¿ì´Â À§¿¡ ½ºÅ©·Ñ, 0 º¸´Ù Å« °æ¿ì´Â ¾Æ·¡¿¡ ½ºÅ©·Ñ
IllegalArgumentException
- visibleRect°¡ null
ÀÎ °æ¿ì, ȤÀº orientation°¡ SwingConstants.VERTICAL ¶Ç´Â SwingConstants.HORIZONTAL
¾î´À ÂÊÀÎÁö ³ª¿ÀÁö ¾Ê´Â °æ¿ìScrollable.getScrollableUnitIncrement(java.awt.Rectangle, int, int)
public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction)
direction
°¡ 0 º¸´Ù Å©´Ù) °æ¿ì´Â ¸¶Áö¸· °¡½Ã ¿ä¼Ò°¡ ÃÖÃÊÀÇ ¿ÏÀüÇÑ °¡½Ã ¿ä¼Ò°¡ µÈ´Ù
¼öÆò ¹æÇâÀÇ ½ºÅ©·Ñ¿¡´Â ¸®½ºÆ®°¡ ¼öÆò ¹æÇâÀ¸·Î ¹èÄ¡µÇ°í ÀÖ´Â °æ¿ì (orientation°¡ VERTICAL_WRAP
¶Ç´Â HORIZONTAL_WRAP
), ´ÙÀ½ÀÇ ·êÀ» »ç¿ëÇÕ´Ï´Ù.
direction
°¡ 0 º¸´Ù Å©´Ù) °æ¿ì´Â ¸¶Áö¸· °¡½Ã ¿ä¼Ò°¡ ÃÖÃÊÀÇ ¿ÏÀüÇÑ °¡½Ã ¿ä¼Ò°¡ µÈ´Ù¸®½ºÆ®°¡ ¼öÁ÷ ¹æÇâÀ¸·Î ¹èÄ¡µÇ°í ÀÖ´Â °æ¿ì´Â visibleRect.width¸¦ ¸®ÅÏÇÕ´Ï´Ù.
visibleRect
°ªÀº, this.getVisibleRect()
¿Í
°°Áö ¾ÊÀ¸¸é ¾ÈµË´Ï´Ù.
Scrollable
³»ÀÇ getScrollableBlockIncrement
visibleRect
- °¡½Ã ±¸Çüorientation
- HORIZONTAL ¶Ç´Â VERTICALdirection
- 0 ¾Æ·¡ÀÇ °æ¿ì´Â À§¿¡ ½ºÅ©·Ñ, 0 º¸´Ù Å« °æ¿ì´Â ¾Æ·¡¿¡ ½ºÅ©·Ñ
IllegalArgumentException
- visibleRect°¡ null
ÀÎ °æ¿ì, ȤÀº orientation°¡ SwingConstants.VERTICAL ¶Ç´Â SwingConstants.HORIZONTAL
¾î´À ÂÊÀÎÁö ³ª¿ÀÁö ¾Ê´Â °æ¿ìScrollable.getScrollableUnitIncrement(java.awt.Rectangle, int, int)
public boolean getScrollableTracksViewportWidth()
JList
ÀÌ JViewport
¿¡ Ç¥½ÃµÇ¾î ºäÆ÷Æ®°¡ JList
ÀûÀýÇÑ Æøº¸´Ù ³ÐÀº °æ¿ì, ¶Ç´Â ·¹À̾ƿô ¹æÇâÀÌ HORIZONTAL_WRAP
À̸ç, °¡½ÃÇà Ä«¿îÆ®°¡ <= 0ÀÎ °æ¿ì´Â true¸¦ ¸®ÅÏÇÕ´Ï´Ù. ±×·¸Áö ¾ÊÀº °æ¿ì´Â false¸¦ ¸®ÅÏÇÕ´Ï´Ù. falseÀÎ °æ¿ì, ºäÆ÷Æ®ÀÇ ³ÐÀ̸¦ ÃßÀûÇÏÁö ¾Ê½À´Ï´Ù. À̰Ϳ¡ ÀÇÇØ
JViewport
ÀÚü°¡ JScrollPane
¿¡ »ðÀԵǾî
ÀÖ´Â °æ¿ì, ¼öÆò ½ºÅ©·ÑÀÌ »ý±â°Ô µË´Ï´Ù.
Scrollable
³»ÀÇ getScrollableTracksViewportWidth
JList
ÀûÀýÇÑ Æøº¸´Ù ³ÐÀº °æ¿ì´Â true, ±×·¸Áö ¾ÊÀº °æ¿ì´Â falseScrollable.getScrollableTracksViewportWidth()
public boolean getScrollableTracksViewportHeight()
JList
ÀÌ JViewport
¿¡ Ç¥½ÃµÇ¾î ºäÆ÷Æ®°¡ JList
ÀûÀýÇÑ ³ôÀ̺¸´Ù ³ôÀº °æ¿ì, ¶Ç´Â ·¹À̾ƿô ¹æÇâÀÌ VERTICAL_WRAP
À̸ç, °¡½ÃÇà Ä«¿îÆ®°¡ 0 ¾Æ·¡ÀÇ °æ¿ì´Â true¸¦ ¸®ÅÏÇÕ´Ï´Ù. ±×·¸Áö ¾ÊÀº °æ¿ì´Â false¸¦ ¸®ÅÏÇÕ´Ï´Ù. falseÀÎ °æ¿ì, ºäÆ÷Æ®ÀÇ ³ôÀ̸¦ ÃßÀûÇÏÁö ¾Ê½À´Ï´Ù. À̰Ϳ¡ ÀÇÇØ
JViewport
ÀÚü°¡ JScrollPane
¿¡ »ðÀԵǾî
ÀÖ´Â °æ¿ì, ¼öÁ÷ ½ºÅ©·ÑÀÌ »ý±â°Ô µË´Ï´Ù.
Scrollable
³»ÀÇ getScrollableTracksViewportHeight
Jlist
ÀûÀýÇÑ ³ôÀ̺¸´Ù ³ôÀº °æ¿ì´Â true, ±×·¸Áö ¾ÊÀº °æ¿ì´Â falseScrollable.getScrollableTracksViewportHeight()
protected String paramString()
JList
ij¸¯ÅÍ ¶óÀΠǥÇöÀ» ¸®ÅÏÇÕ´Ï´Ù. ÀÌ ¸Þ¼µå´Â µð¹ö±× Àü¿ëÀ̸ç, ¸®ÅϵÈ
ij¸¯ÅÍ ¶óÀÎÀÇ ³»¿ë ¹× Çü½ÄÀº ±¸Çö¿¡ µû¶ó¼ ´Ù¸¨´Ï´Ù. ¸®ÅϵÈ
ij¸¯ÅÍ ¶óÀÎÀº ºñ¾îÀÖ´Â °æ¿ì°¡ ÀÖ½À´Ï´Ù¸¸, null
·Î´Â µÇÁö ¾Ê½À´Ï´Ù.
JComponent
³»ÀÇ paramString
JList
ij¸¯ÅÍ ¶óÀΠǥÇöpublic AccessibleContext getAccessibleContext()
Accessible
³»ÀÇ getAccessibleContext
JComponent
³»ÀÇ getAccessibleContext
|
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 µµ ÂüÁ¶ÇϽʽÿÀ.