21 package com.realtime.crossfire.jxclient.gui.list;
32 import java.awt.Color;
33 import java.awt.Dimension;
35 import java.awt.Graphics;
36 import java.awt.Transparency;
37 import org.jetbrains.annotations.NotNull;
38 import org.jetbrains.annotations.Nullable;
100 super(tooltipManager, elementListener, name, Transparency.TRANSLUCENT);
105 index = defaultIndex;
113 throw new UnsupportedOperationException(
"Not supported yet.");
121 super.paintComponent(g);
122 g.setColor(
new Color(0, 0, 0, 0.0f));
123 g.fillRect(0, 0, getWidth(), getHeight());
125 g.setColor(
isActive() || selected ? Color.RED : Color.GRAY);
127 if (character == null) {
135 final int y = (getHeight()+font.getSize())/2;
139 g.drawString(character.
getName(), x, y);
141 g.drawString(character.
getRace(), x, y);
143 g.drawString(character.
getParty(), x, y);
145 g.drawString(character.
getMap(), x, y);
181 throw new UnsupportedOperationException(
"Not supported yet.");
189 throw new UnsupportedOperationException(
"Not supported yet.");
197 throw new UnsupportedOperationException(
"Not supported yet.");
213 if (this.index == index) {
237 if (this.selected == selected) {
Listener for GUIElement related events.
ImageIcon getOriginalImageIcon(int faceNum, @Nullable boolean[] isUnknownImage)
Returns the "original" face for a face ID.
final TooltipManager tooltipManager
The TooltipManager to update.
final CharacterInformationListener characterInformationListener
All listeners to the entry itself.
void removeCharacterInformationListener(final int index, @NotNull final CharacterInformationListener listener)
Removes a character entry listener for one entry.
final GUIElementListener elementListener
The GUIElementListener to notify.
static Dimension getTextDimension(@NotNull final String text, @NotNull final FontMetrics fontMetrics)
Returns the extents of a string when rendered in a given Font on this component.
final CharacterModel characterModel
Character model to display items from.
void setChanged()
Records that the contents have changed and must be repainted.
Manages image information ("faces") needed to display the map view, items, and spell icons...
void paintComponent(@NotNull final Graphics g)
A character displaying GUI element.
final String name
The name of this element.
final FacesManager facesManager
The FacesManager to use to display faces.
A GUIElement that can be set to active or inactive.
void setIndex(final int index)
Sets the index of this element.
boolean selected
If set, paint the element in "selected" state.
void addCharacterInformationListener(final int index, @NotNull final CharacterInformationListener listener)
Adds a character entry listener for one entry.
Utility class for Gui related functions.
CharacterInformation getEntry(final int index)
Returns a character entry by index.
void setTooltipText(@Nullable final String tooltipText)
Sets the tooltip text to show when the mouse is inside this element.the text to show ornull to disab...
static final long serialVersionUID
The serial version UID.
void setSelected(final boolean selected)
Sets the selected state.
Maintains the character list for an account.
GUICharacter(@NotNull final TooltipManager tooltipManager, @NotNull final FacesManager facesManager, @NotNull final GUIElementListener elementListener, @NotNull final String name, final int w, final int h, @NotNull final Font font, final int defaultIndex, final CharacterModel characterModel)
Creates a new instance.
void updateTooltip()
Updates the tooltip text.
boolean canScroll(final int distance)
Returns whether scrolling is possible.the distance to scroll whether scrolling is possible ...
final Font font
The font to use.
Dimension getPreferredSize()
void resetScroll()
Resets the scroll index to the default value.
int index
Index of the item to display in characterModel.
int getIndex()
Returns the index of this element.
Dimension getMinimumSize()
void scroll(final int distance)
Scrolls the element.the distance to scroll
boolean isActive()
Returns whether a GUI element is active.
Dimension getMinimumSizeInt()
Returns the minimal size needed to display this component.
Maintains a mapping of face numbers to face data.