20 package net.sf.gridarta.gui.dialog.gomap;
22 import java.awt.Component;
23 import javax.swing.DefaultListCellRenderer;
24 import javax.swing.JList;
27 import org.jetbrains.annotations.NotNull;
57 public Component
getListCellRendererComponent(@NotNull
final JList<?> list, @NotNull
final Object value,
final int index,
final boolean isSelected,
final boolean cellHasFocus) {
58 super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
60 final String name = mapsIndex.
getName(file);
61 setText((name == null ?
"?" : name) +
" (" + file.
getMapPath() +
")");
62 setToolTipText(value.toString());
Indexes maps by map name.
AbsoluteMapPath getMapPath()
Returns the map path within getMapsDir().
Base package of all Gridarta classes.
final MapsIndex mapsIndex
The displayed MapsIndex.
A DefaultListCellRenderer that renders values of a MapsIndex.
MapListCellRenderer(@NotNull final MapsIndex mapsIndex)
Creates a new instance.
static final long serialVersionUID
The serial version UID.
Component getListCellRendererComponent(@NotNull final JList<?> list, @NotNull final Object value, final int index, final boolean isSelected, final boolean cellHasFocus)
String getName(@NotNull final V value)
Returns the name associated with a value.
The location of a map file with a map directory.