コード例 #1
0
 @Override
 protected void fillPage(
     final Page page,
     JList list,
     Object value,
     int index,
     boolean isSelected,
     boolean cellHasFocus) {
   Color foreground = isSelected ? list.getSelectionForeground() : list.getForeground();
   Color background = isSelected ? list.getSelectionBackground() : list.getBackground();
   renderCellValue(page, value, foreground, background, isSelected);
 }
コード例 #2
0
  @Override
  protected int getMaxAvailablePageWidth(
      JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
    Insets insets = list.getInsets(); // OWLFrameList.ITEM_BORDER.getBorderInsets();
    int componentWidth = list.getWidth();
    JViewport vp = (JViewport) SwingUtilities.getAncestorOfClass(JViewport.class, list);
    if (vp != null) {
      componentWidth = vp.getViewRect().width;
    }

    return componentWidth
        - list.getInsets().left
        - list.getInsets().right
        - insets.left
        + insets.right
        - 20;
  }