/** * Returns a new instance of BasicXListUI. BasicXListUI delegates are * allocated one per JList. * * @return A new ListUI implementation for the Windows look and feel. */ public static ComponentUI createUI(JComponent list) { return new BasicXListUI(); }
/** * Returns the closest location to the model index of the passed in * location. */ private int convertLocationToModel(int x, int y) { int row = convertLocationToRow(x, y, true); int column = convertLocationToColumn(x, y); if (row >= 0 && column >= 0) { return getModelIndex(column, row); } return -1; }
/** * {@inheritDoc} * @throws NullPointerException {@inheritDoc} */ public int locationToIndex(JList list, Point location) { maybeUpdateLayoutState(); return convertLocationToModel(location.x, location.y); }
if (list.getHeight() != listHeight) { updateLayoutStateNeeded |= heightChanged; redrawList(); if (list.getWidth() != listWidth) { updateLayoutStateNeeded |= widthChanged; redrawList(); maybeUpdateLayoutState(); ListModel dataModel = getViewModel(); ListSelectionModel selModel = list.getSelectionModel(); int size; startColumn = convertLocationToColumn(paintBounds.x, paintBounds.y); endColumn = convertLocationToColumn(paintBounds.x + paintBounds.width, paintBounds.y); } else { startColumn = convertLocationToColumn(paintBounds.x + paintBounds.width, paintBounds.y); endColumn = convertLocationToColumn(paintBounds.x, paintBounds.y); int leadIndex = adjustIndex(list.getLeadSelectionIndex(), list); int rowIncrement = (layoutOrientation == JList.HORIZONTAL_WRAP) ? columnCount : 1;
focusListener = createFocusListener(); mouseInputListener = createMouseInputListener(); propertyChangeListener = createPropertyChangeListener(); listSelectionListener = createListSelectionListener(); listDataListener = createListDataListener(); list.addMouseMotionListener(mouseInputListener); list.addPropertyChangeListener(propertyChangeListener); list.addKeyListener(getHandler());
maybeUpdateLayoutState(); if (minIndex >= getElementCount()) { return null; Rectangle minBounds = getCellBounds(list, minIndex); return minBounds; Rectangle maxBounds = getCellBounds(list, maxIndex); int minRow = convertModelToRow(minIndex); int maxRow = convertModelToRow(maxIndex);
maybeUpdateLayoutState(); int row = convertModelToRow(index); int column = convertModelToColumn(index); h = getRowHeight(index); break;
private Rectangle getDropLineRect(JList.DropLocation loc) { int size = getElementCount(); if (index == size) { decr = true; } else if (index != 0 && convertModelToRow(index) != convertModelToRow(index - 1)) { Rectangle prev = getCellBounds(list, index - 1); Rectangle me = getCellBounds(list, index); Point p = loc.getDropPoint(); rect = getCellBounds(list, index); if (isLeftToRight) { rect.x += rect.width; rect = getCellBounds(list, index); if (!isLeftToRight) { rect.x += rect.width - DROP_LINE_THICKNESS; if (index == size) { index--; rect = getCellBounds(list, index); rect.y += rect.height; } else if (index != 0 && convertModelToColumn(index) != convertModelToColumn(index - 1)) { Rectangle prev = getCellBounds(list, index - 1); Rectangle me = getCellBounds(list, index); Point p = loc.getDropPoint();
/** * Convert the JList relative coordinate to the row that contains it, * based on the current layout. If y0 doesn't fall within any row, * return -1. * * @return The row that contains y0, or -1. * @see #getRowHeight * @see #updateLayoutState */ protected int convertYToRow(int y0) { return convertLocationToRow(0, y0, false); }
checkBaselinePrecondition(c, width, height); int rowHeight = list.getFixedCellHeight(); UIDefaults lafDefaults = UIManager.getLookAndFeelDefaults();
if (list.getHeight() != listHeight) { updateLayoutStateNeeded |= heightChanged; redrawList(); if (list.getWidth() != listWidth) { updateLayoutStateNeeded |= widthChanged; redrawList(); maybeUpdateLayoutState(); ListModel dataModel = getViewModel(); ListSelectionModel selModel = list.getSelectionModel(); int size; startColumn = convertLocationToColumn(paintBounds.x, paintBounds.y); endColumn = convertLocationToColumn(paintBounds.x + paintBounds.width, paintBounds.y); } else { startColumn = convertLocationToColumn(paintBounds.x + paintBounds.width, paintBounds.y); endColumn = convertLocationToColumn(paintBounds.x, paintBounds.y); int leadIndex = adjustIndex(list.getLeadSelectionIndex(), list); int rowIncrement = (layoutOrientation == JList.HORIZONTAL_WRAP) ? columnCount : 1;
focusListener = createFocusListener(); mouseInputListener = createMouseInputListener(); propertyChangeListener = createPropertyChangeListener(); listSelectionListener = createListSelectionListener(); listDataListener = createListDataListener(); list.addMouseMotionListener(mouseInputListener); list.addPropertyChangeListener(propertyChangeListener); list.addKeyListener(getHandler());
maybeUpdateLayoutState(); if (minIndex >= getElementCount()) { return null; Rectangle minBounds = getCellBounds(list, minIndex); return minBounds; Rectangle maxBounds = getCellBounds(list, maxIndex); int minRow = convertModelToRow(minIndex); int maxRow = convertModelToRow(maxIndex);
maybeUpdateLayoutState(); int row = convertModelToRow(index); int column = convertModelToColumn(index); h = getRowHeight(index); break;
private Rectangle getDropLineRect(JList.DropLocation loc) { int size = getElementCount(); if (index == size) { decr = true; } else if (index != 0 && convertModelToRow(index) != convertModelToRow(index - 1)) { Rectangle prev = getCellBounds(list, index - 1); Rectangle me = getCellBounds(list, index); Point p = loc.getDropPoint(); rect = getCellBounds(list, index); if (isLeftToRight) { rect.x += rect.width; rect = getCellBounds(list, index); if (!isLeftToRight) { rect.x += rect.width - DROP_LINE_THICKNESS; if (index == size) { index--; rect = getCellBounds(list, index); rect.y += rect.height; } else if (index != 0 && convertModelToColumn(index) != convertModelToColumn(index - 1)) { Rectangle prev = getCellBounds(list, index - 1); Rectangle me = getCellBounds(list, index); Point p = loc.getDropPoint();
/** * Convert the JList relative coordinate to the row that contains it, * based on the current layout. If y0 doesn't fall within any row, * return -1. * * @return The row that contains y0, or -1. * @see #getRowHeight * @see #updateLayoutState */ protected int convertYToRow(int y0) { return convertLocationToRow(0, y0, false); }
checkBaselinePrecondition(c, width, height); int rowHeight = list.getFixedCellHeight(); UIDefaults lafDefaults = UIManager.getLookAndFeelDefaults();
if (list.getHeight() != listHeight) { updateLayoutStateNeeded |= heightChanged; redrawList(); if (list.getWidth() != listWidth) { updateLayoutStateNeeded |= widthChanged; redrawList(); maybeUpdateLayoutState(); ListModel dataModel = getViewModel(); ListSelectionModel selModel = list.getSelectionModel(); int size; startColumn = convertLocationToColumn(paintBounds.x, paintBounds.y); endColumn = convertLocationToColumn(paintBounds.x + paintBounds.width, paintBounds.y); } else { startColumn = convertLocationToColumn(paintBounds.x + paintBounds.width, paintBounds.y); endColumn = convertLocationToColumn(paintBounds.x, paintBounds.y); int leadIndex = adjustIndex(list.getLeadSelectionIndex(), list); int rowIncrement = (layoutOrientation == JList.HORIZONTAL_WRAP) ? columnCount : 1;
focusListener = createFocusListener(); mouseInputListener = createMouseInputListener(); propertyChangeListener = createPropertyChangeListener(); listSelectionListener = createListSelectionListener(); listDataListener = createListDataListener(); list.addMouseMotionListener(mouseInputListener); list.addPropertyChangeListener(propertyChangeListener); list.addKeyListener(getHandler());
maybeUpdateLayoutState(); if (minIndex >= getElementCount()) { return null; Rectangle minBounds = getCellBounds(list, minIndex); return minBounds; Rectangle maxBounds = getCellBounds(list, maxIndex); int minRow = convertModelToRow(minIndex); int maxRow = convertModelToRow(maxIndex);