Package megameklab.ui.util
Class CritCellUtil
java.lang.Object
megameklab.ui.util.CritCellUtil
Contains constants and utils for a unified crit cell display across unit types.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe height added to the text height of Crit Cells (padding)static final Colorstatic final StringThe base width of Crit Cells across units with 3 columns of crit listsstatic final Stringstatic final intThe vertical padding (in pixels) inserted above the first virtual (0-crit) slot entry. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidformatCell(JLabel cell, megamek.common.equipment.Mounted<?> mounted, boolean useColor, megamek.common.units.Entity entity, int index) Applies crit cell formatting to the given JLabel cell, which is assumed to display the given mounted in the given entity at the given crit cell index.static BorderlocationBorder(String title) static BorderlocationBorderNoLine(String title)
-
Field Details
-
CRITICAL_CELL_WIDTH_STRING
The base width of Crit Cells across units with 3 columns of crit lists -
CRITICAL_CELL_ADD_HEIGHT
public static final int CRITICAL_CELL_ADD_HEIGHTThe height added to the text height of Crit Cells (padding)- See Also:
-
ZERO_CRIT_SEPARATOR_HEIGHT
public static final int ZERO_CRIT_SEPARATOR_HEIGHTThe vertical padding (in pixels) inserted above the first virtual (0-crit) slot entry.- See Also:
-
CRITICAL_CELL_BORDER_COLOR
-
EMPTY_CRITICAL_CELL_TEXT
- See Also:
-
-
Constructor Details
-
CritCellUtil
public CritCellUtil()
-
-
Method Details
-
locationBorder
- Parameters:
title- the title for this component- Returns:
- a titled border using the given string as title placed centered atop the Component and using a
LocationBorderas a border. To be used for crit location blocks, especially when they have additional information ("Slots: 0/2") above or below the crits to group them visually.
-
locationBorderNoLine
- Parameters:
title- the title for this Component- Returns:
- a titled but otherwise empty border using the given string as the title placed centered atop the Component.
-
formatCell
public static void formatCell(JLabel cell, @Nullable megamek.common.equipment.Mounted<?> mounted, boolean useColor, megamek.common.units.Entity entity, int index) Applies crit cell formatting to the given JLabel cell, which is assumed to display the given mounted in the given entity at the given crit cell index. The JLabel cell should be a ListCellRenderer or TreeCellRenderer return value.
-