682 @Override
683 public Component getListCellRendererComponent(JList<? extends File> list, File value, int index, boolean isSelected, boolean cellHasFocus) {
684 Component c = delegate.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
685
686 assert c instanceof JLabel;
687 JLabel label = (JLabel)c;
688 if (value == null) {
689 label.setText("");
690 return label;
691 }
692 label.setText(getFileChooser().getName(value));
693 Icon icon = getFileChooser().getIcon(value);
694 ii.icon = icon;
695 ii.depth = directoryComboBoxModel.getDepth(index);
696 label.setIcon(ii);
697
698 return label;
699 }
700 }
701
702 final static int space = 10;
703 class IndentIcon implements Icon {
704
705 Icon icon = null;
706 int depth = 0;
707
708 public void paintIcon(Component c, Graphics g, int x, int y) {
709 if (icon != null) {
710 if (c.getComponentOrientation().isLeftToRight()) {
711 icon.paintIcon(c, g, x+depth*space, y);
712 } else {
713 icon.paintIcon(c, g, x, y);
714 }
715 }
716 }
717
718 public int getIconWidth() {
719 return ((icon != null) ? icon.getIconWidth() : 0) + depth*space;
720 }
721
722 public int getIconHeight() {
|
682 @Override
683 public Component getListCellRendererComponent(JList<? extends File> list, File value, int index, boolean isSelected, boolean cellHasFocus) {
684 Component c = delegate.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
685
686 assert c instanceof JLabel;
687 JLabel label = (JLabel)c;
688 if (value == null) {
689 label.setText("");
690 return label;
691 }
692 label.setText(getFileChooser().getName(value));
693 Icon icon = getFileChooser().getIcon(value);
694 ii.icon = icon;
695 ii.depth = directoryComboBoxModel.getDepth(index);
696 label.setIcon(ii);
697
698 return label;
699 }
700 }
701
702 static final int space = 10;
703 class IndentIcon implements Icon {
704
705 Icon icon = null;
706 int depth = 0;
707
708 public void paintIcon(Component c, Graphics g, int x, int y) {
709 if (icon != null) {
710 if (c.getComponentOrientation().isLeftToRight()) {
711 icon.paintIcon(c, g, x+depth*space, y);
712 } else {
713 icon.paintIcon(c, g, x, y);
714 }
715 }
716 }
717
718 public int getIconWidth() {
719 return ((icon != null) ? icon.getIconWidth() : 0) + depth*space;
720 }
721
722 public int getIconHeight() {
|